VisualStudio Windows32 Form Event (not) bug

Hello evryone,

For school i am required to start work on my DX engine that's all fine for the most part. But now i noticed that lets say i have an windows message for button down(WM_LBUTTONDOWN) and break in some code in visual studio for debugging. the button event (WM_LBUTTONUP) does not get triggered.

if i don't break it gets triggered just fine. i was wondering does this seem familiar to someone.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
std::queue<MSG> messageQueue;
//retreve messages to process
bool MessageAvaiable(MSG& msg)
{
	if (messageQueue.size() > 0)
	{
		msg = messageQueue.front();
		messageQueue.pop();
		return true;
	}
	return false;
}
//callback stuff
LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	MSG msg;
	msg.hwnd = hWnd;
	msg.message = message;
	msg.wParam = wParam;
	msg.lParam = lParam;

	switch (message)
	{
		case WM_DESTROY:
		{
			msg.message = WM_QUIT;
			messageQueue.push(msg);
			PostQuitMessage(0);
			return 0;
		}
		break;
		default:
			messageQueue.push(msg);
			return DefWindowProc(hWnd, message, wParam, lParam); //let the window do its defailt stuff
	}

	return 0;
}

//this gets caled from the main loop 
void ProcessWindowsMessages()
{
	MSG msg = { 0 };
	if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);	
	}
}


i am pretty new to this (second day of DX) but i would think its ether skips over the event(MSG) or i am losing(not catching) it. i would like some insight on how windows handles this or how i should handle it. ;)
Last edited on
Ok So my problem is not a bug. after some research i managed to understand what was going wrong.

the thing is the form loses focus thus sending the release event to the other active window. so all you need to do if you have the same problem is catch the WM_KILLFOCUS message and set any button bool value back to false.

if any one had any other suggestions for a better solution i am always open to them.
Topic archived. No new replies allowed.