Problems with DirectInput

Started by
3 comments, last by Melo 24 years, 7 months ago
Not sure if it's THE problem, but here's A problem: you're not acquiring the DirectInput device... you need to call Acquire() on it when your app gains focus, and Unacquire() when it loses focus (trap the WM_ACTIVATE message).

Mason McCuskey
Spin Studios
www.spin-studios.com

Founder, Cuttlefish Industries
The Cuttlefish Engine lets anyone develop great games for iPad, iPhone, Android, WP7, the web, and more!
Advertisement
also... you'll still get WM_MOUSEMOVE messages, even if DirectInput is working correctly. Just ignore 'em.

Mason McCuskey
Spin Studios
www.spin-studios.com

Founder, Cuttlefish Industries
The Cuttlefish Engine lets anyone develop great games for iPad, iPhone, Android, WP7, the web, and more!
Oh boy... how could i forget it.
Now i don't get the Win-MSG's, too. Thanx!
Hi there,

I'm working on a RTS-Game and have a problem with DirectInput.
I try to initialize it like this:

#define DIRECTINPUT_VERSION 0x0300
#include

BOOL InitDInputStuff (LPDIRECTINPUT* _lpDI,
LPDIRECTINPUTDEVICE* _lpDIDMouse,
LPDIRECTINPUTDEVICE* _lpDIDKeyboard)
{
if (FAILED (DirectInputCreate (hInstance, DIRECTINPUT_VERSION, _lpDI, NULL))) return FALSE;
if (FAILED ((*_lpDI)->CreateDevice (GUID_SysMouse, _lpDIDMouse, NULL))) return FALSE;
if (FAILED ((*_lpDIDMouse)->SetDataFormat (&c_dfDIMouse))) return FALSE;
if (FAILED ((*_lpDIDMouse)->SetCooperativeLevel (hwnd, DISCL_EXCLUSIVE | DISCL_FOREGROUND))) return FALSE;

//(Keyboard Stuff will be coded later)

return TRUE;
}

but I still get WM_MOUSEMOVEs etc. DI simply doesn't work but there are no
error-codes returned. To compile it I use WATCOM v11.
Where's the problem?

Don't make Windows-Stuph... In DOS w/ BASIC it is SOOO EASY:
while c$=""
c$=inkey$
wend

heheee...

This topic is closed to new replies.

Advertisement