# Issue with Left mouse down in a Modeless Dialog Box

This topic is 5036 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I have a modeless dialog box running and when I click the mouse inside of it I get two message pumps? If I read the mouse location I get two identical outputs using a dump to a text file. I am taking control of the mouse when I click down and releasing it when I release the mouse button...

case WM_LBUTTONDOWN:
SetCapture(hDlg);
gameCoord.GetScreenCoordinates(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
gameCoord.CalulateScreenCoordinates();
fout << "Screen Coords X " << GET_X_LPARAM(lParam) << "Screen Coords Y " << GET_Y_LPARAM(lParam) << endl;
fout << "X " << gameCoord.ReturnScreenCoordinates(0) << endl;
fout << "Y " << gameCoord.ReturnScreenCoordinates(1) << endl;
fout << "Z " << gameCoord.ReturnScreenCoordinates(2) << endl << endl;
return true;
break;

case WM_LBUTTONUP:
ReleaseCapture();
return true;
break;



##### Share on other sites
I believe you need to return 0 instead of 1 after the message is processed. I comfirmed this with my windows code. I hope this helps [smile].

- Drew

##### Share on other sites
Quote:
 Original post by Drew_BentonI believe you need to return 0 instead of 1 after the message is processed. I comfirmed this with my windows code. I hope this helps [smile].- Drew

Sorry but no help with returning Zero instead, I even took out the return and still get two values... Thanks for the idea though. Not sure if there is any difference in using a Modeless dialog box but I am calling these from that window's Proc function... Also just a note I can't use WM_MOUSEWHEEL either says its undefined? I have windows.h included

##### Share on other sites
BUMP!! Anyone? If I click my left mouse button or movee the wheel, right click while in the modeless dialog window I am getting two calls to all my ofstream or cout objects... So if I print location X when left mouse button is clicked I get X = 100 X = 100 again? Do I have to take control of the window completely and shut down the main loop? Am I missing some kind of special function for these kinds of windows? Thanks

##### Share on other sites
Update, if I run the rendering window in the main window and get rid of the dialog box, and take input from WinMain() Proc() I get only one value at a time instead of two? Does this help anyone who knows more about this than me throw up a flag on what might be wrong? Thanks

##### Share on other sites
what do you mean you get two message pumps, a message pump is the actual code that handles\dispatches the messages. Do you mean you get 2 instances of the WM_LBUTTONDOWN?? Its possible that you reflected the message from your main window to your modaless dialog.

Cheers
Chris

##### Share on other sites
Quote:
 Original post by chollida1what do you mean you get two message pumps, a message pump is the actual code that handles\dispatches the messages. Do you mean you get 2 instances of the WM_LBUTTONDOWN?? Its possible that you reflected the message from your main window to your modaless dialog.CheersChris

Ah I think we are on the same page? Yeah it calls WM_LBUTTONDOWN twice from what I can tell due to it prints out the info twice when I do anything in the modaless dialog window. So I am confused on how to fix that? Thanks

##### Share on other sites
what's above the WM_LBUTTONDOWN case, perhaps you didn't break out of it?? Perhaps its the WM_MOUSEMOVE or WM_LBUTTONUP case??

Cheers
Chris

##### Share on other sites
URGH!! No dice. Still getting two outputs...

##### Share on other sites
I'd like to see the decalaration of the Dialog's CALLBACK as well as the main switch statement where these case labels are located...

1. 1
2. 2
Rutin
18
3. 3
4. 4
5. 5

• 12
• 14
• 9
• 9
• 9
• ### Forum Statistics

• Total Topics
632924
• Total Posts
3009233
• ### Who's Online (See full list)

There are no registered users currently online

×