Error initializing DirectInput Object!

This is a discussion on Error initializing DirectInput Object! within the Game Programming forums, part of the General Programming Boards category; When I use this code for DInput: hr= (DirectInput8Create(0, DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&lpdi, NULL)); if(FAILED(hr)) { MessageBox(hWnd, "Error initializing DirectInput8 Keyboard ...

  1. #1
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Question Error initializing DirectInput Object!

    When I use this code for DInput:

    hr= (DirectInput8Create(0, DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&lpdi, NULL));

    if(FAILED(hr))
    {
    MessageBox(hWnd, "Error initializing DirectInput8 Keyboard Object!", 0, 0);

    exit(1);
    }


    It pops up the Error Message when I run it. Are there any files I need?
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: trifaze_mattu@lycos.com

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  2. #2
    Registered User Coder's Avatar
    Join Date
    Aug 2001
    Location
    Cairo, Egypt
    Posts
    128
    Code:
    hr= (DirectInput8Create(0, DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&lpdi, NULL));
    
    if(FAILED(hr))
    {
    MessageBox(hWnd, "Error initializing DirectInput8 Keyboard Object!", 0, 0);
    
    exit(1);
    }
    Try
    Code:
    hr = DirectInput8Create( GetModuleHandle( 0 ), DIRECTINPUT_VERSION,IID_IDirectInput8,(void**)&lpdi,NULL);
    Generally, when anything DX fails, use the functions DXGetErrorString8( HRESULT ) & DXGetErrorDescription8( HRESULT ) which function exactly as their name says.
    Muhammad Haggag

  3. #3
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    DXGetErrorString8?

    It says:

    implicit declaration of int DXGetErrorString8(...);
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: trifaze_mattu@lycos.com

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  4. #4
    Registered User Coder's Avatar
    Join Date
    Aug 2001
    Location
    Cairo, Egypt
    Posts
    128
    What have you done exactly?
    It seems that you've tried to declare DXGetErrorString8 inside a function ( instead of calling it ).

    Do you have DX8.1?
    Post the code that caused that error, & the actual compiler message ( pointing out the line that caused the error )
    Muhammad Haggag

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. using this as synchronization object
    By George2 in forum C# Programming
    Replies: 0
    Last Post: 03-22-2008, 07:49 AM
  2. circular doubly linked list help
    By gunnerz in forum C++ Programming
    Replies: 5
    Last Post: 04-28-2007, 08:38 PM
  3. Replies: 60
    Last Post: 12-20-2005, 10:36 PM
  4. Question on l-values.
    By Hulag in forum C++ Programming
    Replies: 6
    Last Post: 10-13-2005, 04:33 PM
  5. A question about constructors...
    By Wolve in forum C++ Programming
    Replies: 9
    Last Post: 05-04-2005, 04:24 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21