- Messages
- 158
- Country

Hi folks,
I've got a need to know the folder my current airplane lives in. As usual, FSDeveloper had the answer, a block of code posted by the ever-helpful Bill Leaming (where would we be without him?)
But -- there's a variable in there that I need called dll_instance. I presume this is the HINSTANCE of the gauge DLL. Where do I get that? I've poked about in the gauges.h and with google, to no avail so far.
Thanks!
Dutch
I've got a need to know the folder my current airplane lives in. As usual, FSDeveloper had the answer, a block of code posted by the ever-helpful Bill Leaming (where would we be without him?)
But -- there's a variable in there that I need called dll_instance. I presume this is the HINSTANCE of the gauge DLL. Where do I get that? I've poked about in the gauges.h and with google, to no avail so far.
Thanks!
Dutch
Code:
#include "fs9gauges.h"
#include <io.h>
#include <stdio.h>
#define MAX_SECTIONS 512
EXTERN_C BOOL FindAircraft();
BOOL FindAircraft()
{
char aircraftpath[MAX_PATH+1] = "",
searchpath[MAX_PATH+1] = "",
cfgname[MAX_PATH+1] = "",
*helper = NULL;
BOOL result = FALSE;
// dll_instance is the hInstance value of the DLL.
GetModuleFileNameA(dll_instance,aircraftpath,MAX_PATH);
// have the path to this gauge... delete the gauge name and the "\Panel" from it.
if((helper=strrchr(aircraftpath,'\\'))!=NULL)
*helper='\0';
if((helper=strrchr(aircraftpath,'\\'))!=NULL)
*helper='\0';
// now, add '\aircraft.cfg' to it.
strcat(aircraftpath,"\\aircraft.cfg");
// it's all set for use.
// do your .ini reads here
//
result = TRUE;
return result;
}
