Classification: |
C++ |
Category: |
Application architecture |
Created: |
03/14/2000 |
Modified: |
06/12/2001 |
Number: |
FAQ-0477 |
Platform: |
ER5 |
|
Question: I want to locate one or more resources that are in the same location as my dll or exe file. How can I query this path once
the dll or exe is loaded?
Answer: If the DLL is an application, then the application architecture ( APPARC ) stores the full path. This can be recovered given
a reference to the CEikAppUi (for example): CEikApplication* app=appui->Application(); TFileName appDllName(app->FileName()); For other DLLs there is (since ER5) also the Dll::FileName() function in EUSER. This returns the full path and name of a DLL
that is loaded from disk, but possibly only the drive letter if in ROM (so as to not require a scan of the ROM filing system
for the DLL). This usually suffices as this information is usually used to locate some form of resource file on the same disk
as the DLL, and the directory location is normally known for this type of DLL. This is typically used by parsing the base
file name with the known directory and the result of Dll::FileName().
For EXEs you can call RProcess().FileName() which should report the full path and name of the .exe image used to run the process.
|