JavaCupiX Posted October 9, 2008 Share Posted October 9, 2008 Hi, I'm struggling to use the "EnumDisplayMonitors" function available in the "user32.dll" (http://msdn.microsoft.com/en-us/library/ms534809(VS.85).aspx), the problem is related to the use of callback functions, I just don't get how all of this can be used in autoit. I've started with that but can't get more further... any idea? $handle = DLLCallbackRegister ("_MonitorEnumProc", "long", "long;long;long;str") ;~ ; Call EnumDisplayMonitors DllCall("user32.dll", "bool", "EnumDisplayMonitors", "long", 0, "long", 0, "ptr", DllCallbackGetPtr($handle), "lparam", 10) ;~ ; Delete callback function DllCallbackFree($handle) Link to comment Share on other sites More sharing options...
monoceres Posted October 9, 2008 Share Posted October 9, 2008 (edited) Hi! You have got some errors, here's how you should do it $callback=DllCallbackRegister("MonitorEnumProc","int","ptr;ptr;ptr;lparam") DllCall("user32.dll","int","EnumDisplayMonitors","ptr",0,"ptr",0,"ptr",DllCallbackGetPtr($callback),"lparam",10) Func MonitorEnumProc($hMonitor,$hdcMonitor,$lprect,$lparam) MsgBox(0,"Monitor","Monitor handle: "&$hMonitor&@CRLF&"LPARAM: "&$lparam) EndFunc Edited October 9, 2008 by monoceres Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
JavaCupiX Posted October 9, 2008 Author Share Posted October 9, 2008 Hi! You have got some errors, here's how you should do it $callback=DllCallbackRegister("MonitorEnumProc","int","ptr;ptr;ptr;lparam") DllCall("user32.dll","int","EnumDisplayMonitors","ptr",0,"ptr",0,"ptr",DllCallbackGetPtr($callback),"lparam",10) Func MonitorEnumProc($hMonitor,$hdcMonitor,$lprect,$lparam) MsgBox(0,"Monitor","Monitor handle: "&$hMonitor&@CRLF&"LPARAM: "&$lparam) EndFunc Thanks a lot! 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