MaestroDW Posted January 19, 2005 Share Posted January 19, 2005 I think this would be useful for all the girls too! Please advise on how to fix this dllcall to return a handle to the desktop window. Func GetDeskTopWindowHWND() ;Get a window handle for the Desktop window ;WINAPI describes as 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", "none", "GetDesktopWindow", "hwnd", 0) Return $DskTp EndFunc I am familiar with using dlls in other languages. At first, that appears to be a handicap while trying to do the same in AutoIt! Please advise how to knock this function into shape. Many thanks, DW PS No offence to Sandra, I just need some TLC from the Wise Ones too! Link to comment Share on other sites More sharing options...
SlimShady Posted January 19, 2005 Share Posted January 19, 2005 (edited) I think I know a solution.I'm doing 2 things at once so it may take a while.Edit:The DllCall wasn't working that's for sure.I know that the title of the desktop is "Program Manager".But I'm not sure if that's for all Windows versions or only Win2000+.Quote from http://www.commandline.co.uk/cmdow/.. by default its caption is "Program Manager ..From CodeGuru.com:The desktop, as you see it, is just a big ListView. So, we can use the FindWindow() and FindWindowEx() APIs to get the handle of the ListView. First, we use FindWindow() to find the window with the title "Program Manager;"That's all I found.And now a working solution.What this script does:Won't let you click any icon on your desktop until you click on "OK".$DeskTopHandle = GetDeskTopWindowHWND() WinSetState($DeskTopHandle, "", @SW_DISABLE) MsgBox(64, "Debug", "$DeskTopHandle:" & @CRLF & $DeskTopHandle) WinSetState($DeskTopHandle, "", @SW_ENABLE) Func GetDeskTopWindowHWND() $DskTp = WinGethandle("Program Manager", "") Return $DskTp EndFunc Edited January 19, 2005 by SlimShady Link to comment Share on other sites More sharing options...
MaestroDW Posted January 19, 2005 Author Share Posted January 19, 2005 Thank you for this reply and all this info. Your method does return a handle and it may well be useful to move ahead with the anti-flashing problem I posted yesterday.BTW did my dllcall not work because of an error on my part or something else?Thanks again for this.DWI think I know a solution.I'm doing 2 things at once so it may take a while.Edit:The DllCall wasn't working that's for sure.I know that the title of the desktop is "Program Manager".But I'm not sure if that's for all Windows versions or only Win2000+.Quote from http://www.commandline.co.uk/cmdow/From CodeGuru.com:That's all I found.And now a working solution.What this script does:Won't let you click any icon on your desktop until you click on "OK".$DeskTopHandle = GetDeskTopWindowHWND() WinSetState($DeskTopHandle, "", @SW_DISABLE) MsgBox(64, "Debug", "$DeskTopHandle:" & @CRLF & $DeskTopHandle) WinSetState($DeskTopHandle, "", @SW_ENABLE) Func GetDeskTopWindowHWND() $DskTp = WinGethandle("Program Manager", "") Return $DskTp EndFunc<{POST_SNAPBACK}> Link to comment Share on other sites More sharing options...
Administrators Jon Posted January 19, 2005 Administrators Share Posted January 19, 2005 $DskTp = DllCall("user32.dll", "hwnd", "GetDesktopWindow") $DskTp[0] is the return value Deployment Blog:Â https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming:Â https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
SlimShady Posted January 19, 2005 Share Posted January 19, 2005 (edited) I used/tested Jon's code exactly before he posted. I thought the value would be in $DskTp[1] That's why I gave up and decided to post the solution that works guaranteed. Edited January 19, 2005 by SlimShady Link to comment Share on other sites More sharing options...
MaestroDW Posted January 19, 2005 Author Share Posted January 19, 2005 Thanks Jon. That will help consolidate my interpretation of the DLLCall info in the AutoIt Help examples. DW Link to comment Share on other sites More sharing options...
para Posted January 19, 2005 Share Posted January 19, 2005 Thank you so much for making this thread. That title made me laugh for a good 5 minutes... Peferect example of true mokery Good job -Para Link to comment Share on other sites More sharing options...
Lazycat Posted January 19, 2005 Share Posted January 19, 2005 That title made me laugh for a good 5 minutes...Exactly the same Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s]) 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