Does any one or can any one help me with handling messages?

Pages: 12
You can't be arrogant and ignorant at the same time. In the end, no one will help you.


+100 @ This.

You want to know why you're not getting good responses, spoonlicker? This is exactly why.

People reach out to you and you always shoot down their response with something like
"that code sucks"
"you did a bad job of explaining that"
"I don't understand that so it must be wrong"
etc
etc


If you want real help you need to get your head out of your ass and stop being a total jerk.

Although honestly I think I (and possibly some others) are already past the point of no return with you. I'm not about to waste my time on a response to any of your questions even if you pull a complete 180.
Last edited on
See, I wanted it to be drawn to the window when I click, and although that code puts the text exactly where you click it automatically draws it before you do once the window is created.


I'm sorry its not perfect enhough for you. thats not much of a question to do with the windows api, its just simple programming using bools to toggle when you want it to draw:

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
LRESULT CALLBACK MainWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	static int x = 0, y = 0;
	static bool bDrawText = false;

    switch (message)
    {
        case WM_LBUTTONDOWN:
        	bDrawText = true;
			x = LOWORD(lParam);
			y = HIWORD(lParam);
			InvalidateRect(hwnd, NULL, TRUE);
            return 0;

// optional, text will vanish on mouse up
	case WM_LBUTTONUP:
            bDrawText = false;
            InvalidateRect(hwnd, NULL, TRUE);
            return 0;

        case WM_DESTROY:
            PostQuitMessage (0);
            return 0;

        case WM_PAINT:
		{
			HDC hdc;
			PAINTSTRUCT PAINT;
			hdc = BeginPaint(hwnd, &PAINT);

			if (bDrawText) // only draw when you want.
			{
				const char *text = "I clicked!";
				TextOut(hdc, x, y, text, strlen(text));
			}

			EndPaint(hwnd, &PAINT);
			return 0;
        }
	}
    return DefWindowProc (hwnd, message, wParam, lParam);
}
Last edited on
@ kaije: Thought I'd outright tell you this, Spoon Licker has a certain reputation on this site. I don't want to personally set your opinion of her, but know that out of what has been said so far on this thread, none of it is false.
Topic archived. No new replies allowed.
Pages: 12