Jump to content

  • Log In with Google      Sign In   
  • Create Account


Problems with DirectInput


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Melo   Members   -  Reputation: 122

Like
Likes
Like

Posted 17 September 1999 - 11:02 AM

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?


Sponsor:

#2 mason   Members   -  Reputation: 128

Like
Likes
Like

Posted 09 September 1999 - 07:17 AM

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


#3 mason   Members   -  Reputation: 128

Like
Likes
Like

Posted 09 September 1999 - 07:19 AM

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


#4 Melo   Members   -  Reputation: 122

Like
Likes
Like

Posted 10 September 1999 - 02:13 AM

Oh boy... how could i forget it.
Now i don't get the Win-MSG's, too. Thanx!

#5 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 17 September 1999 - 11:02 AM

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

heheee...





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS