¿Puede una dll de Windows recuperar su propio nombre de archivo?
Un archivo exe de Windows tiene acceso a la cadena de comandos que lo invocó, incluyendo su ruta y nombre de archivo. eg. C:\MyApp\MyApp.exe --help
.
Pero esto no es así para un dll invocado a través de LoadLibrary
. ¿Alguien conoce una forma de que una dll averigüe cuál es su ruta y nombre de archivo?
Específicamente estoy interesado en una solución de Delphi, pero sospecho que la respuesta sería más o menos la misma para cualquier idioma.
27
Author: Blorgbeard, 2008-08-05
1 answers
Creo que estás buscando GetModuleFileName.
Http://www.swissdelphicenter.ch/torry/showcode.php?id=143 :
{
If you are working on a DLL and are interested in the filename of the
DLL rather than the filename of the application, then you can use this function:
}
function GetModuleName: string;
var
szFileName: array[0..MAX_PATH] of Char;
begin
FillChar(szFileName, SizeOf(szFileName), #0);
GetModuleFileName(hInstance, szFileName, MAX_PATH);
Result := szFileName;
end;
Sin embargo, no probado, ha pasado algún tiempo desde que trabajé con Delphi:)
35
Author: Michael Stum,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-02-07 13:01:06
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-02-07 13:01:06