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!
Re: Direct Music Illegal Static Member Call error
Quote:
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.
Quote:
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.
Quote:
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.