Sign in to follow this  

Issue with Left mouse down in a Modeless Dialog Box

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
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

Share this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites
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

Share this post


Link to post
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...

Share this post


Link to post
Share on other sites
Ah forget it I found the problem... Thanks all for the help, but it was due to I was calling IsDialogMessage()... OOPS need to clean up code if I plan on the window not being destroyed!!

Share this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this