Search code examples
delphiwinapiresourcesfile-type

Is there a list of supported file types which can contain resources?


I'm looking for a list of file types which can contain resources and can be loaded by LoadLibrary or LoadModule function.

I want to load resources using LoadResource function where the first parameter is the handle to a module and I'd like to know what file types are supported (may contain resources and can be loaded by the LoadLibrary or LoadModule function).

Footnote:
I'm working on a translation tool with resource support and I need this for file open dialog filter.

Thanks


Solution

  • I'm looking for a list of file types which can contain resources and can be loaded by LoadLibrary and LoadModule functions.

    You should not use LoadModule, it's for compatibility with 16 bits application. LoadLibrary is used to, well, load libraries: Executables and DLL's fit the bill. Since you want the information for your File Open dialog, I assume you're mostly interested in applicable file extensions. Unfortunately that's not easy, because EXE's and DLL's don't necessarily need to have the EXE and DLL extensions. For example the SCR extension is a popular extension for screen savers, but the actual file is a plane EXE. BPL is the extensions of Delphi's compiled packages, but those files are actually DLL's as far as LoadLibrary is concerned.

    In my opinion you should simply filter on EXE and DLL, but let the user open whatever they want. You'll only know if it's truly compatible with LoadLibrary if LoadLibrary fails or not.