- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Out of necessity, to work with a third-party application, I have done so.
You cannot use DlgInit within the DLL as you cannotsupply the necessary dialog resources with a GUI dll, you have to use DLGINITWITHRESOURCEHANDLE and load your dialog resources from a seperateresource-only DLL that you must create. I found the latter task very straightforward. Once you load your Dialogresource.DLL you get a handle that you can use with DLGINITWITHRESOURCEHANDLE.
Message Edited by anthonyrichards on 02-19-2006 07:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In my case, my main DLL contained onlysubroutines called from another, smaller DLL. From the CVF help...quote"
DLGINIT will only search for the dialog box resource in the main application. For example, it will not find a dialog box resource that has been built into a dynamic link library.
DLGINITWITHRESOURCEHANDLE can be used when the dialog resource is not in the main application. If the dialog resource is in a dynamic link library (DLL), hinst must be the value passed as the first argument to the DLLMAIN procedure." unquote.
Since my main DLL did not contain a DLLMAIN, I got a handle using the following: code:
Code:
! Because this program is in a DLL, it cannot use DlgInit and must load ! dialog resources from a resource-only DLL in file 'Dialogresource.dll' ! to get an instance handle which is then used in DlgInitwithresourcehandle ! ! load dialog resources from the resource-only DLL call SetLastError(0) Dialogresource='Dialogresource.dll'C DLLhInstance=LoadLibrary( Dialogresource ) if(GetLastError().ne.0) then Ierror=GetLastError() write(message,'("Dialogresource.dll LoadLibrary error = ",I10)') Ierror message=trim(adjustl(message))//''c ret = MessageBox(ghwndMain, message, & "Application BEAMS"C, MB_OK) flagout=-2.0d+00 return endif ! Initialise the dialog using the resource ID and the resource handle lret = DlgInitwithresourcehandle(IDD_BEAMS_DIALOG, DLLhInstance, gdlg) if (lret == .FALSE.) goto 99999 lret = DlgSetSub(gdlg, IDD_BEAMS_DIALOG, beamsSub)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
DLLhInstance=LoadLibrary("Dialogresource.dll"C)use
DLLhInstance=GetModuleHandle("ThisDll.dll"C)and, of course, link the resources within this dll.

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