Click here to Skip to main content
15,914,165 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: What's wrong with my code? (class template) Pin
Vivek Rajan6-Jun-01 20:00
Vivek Rajan6-Jun-01 20:00 
GeneralRe: What's wrong with my code? (class template) Pin
Li Lirong6-Jun-01 21:02
Li Lirong6-Jun-01 21:02 
GeneralRe: What's wrong with my code? (class template) Pin
7-Jun-01 4:23
suss7-Jun-01 4:23 
GeneralRe: What's wrong with my code? (class template) Pin
Ghazi H. Wadi7-Jun-01 14:36
Ghazi H. Wadi7-Jun-01 14:36 
GeneralRe: What's wrong with my code? (class template) Pin
Li Lirong7-Jun-01 17:09
Li Lirong7-Jun-01 17:09 
GeneralRe: What's wrong with my code? (class template) Pin
Jim Crafton7-Jun-01 18:57
Jim Crafton7-Jun-01 18:57 
GeneralScrolling the content Pin
Mangesh Sardesai6-Jun-01 18:55
Mangesh Sardesai6-Jun-01 18:55 
GeneralJoystick / Gamepad Pin
6-Jun-01 16:50
suss6-Jun-01 16:50 
I am trying to use the joystick via joySetCapture as so:

joySetCapture(m_hWnd, JOYSTICKID1, 100, TRUE);

My problem is that this method polls every x milliseconds (100 in this case) so in the MM_JOY1MOVE case (when you use the directional pad) it sometimes misses the fact that you pressed a direction. For instance if you press the UP direction too quick it might not catch it, or if you press it ever so slightly too long it can count as two presses.

What I am looking for is a way to have the joystick/gamepad notify me when a button is pressed so that I don't have to use this polling method. Like a joystick hook or something of the sort. Any ideas?

Here is some of my code for clarity on what I am currently doing:

BOOL CGamepadDlg::PreTranslateMessage(MSG* pMsg) {
	switch (pMsg->message) {
		case MM_JOY1BUTTONDOWN:
			if (pMsg->wParam & JOY_BUTTON1) {
				TRACE("BUTTON 1 DOWN\n");
			} else if (pMsg->wParam & JOY_BUTTON2) {
				TRACE("BUTTON 2 DOWN\n");
			} else if (pMsg->wParam & JOY_BUTTON3) {
				TRACE("BUTTON 3 DOWN\n");
			} else if (pMsg->wParam & JOY_BUTTON4) {
				TRACE("BUTTON 4 DOWN\n");
			}
			break;
		case MM_JOY1MOVE:
			if (LOWORD(pMsg->lParam) > 41000) {
				TRACE("RIGHT\n");
			} else if (LOWORD(pMsg->lParam) < 11000) {
				TRACE("LEFT\n");
			} else if (HIWORD(pMsg->lParam) > 41000) {
				TRACE("DOWN\n");
			} else if (HIWORD(pMsg->lParam) < 11000) {
				TRACE("UP\n");
			}
			break;
		case WM_DESTROY:
			joyReleaseCapture(JOYSTICKID1);
			break;
	}
	return CDialog::PreTranslateMessage(pMsg);
}

GeneralRe: Joystick / Gamepad Pin
Christian Graus6-Jun-01 16:56
protectorChristian Graus6-Jun-01 16:56 
GeneralRe: Joystick / Gamepad Pin
7-Jun-01 10:36
suss7-Jun-01 10:36 
GeneralPut Enter character !!! Pin
Hadi Rezaee6-Jun-01 16:40
Hadi Rezaee6-Jun-01 16:40 
GeneralRe: Put Enter character !!! Pin
Christian Graus6-Jun-01 16:57
protectorChristian Graus6-Jun-01 16:57 
GeneralRe: Really? Pin
Masaaki Onishi6-Jun-01 17:15
Masaaki Onishi6-Jun-01 17:15 
GeneralRe: Really? Pin
Christian Graus6-Jun-01 17:43
protectorChristian Graus6-Jun-01 17:43 
GeneralRe: Put Enter character !!! Pin
Vivek Rajan6-Jun-01 20:13
Vivek Rajan6-Jun-01 20:13 
Generalinsert bitmap in a MDI child window Pin
Pou6-Jun-01 15:58
Pou6-Jun-01 15:58 
GeneralRe: insert bitmap in a MDI child window Pin
Christian Graus6-Jun-01 16:22
protectorChristian Graus6-Jun-01 16:22 
GeneralRe: insert bitmap in a MDI child window Pin
Tomasz Sowinski6-Jun-01 23:42
Tomasz Sowinski6-Jun-01 23:42 
Generala bitmap to click in a MDI child window Pin
Pou6-Jun-01 15:57
Pou6-Jun-01 15:57 
GeneralRe: a bitmap to click in a MDI child window Pin
Christian Graus6-Jun-01 16:23
protectorChristian Graus6-Jun-01 16:23 
Generalcd rom drive letter Pin
Pou6-Jun-01 15:54
Pou6-Jun-01 15:54 
GeneralReally Silly Question I Think Pin
William Bartholomew6-Jun-01 14:33
William Bartholomew6-Jun-01 14:33 
GeneralRe: Really Silly Question I Think Pin
Christian Graus6-Jun-01 14:50
protectorChristian Graus6-Jun-01 14:50 
GeneralRe: Really Silly Question I Think Pin
Vivek Rajan6-Jun-01 15:37
Vivek Rajan6-Jun-01 15:37 
GeneralRe: Really Silly Question I Think Pin
Vivek Rajan6-Jun-01 15:42
Vivek Rajan6-Jun-01 15:42 

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.