PSS ID Number: 102693
Article Last Modified on 5/5/2001
C Compiler options needed: /c /Od /Zi /AL
interface to integer*2 function PostAppMessage[pascal]
+ (htask, msg, wparam, lparam)
integer*2 htask[value]
integer*2 msg[value]
integer*2 wparam[value]
integer*4 lparam[value]
end
interface to integer*2 function GetCurrentTask[pascal]
end
interface to integer*2 function MessageBox[pascal]
+ (hwnd, boxtext, caption, boxtype)
integer*2 hwnd[value]
character*1 boxtext[reference]
character*1 caption[reference]
integer*2 boxtype[value]
end
subroutine exit
integer*2 in
character buffer1*120, buffer2*80
integer*2 i, WM_QUIT, PostAppMessage, GetCurrentTask, MessageBox
WM_QUIT = #12
buffer1 =
+'************** DLL issued STOP Statement ************'//
+'\n Application will terminate. Save contents of windows NOW'c
buffer2 = 'DLL STOP'c
i = MessageBox(0, buffer1, buffer2, 0)
i = PostAppMessage(GetCurrentTask(), WM_QUIT, in, 0)
return
end
The following QuickWin driver program calls the subroutine in
DLLTEST.FOR.
C Compiler options needed: /c /Od /Zi /MW
program testdllstop
print *, 'before calling DLL'
call dllsub
print *, 'back from sub1'
end
The following DLL displays a dialog box and calls the exit subroutine
to close the DLL and the calling application.
C Compiler options needed: /c /Od /Zi /Aw /Gw
interface to integer*2 function MessageBox[pascal]
+ (hwnd, boxtext, caption, boxtype)
integer*2 hwnd[value]
character*1 boxtext[reference]
character*1 caption[reference]
integer*2 boxtype[value]
end
subroutine dllsub
integer*2 messagebox
i = MessageBox(int2(0), 'Prior to STOP statement in DLL'c,
+ ' 'c, 0)
call exit
end
LIBRARY DLLTEST
EXETYPE WINDOWS
CODE PRELOAD MOVEABLE DISCARDABLE
DATA PRELOAD MOVEABLE SINGLE
HEAPSIZE 1024
EXPORTS DLLSUB
WEP
all: test.exe dlltest.dll
test.obj: test.for
fl /c /Od /Zi /MW test.for
dlltest.obj: dlltest.for
fl /c /Od /Zi /Aw /Gw dlltest.for
exit.obj: exit.for
fl /c /Od /Zi /AL exit.for
dlltest.dll: dlltest.obj exit.obj
link dlltest exit, dlltest.dll, nul, /co /nod ldllfew, dlltest.def;
dlltest.lib: dlltest.def
implib dlltest.lib dlltest.def
test.exe: test.obj dlltest.lib
link test, test, nul, /co /nod llibfew dlltest,
c:\fortran\binb\fl.def;
Additional query words: 5.10
Keywords: KB102693
Technology: kbAudDeveloper kbFORTRAN510DOS kbFortranSearch kbZNotKeyword3