|
-
April 25th, 2001, 11:51 AM
#1
EnumDisplayMonitors
I'm having trouble enumerating the display monitors. I have the following code in a module:
private Declare Function EnumDisplayMonitors Lib "user32.dll" _
(byval lHdc as Long, lpCRect as long, _
MonitorEnumProc as Long, byval LPARAM as Long) as Long
public Function EnumAllMonitorsProc( _
HMONITOR as Long, _
HDC as Long, _
LPRECT as Long, _
LPARAM as Long) as Long
MsgBox HMONITOR & vbNewLine & HDC & vbNewLine & _
LPRECT & vbNewLine & LPARAM
EnumAllMonitorsProc = true
End Function
And then In my form:
private Sub Command1_Click()
dim rc
rc = EnumDisplayMonitors(vbNull, vbNull, AddressOf EnumAllMonitorsProc, 0)
If rc = 0 then MsgBox LastSystemError
End Sub
The problem is that if, according to MSDN, EnumDisplayMonitors fails it should return 0 else it should return non-zero. When I press the command button the function is returning 0 and the LastSystemError function (taken from www.merrioncomputing.com thanks to ClearCode) returns "The operation completed successfully.". However, I know this not to be true. If anyone has experience with the EnumDisplayMonitors function please help. I had to write the declaration myself from the MSDN (c++ version).
-K
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|