Friday, April 8, 2016

How to verify the existance of a DLL in VFP

 



How can I programmatically check that a .dll is present on a users machine?

Declare Integer LoadLibrary In kernel32;
    STRING lpLibFileName

Declare Integer FreeLibrary In kernel32;
    INTEGER hLibModule

?isDLLAvailable('cdosys.dll')
Function isDLLAvailable(DllFilename)
    Local hModule

    hModule = LoadLibrary(DllFilename)
    If hModule > 32 
        FreeLibrary(hModule)
        lRetval = .T.
    Else
        lRetVal = .F.
    ENDIF
    RETURN lRetVal
Endfunc
}

No comments:

Post a Comment