Find DLL location?

  • Is there a way of finding out where the wPDF DLL being used by a program is located. I want to create a 'files used by this program' list and although I know where it should have been installed it's not totally impossible that a user could have moved it to the Windows System directory or somewhere else?

    TYIA

    Tony Bryer SDA UK

    • Offizieller Beitrag

    Hi,

    I am afraid windows does not give us the option for this. If a DLL is just specified as a name (without path) the DLL can be virtually anywhere. The only way to be sure is to install the DLL in the applications directory (or subdirectory) and use SetDLLName to set the path and name. You can rename the DLL as well.

    Tip: You can use ExtractFilePath(Application.EXEName) to get the directory of your application.

    Julian Ziersch

  • Thanks - we already rename it as SDAwPDF2.dll to save conflicts with any other installed copy. I had assumed that somewhere in the API there was a way to do confirm the location but if not I guess the best answer is to follow the same search process as Windows until the file is found viz (courtesy of MSDN):

    1. The directory where the executable module for the current process is located.
    2. The current directory.
    3. The Windows system directory. The GetSystemDirectory function retrieves the path of this directory.
    4. The Windows directory. The GetWindowsDirectory function retrieves the path of this directory.
    5. The directories listed in the PATH environment variable.

    Tony Bryer SDA UK