RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

VC++ Global Hook DLL Oddity

wreckage

Wanderer
VC++ Global Hook DLL Oddity

I'm using Visual C++ Express
I've created a DLL for a global hook
I've tried this with both the GetMessage hook and the standard Mouse hook

In both cases I'm met with the same results. I'm simply trying to catch when someone right clicks on a forms minimize button. Naturally I'm watching for the WM_NCRBUTTONUP message to accomplish this. What happens is truly odd indeed. When the hooks are in place the hook doesn't trigger properly when I click the minimize button. If I click dead center or to the left of dead center on the minimze button with my right mouse button I get a system menu. If I click to the right of dead center over almost to the right border of the minimize button then my hook triggers properly but only far over to the right edge of the button. I've tested this with the maximize button and close button and they both function properly. Also if I use the left mouse button on my minimize button everything performs as expected. The only time this happens is in MY code and with the RIGHT MOUSE button.

Got any ideas? I can attach my projects if you need them.
 

Jeff

Lord
Just a suggestion but you should show the code so that if its something small you missed someone might be able to point it out :)
 

wreckage

Wanderer
Sorious said:
Just a suggestion but you should show the code so that if its something small you missed someone might be able to point it out :)

Actually I used a program similar to Microsoft Spy++ to discover that it is actually a bug in Windows.

Non-Client mouse clicks are supposed to result in the following messages:
WM_NCRBUTTONDOWN
WM_NCRBUTTONUP

In the case of the close and maximize buttons this is the case, however when you click on the minimize button this is the results:
WM_NCRBUTTONDOWN
WM_RBUTTONUP <------- This is not a non-client message and should not occur on any non-client areas of the window.

With this in mind there is nothing I can do and there is no error in my code.
 
Top