Francois PIETTE wrote:
>> To find out where rtl70.bpl is, first use
>> GetModuleHandle('rtl70.bpl') to get the handle to that module. Then
>> call GetModuleFileName to get the full path to the file.
> 
> Thank you. But I already know that but that's not what I need. I need
> to get hand on the handle of the ALREADY loaded rtl70.bpl.

That's all GetModuleHandle ever returns.

> This is because calling GetModuleHandle('rtl70.bpl') could return a
> handle to another instance file of the RTL70.BPL

A module of a particular name may only be loaded once per process.
Further attempts simply increment the count on the module already loaded.

> (because of changed path or current directory for example).

A module's location cannot change while it is loaded into memory.

> I need to be sure to access the already loaded one as so I need to
> get the handle.

Perhaps you're confusing GetModuleHandle with LoadLibrary. You don't
need to call LoadLibrary since the rtl70.bpl will already be loaded.

Even if you did call LoadLibrary, you'd still get the same handle since
LoadLibrary won't re-load a module that's already in memory. If you
called LoadLibrary, you should also call FreeLibrary to make sure the
reference count stays correct.

-- 
Rob
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to