Using the VB Sample Monitor.exe as found when searching VB Help for "SAMPLE:
MULTIMON.EXE" seems to have a problem.
The program successfully knows I have two Monitors and successfully returns
the virtual desktop size.
But, the function GetMonitorFromWindow() always returns a 0 which then
two buttons "Where is the Monitor I'm On?" and "Center this Form on the
Current Monitor" to always use my left Primary Monitor.
I was wondering if this works for anyone else? And if so do you have any
it wouldn't work for me.
This function always returns a 0. I'm using VB6.
Public Function GetMonitorFromWindow(hwnd As Long, dwFlags As Long) As Long
'Returns a monitor handle that the Window (hwnd) is in
Dim lReturn As Long
On Error GoTo GetMonitorFromWindow_Err
lReturn = MonitorFromWindow(hwnd, dwFlags) '<<<< always returns a 0
GetMonitorFromWindow = lReturn
If Err.Number = 453 Then
'Non-Multimonitor OS, return -1
GetMonitorFromWindow = -1