MaestroDW Posted January 18, 2005 Share Posted January 18, 2005 Hi all, Any suggestions on how to lock the screen temporarily to avoid rapid flashing and then unlock the screen when required? Is this a feature of AutoIt or an API call? TIA DW Link to comment Share on other sites More sharing options...
ezzetabi Posted January 18, 2005 Share Posted January 18, 2005 No. If you lock you... locked! But what about making a big always on top GUI window? Link to comment Share on other sites More sharing options...
this-is-me Posted January 18, 2005 Share Posted January 18, 2005 You can use LockWindowUpdate through dllcall to prevent a certain window from doing any updates. Who else would I be? Link to comment Share on other sites More sharing options...
MaestroDW Posted January 18, 2005 Author Share Posted January 18, 2005 (edited) Taking this further, perhaps some of you will help with my coding.In user32.dll we can use GetDeskTopWindow to get a handle for the entire desktop window.The Windows API says:The GetDesktopWindow function retrieves the handle of the desktop window. The desktop window covers the entire screen and is the area on top of which all icons and other windows are painted. Then we can use LockWindowUpdate(hwnd)Here is my effort so far.[Warning to all: run at your own risk, bugs in this code can require a reboot.]expandcollapse popupFunc GetDeskTopWindowHWND() ;I thought I should declare an array but it causes an error, so next line remmed out. ;Dim $DskTp[1] ;Get a window handle for the Desktop window ;WINAPI = HWND GetDesktopWindow(void) ;The GetDesktopWindow function retrieves the handle of the desktop window. ;The desktop window covers the entire screen and is the area on top of which all icons and other windows are painted. $DskTp = DllCall("user32.dll", "", "GetDesktopWindow", "hwnd", 0) Return $DskTp EndFunc Func LockDeskTopWindow($Dsk) ;Lock the HWND of the Desktop ;WINAPI = BOOL LockWindowUpdate(hwndLock) $LckDskTp = DllCall("user32.dll", "int", "lockwindowupdate($Dsk)", "int", 0) ;return val = 0 = failure | nonzero = success Return $LckDskTp EndFunc ;Elsewhere in my code I have this function which uses the above two functions. Func RemoveAllWindows(); This removes three windows by sending keys to menu items in an open application $DskHwnd = GetDeskTopWindowHWND() MsgBox(0,"RetVal", $DskHwnd & @CRLF&@error); Just checking all is well LockDeskTopWindow($DskHwnd); I believe this works as a toggle and is repeated below to unlock the desktop window again, or else we must reboot! However, not working IMO MsgBox(0,"RetVal", $DskHwnd & @CRLF&@error); Just checking all is well WinWait("Harmonise! -- ","") If Not WinActive("Harmonise! -- ","") Then WinActivate("Harmonise! -- ","") WinWaitActive("Harmonise! -- ","") WinMove("Harmonise! -- ","",$HarmWinPos[0],$HarmWinPos[1]); these have been set previously and help reset the open app. to its default position. Send("!w2"); keys to close window 2 Send("!w3"); and 3 Send("!w4"); and 4 LockDeskTopWindow($DskHwnd); to unlock the desktop again. MsgBox(0,"RetVal", $DskHwnd & @CRLF&@error); Just checking all is well EndFuncCan any of you see how to improve this?DW Edited January 19, 2005 by MaestroDW Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now