direct input 7

Started by
1 comment, last by Rhin0tea 21 years, 2 months ago
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
We Are Borg, Resistance Is Futile
Advertisement
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?).
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.
There is a new song that goes a little something like this....He was a skater boy, she said masterbater boy.He wasn't good enough to bang.

This topic is closed to new replies.

Advertisement