Software Archive
Read-only legacy content
17061 Discussions

Dialog in DLL Subroutine

Intel_C_Intel
Employee
658 Views
Hopefully this is a simple question but probably not.

I have a visual basic program calling a fortran dll to do some simulation. The fortran program takes some time to compute so I have added a progress bar in a resource file. The dll compiles fine but I can't get the dialog to initialize or show. Looking in the documentation it says I need to use the
DLGINITWITHRESOURCE command instead of the DLGINIT since the dialog is in the dll. Visual basic calls right into the dll subroutine and passes about 30 characters, integers and real numbers. They pass okay back and forth. DLGINITWITH RESOURCE needs a module instance handler which it says is given to DLLMAIN when the dll is called, except my visual basic program entries into the subroutine directly (TSSFOR) since it is passing numerous data. All of the initialization commands return zero so they are not successful and the program crashes on the DLGMODELESS command saying that the program is trying to reference memory which cannot be read.

How do I get the module instance handler and am I on the right track that I need it?
0 Kudos
3 Replies
Jugoslav_Dujic
Valued Contributor II
658 Views
You can get hInstance using DFWIN function GetModuleFileName("mydll.dll"C). Note that this would fail if a) someone renames your dll or b) possibly if there are multiple instances of different dlls with the same name loaded. However, for practical reasons I think this would suffice.

Jugoslav
0 Kudos
Jugoslav_Dujic
Valued Contributor II
658 Views
Apologies for the typo, that should be GetModuleHandle -- GetModuleFileName does the reverse thing.
0 Kudos
Intel_C_Intel
Employee
658 Views
Graham,

An additional suggestion. You should check out the CVF dllprgrs sample in ..Microsoft Visual StudioDF98SAMPLESDIALOGDLLPRGRS. The description of this sample reads The dllprgrs sample demonstrates using the Visual Fortran Dialog Procedures in a DLL. (with a progress bar no less)

hth,
JT
0 Kudos
Reply