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.

FS Module - Menu and Window inside FS

Featured Replies

Hi there folks!I would like to receive some help on making DLLs for FS9, usingC, not only to allow FS to load the DLL, but to:- insert a menu at fsmenu- show a window inside fs9Any "tutorial" material or C code will be very helpful.Thanks in advance!

Hi flouid.Based on Cyril's fsmenu code:

#include <windows.h>#include "gauges.h"/* This is the module's import table.	*/	GAUGESIMPORT	ImportTable =				{						{ 0x00000000, (PPANELS)NULL },			{ 0x00000000, NULL }				};					void FSAPI module_init(void) {}void FSAPI module_deinit(void) {}/* This is the module's export table.	*/	GAUGESLINKAGE	Linkage =				{						0x00000000,					module_init,					module_deinit,					0,						0,						GAUGE_HEADER_VERSION_FS900, {0}	};// The standard window procedure used by the flight simulatorWNDPROC oldWndProc;// Flight simulator main window handleHWND hFSimWindow;#define	MENU_ENTRY	"My Mo&dule"#define	ID_MY_MENUITEM	40001/** * Main window procedure that is called by the flight simulator to process * incoming window messages. */LRESULT CALLBACK FSimWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){	switch (uMsg) {		case WM_NCPAINT:			{				HMENU hMenu, hMyMenu;				hMenu = GetMenu(hwnd);				if (hMenu != NULL) {					int i;					// Look for our menu entry in the main menu.					for (i = 0; i < GetMenuItemCount(hMenu); i++) {						char buf[128];						GetMenuString(hMenu, i, buf, 128, MF_BYPOSITION);						if (strcmp(buf, MENU_ENTRY) == 0) {							// It is already here, we do not need to add it again							break;						}					}					if (i < GetMenuItemCount(hMenu)) {						// It is already here, we do not need to add it again						break;					}					/* Create new menu. NOTE: It seems that this will be					 * reached more times, so we cannot save the handle, because					 * in such case it could be destroyed and we will not have					 * any access to it in the simulator.					 */					hMyMenu = CreateMenu();					AppendMenu(hMyMenu, MF_STRING | MF_ENABLED, ID_MY_MENUITEM, "My &First Menu Entry");					// add the created menu to the main menu					AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT_PTR)hMyMenu, MENU_ENTRY);				}			}			break;		case WM_COMMAND:			if (LOWORD(wParam) == ID_MY_MENUITEM) {				// Add your code here				MessageBox(hwnd, "It works!", "HURA", MB_OK | MB_ICONEXCLAMATION);				return 0;			}			break;	}	// Call the original window procedure to handle all other messages	return CallWindowProc(oldWndProc, hwnd, uMsg, wParam, lParam);}/** * Entry point of the DLL. */BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved){	switch (fdwReason) {		case DLL_PROCESS_ATTACH:			hFSimWindow = FindWindow("FS98MAIN", NULL);			oldWndProc = (WNDPROC)SetWindowLong(hFSimWindow, GWL_WNDPROC, (LONG)FSimWindowProc);			break;	}	return TRUE;}

This module uses only "windows.h" and the SDK's "gauges.h" for includes. I compiled this as a DLL, with the Visual C++ Express Edition beta, and it works as indicated. Cyril uses a "modules.h" for his code, but it is not needed in the above example. I converted this to use "gauges.h" because Module DLLs are basically a gauge, and I wanted to show this. By using gauges.h, many variables would now be available for the module, without needing to use an IPC ( such as FSUIPC ).============================================Another source of module info can be found at:http://www.flightdecksoftware.com/downloads.phpThe "cvs" download can get you the code for their FDSConnection.dll... an ipc to the flight simulator. I used that code as a basis to compile a CFS2 version of FDSConnection... without problem.Dick

Hi Dick!Thanks for the reply. :-)I

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.