Direct Music Illegal Static Member Call error

This is a discussion on Direct Music Illegal Static Member Call error within the Game Programming forums, part of the General Programming Boards category; Hmmm I am still ining Direct Music. I am a first timer so please bare with me. Still leag Direct ...

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    19

    Direct Music Illegal Static Member Call error

    Hmmm I am still ining Direct Music. I am a first timer so please bare with me. Still leag Direct X with C++.

    I said

    IDirectMusicPerformance::Init (&DMusic,NULL,hwnd);

    And I get an Illegal Static Member Call for the thrid argument, the HWND argument. What do I need to do to fix this? I tried setting it to NULL cause it doesn't really matter what window I give Direct Music control of because I am writing this as a Dos program. Or am I wrong? Thanks!
    May GOD Bless, Strengthen, Guide, and Protect you Always!

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Why don't you trap the error message and let us know what it is. Should be one of the following:

    DMUS_E_ALREADY_INITED
    E_OUTOFMEMORY
    E_POINTER

  3. #3
    Registered User
    Join Date
    Nov 2002
    Posts
    19
    The only error message I am getting is

    c:\Documents and Settings\Owner\My Documents\Visual Studio Projects\CSound\Main.cpp(30): error C2352: 'IDirectMusicPerformance::Init' : illegal call of non-static member function


    Any help?
    May GOD Bless, Strengthen, Guide, and Protect you Always!

  4. #4
    moi
    moi is offline
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    argh, never mind. (too early in morning)
    Last edited by moi; 11-30-2002 at 08:51 AM.
    hello, internet!

  5. #5
    Programming Sex-God Polymorphic OOP's Avatar
    Join Date
    Nov 2002
    Posts
    1,078

    Re: Direct Music Illegal Static Member Call error

    Originally posted by FwyWice
    Hmmm I am still ining Direct Music. I am a first timer so please bare with me. Still leag Direct X with C++.

    I said

    IDirectMusicPerformance::Init (&DMusic,NULL,hwnd);
    You're getting an illegal static member function call compile-time error because you are calling the member function "Init" as if it were a static member function, which it is not. "Init" has to be associated with an object. So, you have to create a DirectMusic Performance and use the dot/arrow for accessing it.

    Originally posted by FwyWice
    And I get an Illegal Static Member Call for the thrid argument, the HWND argument
    You're not getting an "Illegal Static Member Call" for the thrid argument, you're getting it for the function itself. The value of the parameter you pass will never ever create a compile-time error, only the datatype of it will. Illegal Statice Member Call means that you didn't associate the function "Init" with a DirectMusic Performance, as I said earlier.

    Originally posted by FwyWice
    I tried setting it to NULL cause it doesn't really matter what window I give Direct Music control of because I am writing this as a Dos program.
    You can not use DirectX in a DOS environment -- You need to associate objects such as Performances with a window via a window handle.

    You could legally pass NULL as the 3rd argument and it will use the current foreground window of the application, and that might even work in a DOS application when run in windows, but I wouldn't suggest doing it. DirectX will only work in windows, so it's pointless to make it a DOS application. If, you are using a win32 console application (which I'm guesing you are and are just calling it a DOS application), then you will likely be able to get it to work by passing NULL as the third argument, but still, a straight-up Win32 Application is best.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 02:01 AM
  2. Errors including <windows.h>
    By jw232 in forum Windows Programming
    Replies: 4
    Last Post: 07-29-2008, 02:29 PM
  3. error: template with C linkage
    By michaels-r in forum C++ Programming
    Replies: 3
    Last Post: 05-17-2006, 09:11 AM
  4. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 10:33 AM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 07:39 AM

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