Issue with Left mouse down in a Modeless Dialog Box

Started by
9 comments, last by MARS_999 19 years, 3 months ago
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;

Advertisement
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
Quote:Original post by Drew_Benton
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


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
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
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
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
CheersChris
Quote:Original post by chollida1
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


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
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
CheersChris
URGH!! No dice. Still getting two outputs...
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...

This topic is closed to new replies.

Advertisement