By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,450 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

Multiple Monitor Support Mystery Solved!

P: 1
In the archived discussion at

http://www.thescripts.com/forum/thread13209.html

several users were trying to figure out why a sample app from Microsoft wasn't working properly. The function of the app is to demonstrate how to determine on which monitor (of a multiple monitor system) a given window is located.

The sample app is called multimon.exe, and it's still available (as of 8-Sep-2007) from Microsoft at:

http://support.microsoft.com/kb/q194578/

Unfortunately, regardless of where the window is located, the sample app always reports that it is on the default monitor. The users in the archived discussion were unable to come up with an explanation for this behavior. As far as I can tell, no one has ever posted a solution in this forum.

I experienced the same problem with the multimon app, but I found another sample app (thanks to Google) that worked correctly. The difference? A missing "ByVal" in the API declaration in the clsMonitor declaration section in Microsoft's sample!

Here's the original declaration:

Private Declare Function MonitorFromWindow Lib "user32" ( _
ByVal hwnd As Long, _
dwFlags As Long) As Long

And here's the correction:

Private Declare Function MonitorFromWindow Lib "user32" ( _
ByVal hwnd As Long, _
ByVal dwFlags As Long) As Long

Note the "ByVal" in front of dwFlags

Anyone trying to use the multimon sample just needs to search the code for "dwFlags As Long" and he will eventually find two API declarations, one of which needs to have ByVal added as described above.

Lorin
Sep 8 '07 #1
Share this Question
Share on Google+
1 Reply


Robbie
100+
P: 180
This doesn't affect me (at least, not now), but well done!
Did you work that out? That's an amazing (-ly hard to find) find, thanks for posting it!
Sep 8 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.