Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

graphical dll

cecio
초보자
823 조회수
Hi,
I have already used CVF to create a DLL to export my code for usig with VB.
Now I would like to create a dll that have some dialog in it.
It is possible to do?
thanks
0 포인트
5 응답
Jugoslav_Dujic
소중한 기여자 II
823 조회수
It's possible in principle. I don't recommend that approach though it's against the principle of separation of GUI and calculation tasks.
0 포인트
anthonyrichards
새로운 기여자 III
823 조회수

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

0 포인트
Jugoslav_Dujic
소중한 기여자 II
823 조회수
I didn't try myself, but I don't see why you couldn't use DlgInitWithResourceHandle to load the dialog from the same dll? All you need to do it is to get the HMODULE from DllMain or GetModuleHandle("thedll.dll"C) there's no need for a satellite dll. Or am I missing something?
0 포인트
anthonyrichards
새로운 기여자 III
823 조회수

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)



0 포인트
Jugoslav_Dujic
소중한 기여자 II
823 조회수
My point is, you don't need a separate resource-only dll for that. Simply, instead of
DLLhInstance=LoadLibrary("Dialogresource.dll"C)
use
DLLhInstance=GetModuleHandle("ThisDll.dll"C)
and, of course, link the resources within this dll.
0 포인트
응답