Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Creating Gauges using Borland C++Builder

Featured Replies

Has anyone experience of creating gauges using Borland C++Builder. I have Version 4 Professional?Alternatively, can anyone direct me me to a website with any information/advice about this?I've written in C and C++ for a few years but find the MS SDK and the program structure confusing to put it mildly. For example the main entry pointBOOL WINAPI DllMain (HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved)seems to be hidden away in the definition of GAUGE_TABLE_BEGIN() in gauges.h.

Gerry Howard

  • Author

I've made some progress. I've compiled the SDK fuel gauge but it's now incompatible with FS9 so I still need advice :(Borland C++Builder permits building a .dll file but requires that it has the main DLL entry point in it, else it can't be saved. I therefore edited gauges.h to remove the following lines from the GAUGE_TABLE_BEGIN macro and put them in the main DLL code:extern GAUGEHDR gauge_header;void FSAPI module_init(void){}void FSAPI module_deinit(void){}BOOL WINAPI DllMain (HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved){ return TRUE;}I followed them immediately with the GAUGE_TABLE_BEGIN macro.I decided to work with only the fuel gauge to keep things simple(!)so edited the SDK.c, SDK.h, and SDK.rc files to remove all references to other gauges.My main DLL code became://-------------------------------------------------------------------// Microsoft Flight Simulator 2004 - Gauge Compiler for C++Builder4//-------------------------------------------------------------------// Includes#include #include #pragma hdrstop//-------------------------------------------------------------------// SDK.c "includes" gauges.h, SDK.h, and SDK.Fuel.c //-------------------------------------------------------------------#include "SDK.c"//-------------------------------------------------------------------// Resource FileUSERC("SDK.rc");//-------------------------------------------------------------------// Definitions removed from gauges.h//-------------------------------------------------------------------extern GAUGEHDR gauge_header;void FSAPI module_init(void){}void FSAPI module_deinit(void){}//-------------------------------------------------------------------// Main entry point removed from gauges.h//-------------------------------------------------------------------BOOL WINAPI DllEntryPoint(HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved){return TRUE;}//-------------------------------------------------------------------// Gauge table //-------------------------------------------------------------------GAUGE_TABLE_BEGIN()GAUGE_TABLE_ENTRY(&gaugehdr_fuel)GAUGE_TABLE_END()//-------------------------------------------------------------------This compiles to to a .dll file. This is 141kb which is a similar size to existing fuel gauge (.gau) files. I'd set the version information in SDK.rc and this appears in the compiled .dllI renamed it as a .gau file, put it in the FS gauges folder, added a reference to it an a panel.cfg file put got a message that it was incompatible when loading the aircraft.What am I doing wrong? All help gratefully received!

Gerry Howard

I tried this and it works OK (I'm using Microsoft C):/*/////////////////////////////////////////////////////////////////////////////// Gauge table entries/////////////////////////////////////////////////////////////////////////////GAUGE_TABLE_BEGIN() GAUGE_TABLE_ENTRY(&gaugehdr_attitude) GAUGE_TABLE_ENTRY(&gaugehdr_control_surfaces) GAUGE_TABLE_ENTRY(&gaugehdr_fuel) GAUGE_TABLE_ENTRY(&gaugehdr_fuel_selector) GAUGE_TABLE_ENTRY(&gaugehdr_temperature) GAUGE_TABLE_ENTRY(&gaugehdr_wiskey) GAUGE_TABLE_ENTRY(&gaugehdr_flightmap)GAUGE_TABLE_END()*/void FSAPI module_init(void){} void FSAPI module_deinit(void){} BOOL WINAPI DllMain (HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved) { return TRUE;}GAUGESIMPORT ImportTable = { { 0x0000000F, (PPANELS)NULL }, { 0x00000000, NULL } };GAUGESLINKAGE Linkage ={ 0x00000013, module_init, module_deinit, 0, 0, FS9LINK_VERSION, { (&gaugehdr_attitude), (&gaugehdr_control_surfaces), (&gaugehdr_fuel), (&gaugehdr_fuel_selector), (&gaugehdr_temperature), (&gaugehdr_wiskey), (&gaugehdr_flightmap), 0 }};All I've done here is comment out the GAUGE_TABLE macro, and substitute the code the macro contains.Doug

  • Author

Thanks. I'll try that and report back.

Gerry Howard

  • Author

No luck. I get, as before, an apparently valid .dll file that FS doesn't like :(There are no error messages, all the version information is there, the size seems OK but......I need help!

Gerry Howard

Are you using the stock GAUGES.H file, or the one modified by Arne Bartels and Dai Griffiths? I believe some of the mods Arne and Dai have done are to ensure compatibility with GCC and BCC. If you are using the stock file, you might try the attached.Doug

  • Author

Thanks. I've been using the stock gauges.h file. I'll try the one you suggest.

Gerry Howard

  • Author

I tried it but no success. FS9 still won't recognise my gauge.I checked the first word in my gauge file and against an MS gauge - they are identical at 4D 5A. This is the same as a normal dll so the signature seems OK.I'm running out of ideas. Anyone know what FS checks for in a gauge?

Gerry Howard

  • Author

Success :)I finally got my gauge to work by changing the Borland C++Builder Project Options from the default ones - mainly by omitting debug information. For the record, the changes were:Advanced Compiler:- No Autodependency output- No Generate Underscores- Standard Call (not C)Compiler:- No Debug Information- No Line Number Information- No Disable Inline Expansions- No Stack FramesLinker- No Generate Debug Information- No Use Debug Libraries- No Generate Import Library I'm not certain that all of them are necessary but that combination gives a valid dll/gau file.

Gerry Howard

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.