Click here to Skip to main content
15,899,026 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to draw bitmaps without access to HDC or HWND Pin
hvanzyll4-Oct-07 6:05
hvanzyll4-Oct-07 6:05 
GeneralRe: How to draw bitmaps without access to HDC or HWND Pin
Mark Salsbery4-Oct-07 6:19
Mark Salsbery4-Oct-07 6:19 
GeneralRe: How to draw bitmaps without access to HDC or HWND [modified] Pin
hvanzyll4-Oct-07 6:27
hvanzyll4-Oct-07 6:27 
GeneralRe: How to draw bitmaps without access to HDC or HWND Pin
Mark Salsbery4-Oct-07 6:54
Mark Salsbery4-Oct-07 6:54 
GeneralRe: How to draw bitmaps without access to HDC or HWND Pin
hvanzyll4-Oct-07 6:57
hvanzyll4-Oct-07 6:57 
Questionwhat can send WM_ERASEBKGND? Pin
dawka19064-Oct-07 4:05
dawka19064-Oct-07 4:05 
AnswerRe: what can send WM_ERASEBKGND? Pin
Mark Salsbery4-Oct-07 6:02
Mark Salsbery4-Oct-07 6:02 
QuestionWM_DESTROY message does not appear to post on VK_ESCAPE [modified] Pin
Sauce!4-Oct-07 3:06
Sauce!4-Oct-07 3:06 
I'm following along with tutorials from www.directxtutorial.com[^] and have succesfully gotten a d3d window up and running. The next section of the tutorial covers running the app in fullscreen, without a title bar or an exit button, requiring changes to be made. One of these changes is the inclusion of a KEY_DOWN and KEY_UP macro, allowing me to check the state of any key. This is implemented so that there is a means of closing the app, using the escape key, however upon pressing the escape key, nothing happens. If I change the line if(KEY_DOWN(VK_ESCAPE)) to if(KEY_UP(VK_ESCAPE)) then the app will exit instantly. Can anybody explain what is happening or what might be causing it?

#define KEY_DOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)<br />
#define KEY_UP(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 0 : 1)<br />
<br />
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
                                  SNIP!<br />
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
<br />
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)<br />
{<br />
	switch(msg)<br />
		{<br />
		case WM_CLOSE:<br />
			DestroyWindow(hWnd);<br />
		break;<br />
		case WM_DESTROY:<br />
			Cleanup();<br />
			PostQuitMessage(0);<br />
			return 0;<br />
		case WM_PAINT:<br />
			Render();<br />
			ValidateRect(hWnd, NULL);<br />
<br />
			// check the 'escape' key<br />
			if(KEY_DOWN(VK_ESCAPE))<br />
			PostMessage(hWnd, WM_DESTROY, 0, 0);<br />
			return 0;<br />
		}<br />
	return DefWindowProc(hWnd, msg, wParam, lParam);<br />
}



-- modified at 10:02 Thursday 4th October, 2007
AnswerRe: WM_DESTROY message does not appear to post on VK_ESCAPE Pin
led mike4-Oct-07 4:36
led mike4-Oct-07 4:36 
GeneralRe: WM_DESTROY message does not appear to post on VK_ESCAPE Pin
Sauce!4-Oct-07 4:52
Sauce!4-Oct-07 4:52 
GeneralRe: WM_DESTROY message does not appear to post on VK_ESCAPE Pin
David Crow4-Oct-07 4:59
David Crow4-Oct-07 4:59 
GeneralRe: WM_DESTROY message does not appear to post on VK_ESCAPE Pin
Sauce!4-Oct-07 5:29
Sauce!4-Oct-07 5:29 
QuestionFunction Pointer? [modified] Pin
kiranin4-Oct-07 3:01
kiranin4-Oct-07 3:01 
AnswerRe: Function Pointer? Pin
toxcct4-Oct-07 3:15
toxcct4-Oct-07 3:15 
GeneralRe: Function Pointer? Pin
kiranin4-Oct-07 3:25
kiranin4-Oct-07 3:25 
GeneralRe: Function Pointer? Pin
toxcct4-Oct-07 3:27
toxcct4-Oct-07 3:27 
GeneralRe: Function Pointer? Pin
kiranin4-Oct-07 3:37
kiranin4-Oct-07 3:37 
AnswerRe: Function Pointer? Pin
David Crow4-Oct-07 3:22
David Crow4-Oct-07 3:22 
QuestionBuild binary with debugging information Pin
Programm3r4-Oct-07 2:17
Programm3r4-Oct-07 2:17 
QuestionHow to identify click event of Tab control? Pin
Atul234-Oct-07 1:49
Atul234-Oct-07 1:49 
AnswerRe: How to identify click event of Tab control? Pin
Naveen4-Oct-07 1:52
Naveen4-Oct-07 1:52 
AnswerRe: How to identify click event of Tab control? Pin
David Crow4-Oct-07 3:24
David Crow4-Oct-07 3:24 
Questionusing, namespace and enum: VS2003 Compiler Bug? Pin
Russell'4-Oct-07 1:35
Russell'4-Oct-07 1:35 
AnswerRe: using, namespace and enum: VS2003 Compiler Bug? Pin
jhwurmbach4-Oct-07 2:12
jhwurmbach4-Oct-07 2:12 
GeneralRe: using, namespace and enum: VS2003 Compiler Bug? Pin
Russell'4-Oct-07 2:22
Russell'4-Oct-07 2:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.