Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.

Using DLL in MDI project

moncef
Beginner
686 Views

Iam using CVF to built an MDI project and I have a problem to call a Dialog Box written in a DLL wich is a subproject of the main project.

The source code of the DLL called BurnersClass.dll is :

integer*4 function ComponentBurner(BurnerTyp,GlobalIcon)

!DEC$ ATTRIBUTES STDCALL, REFERENCE,ALIAS :"ComponentBurner":: ComponentBurner

!DEC$ ATTRIBUTES DLLEXPORT::ComponentBurner

include 'resource.fd'

integer BurnerTyp

integer GlobalIcon

BurnerMenu%handle=CreateDialogParam(HandleAndInstance%ghInstance,IDD_Component_Tab, &

MDI_WINDOW_Current%Handle, loc(BurnerTab),0)

.......

ComponentBurner=0

return

end function ComponentBurner

!======================================================!

integer*4 function BurnerTab( hDlg,message,uParam,lParam )

!DEC$ ATTRIBUTES STDCALL, REFERENCE,ALIAS :"BurnerTab":: BurnerTab

!DEC$ ATTRIBUTES DLLEXPORT::BurnerTab

use user32

use kernel32

implicit none

include "Resource.fd"

integer hDlg

integer message

integer uparam,lparam

type (T_NMHDR) itabmessage

select case(message)

case( WM_INITDIALOG)

....

BurnerTab=1

return

case (WM_COMMAND)

select case (LOWORD(uParam))

case (IDOK,ID_ESCAPE)

....

end select

case(WM_move)

....

....

return

end select

BurnerTab=0

return

end function BurnerTab

The source code of the main program part that used this dll is :

integer*4 function BurnersPreprocessing(BurnerTyp)

!DEC$ IF DEFINED(_X86_)

!DEC$ ATTRIBUTES STDcall, ALIAS : '_BurnersPreprocessing@16' :: BurnersPreprocessing

!DEC$ ELSE

!DEC$ ATTRIBUTES STDcall, ALIAS : 'BurnersPreprocessing' :: BurnersPreprocessing

!DEC$ ENDIF

use user32

use kernel32

use comctl32

use DFWIN

use THESSGlobals

use HeatLibDrawingVar

use MDI_WindowsVar

use FuelClass

implicit none

include 'resource.fd'

integer iret

integer BurnerTyp

logical bret

integer(HANDLE) dll_handle(2)

integer(BOOL) free_status

pointer(p_ComponentBurner, ComponentBurner)

interface

integer*4 function ComponentBurner(BurnerTyp,GlobalIcon)

!DEC$ ATTRIBUTES DLLIMPORT::ComponentBurner

integer BurnerTyp

integer GlobalIcon

end function ComponentBurner

end interface

dll_handle(1) = LoadLibrary ("BurnersClass.dll"C)

if (dll_handle(1) == NULL) then

! Failure

stop

end if

p_ComponentBurner = GetProcAddress (dll_handle(1), "ComponentBurner"C)

if (p_ComponentBurner == NULL) then

! Failure

stop

end if

iret = ComponentBurner(BurnerTyp,GlobalIcon,IDD_component_tab)

BurnersPreprocessing=0

return

end function BurnersPreprocessing

When I debug the main program and I execute the line code :

BurnerMenu%handle=CreateDialogParam(HandleAndInstance%ghInstance,IDD_Component_Tab, &

MDI_WINDOW_Current%Handle, loc(BurnerTab),0)

I receive the message : Unhandelded exception in Main.exe (called BurnersClass.dll):0x000005:Acces Violation.

And inside the DLL when I check the values of the function BurnerTab arguments : hDlg message, uParam, lParam I obtains :

hDlg = Undefined Adress

message = Undefined Adress

uParam = Undefined Adress

lParam = Undefined Adress

If you have a solution, or a simple example of using DLL with MDI project send it me

thanks in advance

0 Kudos
1 Reply
TimP
Honored Contributor III
686 Views
This would be topical only on the Windows Fortran forum.
0 Kudos
Reply