Click here to Skip to main content
15,892,674 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: GetProcAddress, I'm confused Pin
Stephen Hewitt23-Jan-07 11:35
Stephen Hewitt23-Jan-07 11:35 
GeneralRe: GetProcAddress, I'm confused Pin
Anders Molin23-Jan-07 11:52
professionalAnders Molin23-Jan-07 11:52 
GeneralRe: GetProcAddress, I'm confused Pin
Cedric Moonen23-Jan-07 20:17
Cedric Moonen23-Jan-07 20:17 
AnswerRe: GetProcAddress, I'm confused Pin
Michael Dunn23-Jan-07 12:17
sitebuilderMichael Dunn23-Jan-07 12:17 
QuestionTexture handling in DirectX Pin
spacecadet1023-Jan-07 11:13
spacecadet1023-Jan-07 11:13 
AnswerRe: Texture handling in DirectX Pin
Waldermort23-Jan-07 13:28
Waldermort23-Jan-07 13:28 
GeneralRe: Texture handling in DirectX Pin
spacecadet1026-Jan-07 2:29
spacecadet1026-Jan-07 2:29 
QuestionTrouble trapping keyboard messages Pin
marcmelillo23-Jan-07 10:33
marcmelillo23-Jan-07 10:33 
I'm am currently writing an application where a user tries to find his way in a maze. I want the user to be able to control his movements either by clicking on 3 buttons in the main window, or by using these 3 arrow keys: up, left, right. The 3 buttons are linked to the three functions: OnBgofront(), OnBturnleft() and OnBturnright() - those three functions manage the maze navigation. When the user wants to start the maze, he clicks the button labeled GO which is linked to the OnBgo() function.

My problem is that, after the GO button is clicked, if the user start by pressing one of the arrow keys instead of using one of the three buttons, nothing happens: no movement in the maze. On the other hand, if one of the 3 buttons is clicked, there is a movement in the maze, and then after that the arrow keys behave normally (ie the functions OnBgofront(), OnBturnleft() and OnBturnright() are called). Could you tell me how I could modify my code so that the user can use the arrow keys whithout having to press one of the 3 buttons first?

A BIG thank you in advance
Marc


oh! here is the OnBgo function code:

void MyAppDlg::OnBgo( )
{
        MSG tMsg;

        m_bRunning = true;
	:
	/* some code enabling the 3 movement buttons */
	:
	while ( m_bRunning )
	{
		:
		MyGrid.display (m_maze);
		:
		while ( ::PeekMessage(&tMsg, NULL, 0, 0, PM_REMOVE))
		{
			if (tMsg.message == WM_KEYUP)
			{
				switch ( tMsg.wParam )
				{
				case VK_UP:
					OnBgofront();
					break;

				case VK_LEFT:
					OnBturnleft();
					break;

				case VK_RIGHT:
					OnBturnright();
					break;

				case VK_ESCAPE:
					m_bRunning = false;
				}
			}
			else
			{
				::TranslateMessage(&tMsg);
				::DispatchMessage(&tMsg);
			}
		}
	}
}			


Marc Melillo
biomedical engineer
Universite de Montreal
marc.melillo@umontreal.ca
QuestionGetActivePane() no longer works in VC++ 2005 Pin
Ted94423-Jan-07 9:12
Ted94423-Jan-07 9:12 
AnswerRe: GetActivePane() no longer works in VC++ 2005 Pin
Mark Salsbery23-Jan-07 9:24
Mark Salsbery23-Jan-07 9:24 
GeneralRe: GetActivePane() no longer works in VC++ 2005 Pin
Ted94423-Jan-07 10:16
Ted94423-Jan-07 10:16 
GeneralRe: GetActivePane() no longer works in VC++ 2005 Pin
Mark Salsbery23-Jan-07 12:00
Mark Salsbery23-Jan-07 12:00 
GeneralRe: GetActivePane() no longer works in VC++ 2005 Pin
Ted94424-Jan-07 3:36
Ted94424-Jan-07 3:36 
GeneralRe: GetActivePane() no longer works in VC++ 2005 Pin
Mark Salsbery24-Jan-07 5:10
Mark Salsbery24-Jan-07 5:10 
QuestionVS 2005 MFC project and the Properties Window ? Pin
Jerry Evans23-Jan-07 8:47
Jerry Evans23-Jan-07 8:47 
AnswerRe: VS 2005 MFC project and the Properties Window ? Pin
BrianCharles23-Jan-07 9:39
BrianCharles23-Jan-07 9:39 
GeneralRe: VS 2005 MFC project and the Properties Window ? Pin
Jerry Evans23-Jan-07 11:43
Jerry Evans23-Jan-07 11:43 
QuestionExporting a class from a DLL Pin
Anders Molin23-Jan-07 8:27
professionalAnders Molin23-Jan-07 8:27 
AnswerRe: Exporting a class from a DLL Pin
Cedric Moonen23-Jan-07 8:33
Cedric Moonen23-Jan-07 8:33 
GeneralRe: Exporting a class from a DLL Pin
Anders Molin23-Jan-07 8:39
professionalAnders Molin23-Jan-07 8:39 
GeneralRe: Exporting a class from a DLL Pin
Cedric Moonen23-Jan-07 8:46
Cedric Moonen23-Jan-07 8:46 
GeneralRe: Exporting a class from a DLL Pin
Anders Molin23-Jan-07 8:53
professionalAnders Molin23-Jan-07 8:53 
GeneralRe: Exporting a class from a DLL Pin
James R. Twine23-Jan-07 8:51
James R. Twine23-Jan-07 8:51 
QuestionError in recordset retrieval Pin
namratab23-Jan-07 7:52
namratab23-Jan-07 7:52 
QuestionRe: Error in recordset retrieval Pin
David Crow23-Jan-07 8:04
David Crow23-Jan-07 8:04 

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.