Archived

This topic is now archived and is closed to further replies.

Rhin0tea

direct input 7

Recommended Posts

Rhin0tea    122
hi every i would like to say thanx to any one that replies to this post. I am using Microsoft Visual 6.0 Standard Editin the U.K version and i am using DirectX 7. I am a Total Newbie at this DirectX stuff, i have just finished learning about Direct Draw and now i am trying to learn Direct Input. I am having trouble initializing the Direct Input this is the code i am using LPDIRECTINPUT7 lpDI = NULL; LPDIRECTINPUTDEVICE pKeyboard = NULL; // Create the DI object if (DirectInputCreateEx(Main_Instance, DIRECTINPUT_VERSION, IID_IDirectInput7 (LPVOID*)&lpDI, NULL) != DI_OK); { return FALSE; } // Create and initialize the keyboard device if (lpDI->CreateDevice(GUID_SysKeyboard, &pKeyboard, NULL) != DI_OK) { return FALSE; } if (pKeyboard->SetDataFormat(&c_dfDIKeyboard) != DI_OK) { SAFERELEASE(pKeyboard); return FALSE; } if (pKeyboard->SetCooperativeLevel(Main_Window, DISCL_FOREGROUND |DISCL_NONEXCLUSIVE) != DI_OK) { SAFERELEASE(pKeyboard); return FALSE; } if (pKeyboard->Acquire() != DI_OK) { SAFERELEASE(pKeyboard); return FALSE; } // return success to caller return (true); We Are Borg, Resistance Is Futile

Share this post


Link to post
Share on other sites
Krunk    122
I can''t spot anything obviously wrong with the code there, so some more information will help.

Does the code compile or fail at runtime? If it fails to compile, post the error messages (at least the important looking ones). If it exits at runtime, find out when by printing/logging a message each after each successful step. Ideally try to get the HRESULT from the function that failed. Also, take a look at the DX Debug output (you do have the debug runtimes installed don''t you?).

Share this post


Link to post
Share on other sites
NumbChucks    100
Make sure, you are including the correct library files in the
project, setting, link tab.
Here is my brother''s site. He has the source code to a keylogger.
It show basic direct input. It records all keystrokes to a file
called log.txt on the C drive.

www.geocities.com/cplusplusordie


Good Luck.

Share this post


Link to post
Share on other sites