Well, i dont know the Delphi language, as a result i cannt give you a source
code sample of the module. But for let the Flight simulator to read your
*.dll, you need to define two structures type:
MODULE_IMPORT and MODULE_LINKAGE
inside the MODULE_IMPORT, there must be two structures:
IMPORTSentry and nullentry
A) inside the IMPORTSentry structure, there must be two members:
1) a variable called "fnID" as "LONG" type
2) a pointer called "fnptr" as a pointer to any kind of data in memory
(void*)
B) inside the the nullentry structure, there must be two members:
1) a variable called "fnID" as "LONG" type
2) a pointer called "fnptr" as a pointer to any kind of data in memory
(void*)
inside the MODULE_LINKAGE, there must be 7 members:
A) a variable called "ModuleID" as "LONG" type
B) a pointer to a subroutine (with a _stdcall convention) called
"ModuleInit", that doesnt needs any parameter
C) a pointer to a subroutine (with a _stdcall convention) called
"ModuleDeinit", that doesnt needs any parameter
D) a variable called "ModuleFlags" as "UNSIGNED LONG" type
E) a variable called "ModulePriority" as "UNSIGNED LONG" type
F) a variable called "ModuleVersion" as "UNSIGNED LONG" type
G) a pointer called "ModuleTable" as a pointer to any kind of data in memory
(void*)
NOW after that, you need to add two subroutines (using the _stdcall
convention) in your main source code file, those subroutines must have the
names: "module_init" and the other "module_deinit", each one doesnt returns
obviously any value (so they are subroutines), and also both doesnt needs
any parameters to be passed to them.
in C language they are like:
void _stdcall module_init(void) {}
void _stdcall module_deinit(void) {}
NOW after adding those subroutines, you need to export two variables, and at
same time define theirs values:
1) one of them called "ImportTable" as "MODULE_IMPORT" type
this one must have the following values in each structure:
IMPORTSentry
---> fnID = 0
---> fnptr = 0 // NULL
nullentry
---> fnID = 0
---> fnptr = 0 // NULL
2) the another one called "Linkage" as "MODULE_LINKAGE" type
this one must have the following values for each member:
ModuleID = 0
module_init // (this is the subroutine we added before)
module_deinit // (this is the other subroutine)
ModuleFlags = 0
ModulePriority = 0
ModuleVersion = 0x0900 // FS2004 version (use 0x0800 for FS2002)
ModuleTable = 0 // NULL
NOW, you are DONE!, that's will allow the Flight Simulator to load your
module (*.dll), when the Flight Simulator loads your module (REMMEMBER, YOUR
MODULE'S ENTRY POINT FUNCTION...in C language it is commonly called
"DllMain"), you MUST hook your module to the main Flight Simulator's window
procedure, the classname of the main window is "FS98MAIN", find that window,
then using the "SetWindowLong" function define a new window procedure and
retrieve the
HANDLE of the original FLIGHT SIMULATOR'S window procedure,
that should let you intercept the Flight Simulator's main window's message,
so then you can process each message before the Flight Simulator itself,
then AFTER YOUR NEW WINDOW PROCEDURE FUNCTION receives and process the
message, YOU MUST REDIRECT the window messages to the ORIGINAL FLIGHT
SIMULATOR's window procedure use the function "CallWindowProc"
Well, that's all i can do for you to help, i cannt do beyond this, because i
dont know the syntaxis and the rules of the Delphi language.