- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I try to setup a dialog in a dll.
Below is my dllmain function:
integer function DllMain (hInst, ul_reason_being_called, lpReserved)
!DEC$ IF DEFINED(_X86_)
!DEC$ ATTRIBUTES STDCALL, ALIAS : '_DllMain@12' :: DllMain
!DEC$ ELSE
!DEC$ ATTRIBUTES STDCALL, ALIAS : 'DllMain' :: DllMain
!DEC$ ENDIF
use minewinGlobals
use DFWIN
implicit none
integer(HANDLE) hInst
integer(DWORD) ul_reason_being_called
integer(HANDLE) lpReserved
! Save the module instance handle in a global variable
ghinst = hInst
! Return 1 to indicate success
DllMain = 1
return
end function DllMain
and the functtion which setups dialog:
integer function Mine( )
!DEC$ ATTRIBUTES DLLEXPORT::Mine
use user32
use dflogm
use minewinGlobals
USE DFLIB
IMPLICIT NONE
include 'resource.fd'
external minewinSub
integer(LRESULT) lret
lret = DlgInitWithResourceHandle(IDD_MineWIN_DIALOG, ghinst,gdlg)
if (lret == .FALSE.) goto 99999
lret = DlgSetSub(gdlg, IDD_MineWIN_DIALOG, minewinSub)
lret = DlgModeless(gdlg, SW_SHOWNORMAL,0)
if (lret == .FALSE.) goto 99999
In minewinGlobals define:
integer(HANDLE) ghinst
integer(HANDLE) hwndParent
DlgModeless returns FALSE. IDD_MineWIN_DIALOG has been tested in a winmain program.
Apprecate your help!
Below is my dllmain function:
integer function DllMain (hInst, ul_reason_being_called, lpReserved)
!DEC$ IF DEFINED(_X86_)
!DEC$ ATTRIBUTES STDCALL, ALIAS : '_DllMain@12' :: DllMain
!DEC$ ELSE
!DEC$ ATTRIBUTES STDCALL, ALIAS : 'DllMain' :: DllMain
!DEC$ ENDIF
use minewinGlobals
use DFWIN
implicit none
integer(HANDLE) hInst
integer(DWORD) ul_reason_being_called
integer(HANDLE) lpReserved
! Save the module instance handle in a global variable
ghinst = hInst
! Return 1 to indicate success
DllMain = 1
return
end function DllMain
and the functtion which setups dialog:
integer function Mine( )
!DEC$ ATTRIBUTES DLLEXPORT::Mine
use user32
use dflogm
use minewinGlobals
USE DFLIB
IMPLICIT NONE
include 'resource.fd'
external minewinSub
integer(LRESULT) lret
lret = DlgInitWithResourceHandle(IDD_MineWIN_DIALOG, ghinst,gdlg)
if (lret == .FALSE.) goto 99999
lret = DlgSetSub(gdlg, IDD_MineWIN_DIALOG, minewinSub)
lret = DlgModeless(gdlg, SW_SHOWNORMAL,0)
if (lret == .FALSE.) goto 99999
In minewinGlobals define:
integer(HANDLE) ghinst
integer(HANDLE) hwndParent
DlgModeless returns FALSE. IDD_MineWIN_DIALOG has been tested in a winmain program.
Apprecate your help!
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try using GetModuleHandle("YOURDLLNAME.DLL") instead of the instance handle
(perhaps add the full path to the DLL).
(perhaps add the full path to the DLL).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried use GetModuleHandle("YOURDLLNAME.DLL"), and this time the error is on DlgInitWithresourcehandle. I add the full path of the dll.
By the way, I am using x64 platform for dll and main pogram. Does it metter?
By the way, I am using x64 platform for dll and main pogram. Does it metter?

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page