Jump to content
alogrep

Enum modules return ONLY the application, no other packages

Recommended Posts

HI

I hope someone can help.

The docwiki states:

EnumModules continues until the last module in the application is enumerated, or until the callback function returns False.

Bu the code below omnly shws the Application name,.  Where is my error?

function GetModules(Instance: THandle; Data: Pointer): Boolean;
var
  FileName: array[0..Max_Path] of Char;
begin
  if GetModuleFileName(Instance, FileName, SizeOf(FileName)) > 0 then
    Tlistbox(Data).items.Add(FileName)
  else
    RaiseLastWin32Error;
  Result := True;
end;

 

 EnumModules(GetModules, ListBox1);

 

 

Share this post


Link to post
16 minutes ago, alogrep said:

Bu the code below omnly shws the Application name,.  Where is my error?

Does your program use external DLLs/BPL files?  Even if you are using Packages, if they are statically linked into your EXE then they will probably not be treated as separate modules.

 

Edited by Remy Lebeau

Share this post


Link to post

Thanks Remy.

I am talking aboutn the Component ->Install Packages list.

Is there a way to get a list of them to print or to save to a file?

PKS.jpg

Share this post


Link to post

Have you enabled "Build with run-time packages" in the project options? If not all code from the units in question will be compiled into a monolithic exe and there will be no other modules other than DLLs used from the OS or statically linked by units used in the application.

Share this post


Link to post
4 hours ago, alogrep said:

I am talking aboutn the Component ->Install Packages list.

What makes you think EnumModules() has anything to do with that list? It enumerate the modules that your compiled EXE is using at runtime. Not the modules that are installed in the IDE at design-time.

Quote

Is there a way to get a list of them to print or to save to a file?

If you want the list that is installed in the IDE, then you will have to manually read that list from the IDE's configuration in the Windows Registry.

 

If you want the list that your EXE is compiled with, then such modules only exist if you compile with Runtime Packages enabled so the packages are used as external BPLs at runtime. 

Edited by Remy Lebeau
  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×