home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BUG 4
/
BUGCD1997_05.BIN
/
aplic
/
clip4win
/
clip4win.exe
/
C4W30E.HUF
/
SOURCE
/
DLLFREE.PRG
< prev
next >
Wrap
Text File
|
1996-01-10
|
837b
|
42 lines
// DLLFree.prg - free a DLL
//
// Written by: John M. Skelton, Apr-95.
//
// Copyright (C) 1995 Skelton Software, Kendal Cottage, Hillam, Leeds LS25 5HP, UK.
// All Rights Reserved.
//
// Part of Clip-4-Win.
#include "dll.ch"
function main(cDLL)
local hLib, c, n
local hWnd := WinSetup("DLLFree", "DLLFree")
if (hLib := LoadLibrary(cDLL)) < 32
? "DLL ", cDLL, " not found!!"
wait
quit
endif
n = GetModuleUsage(hLib) - 1
? "Usage count =", n
wait "Do not abuse this! Free it (Y/N) ? " to c
if lower(c) == "y"
do while n-- != 0
FreeLibrary(hLib)
enddo
if (n := GetModuleUsage(hLib) - 1) != 0
? "ERROR - not freed correctly. Final usage count =", n
wait
endif
endif
FreeLibrary(hLib)
return nil
_DLL function GetModuleUsage(hInst as int) as int Pascal:KERNEL.GetModuleUsage