See site in english Voir le site en francais
Website skin:
home  download  forum  link  contact

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

Author Topic: Trouble compiling OrbiterSound3 code  (Read 2246 times)

0 Members and 1 Guest are viewing this topic.

Offline spaceranger

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
17 January 2007, 23:45:57
Hi folks, new coder here.  I'm trying to update an MFD addon to user Orbiter Sound version 3.  It's someone else's source
code and I haven't received permission to share it, so here's just the snippet where I'm seeing a problem.

I'm using VC2005 Express on WinXP.

Here's the error:
Quote
error C3861: 'GetHandle': identifier not found
I'm not sure I'm placing this code in the right place.

This is the main code segment with the problem, the line with the error I'm receiving is below in bold.

Quote
class InfoMFD::InfoMFD (DWORD w, DWORD h, VESSEL2 *vessel)
: MFD (w, h, vessel)
{
      MyID=ConnectToOrbiterSoundDLL3(GetHandle());
      RequestLoadVesselWave3(MyID,DING,"Sound\\ding.wav",INTERNAL_ONLY);
      RequestLoadVesselWave3(MyID,MYDING,"Sound\\dingdong.wav",INTERNAL_ONLY);
      RequestLoadVesselWave3(MyID,HORROR,"Sound\\horror.wav",INTERNAL_ONLY);
}
Here's the relevant header file section:

Quote
#ifndef __HEADERFILE_H
#define __HEADERFILE_H

class InfoMFD: public MFD {
      void clbkPostCreation(void);
      int MyID;

public:
   InfoMFD (DWORD w, DWORD h, VESSEL2 *vessel);
   ~InfoMFD ();
   bool ConsumeKeyBuffered (DWORD key);

   //-----------------sounds-------------------------------------------------------------
   #define DING               1
   #define MYDING               2
   #define HORROR               3
   //------------------------------------------------------------------------------------

   void Update (HDC hDC);
   static int MsgProc (UINT msg, UINT mfd, WPARAM wparam, LPARAM lparam);

private:
   void ShowColors(const HDC hDC, const int y, const char *name, const COLORREF c1, const COLORREF c2, const COLORREF c3);
};

#endif

Any suggestions?  Thanks in advance!



Offline spaceranger

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Reply #1 - 18 January 2007, 21:30:41
There seems to be a number of views on this post but no comments, so I'm merely curious ...  Is there some further
clarification I can provide here?  Can anyone comment of whether this code appears fine and the problem is hard to see, or if
I just missed something obvious regarding implementing this in an MFD vs. a vessel .dll?  i.e. Have I placed the Orbiter
Sound code within the appropriate section (the class section)?

Thanks!



Post Edited ( 01-18-07 21:31 )


Offline EtherDragon

  • Jr. Member
  • **
  • Posts: 44
  • Karma: 0
Reply #2 - 19 January 2007, 03:14:18
I think you're suffering from a lack of knowledge on our parts. I don't have any advice. Maybe Dan can have a look
when he's feeling better?


« Last Edit: 19 January 2007, 04:19:10 by EtherDragon »
~EtherDragon

Offline spaceranger

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Reply #3 - 19 January 2007, 03:32:10
Quote
EtherDragon wrote:
I think you're suffering from a lack of knowledge on our parts. I don't have any advice. Maybe Dan can have a look
when he's feeling better?


Ah!  Well, gosh, get better Dan and no worries!

« Last Edit: 19 January 2007, 04:19:10 by spaceranger »

Offline spaceranger

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Reply #4 - 19 January 2007, 04:19:10
Ok, I got past this via a suggestion from computerex on the Orbiter forums, to wit:

Quote
Your bug is here:

Code:
MyID=ConnectToOrbiterSoundDLL3(GetHandle());


GetHandle() is a method of the VESSEL class, not an MFD class, therefore you can't use it like this.
This should work:
Code:
MyID=ConnectToOrbiterSoundDLL3(oapiGetFocusObject());



Another alternative:
MyID=ConnectToOrbiterSoundDLL3(oapiGetObjectByName(NAME));

or

MyID=ConnectToOrbiterSoundDLL3(oapiGetVesselByIndex(inx));

The first suggestion (MyID=ConnectToOrbiterSoundDLL3(oapiGetFocusObject())) appeared to work for me.

Now I'm just running into alleged dependencies upon libc.lib and libci.lib .. I think ...

« Last Edit: 19 January 2007, 04:19:10 by spaceranger »