Путь к плагину

Форум о самом популярном файловом менеджере Total Commander

Сообщение AlecP » Чт окт 07, 2004 12:10 pm

Вопрос к писателям плагинов. Как внутри плагина узнать полный путь к файлу плагина? К самому TC без проблем, а вот к плагину не знаю.
AlecP
Ст. сержант
 
Сообщений: 39
Зарегистрирован: Чт авг 12, 2004 2:01 pm
Пункты репутации: 0

Сообщение Nordmoon » Чт окт 07, 2004 12:19 pm

<!--QuoteBegin-AlecP+Oct 7 2004, 13:10--><div class='quotetop'>QUOTE(AlecP @ Oct 7 2004, 13:10)</div><div class='quotemain'><!--QuoteEBegin-->Как внутри плагина узнать полный путь к файлу плагина?
<!--QuoteEnd--></div><!--QuoteEEnd-->
Поподробней, это как?
Nordmoon
Полковник
 
Сообщений: 1264
Зарегистрирован: Ср апр 10, 2002 4:37 pm
Пункты репутации: 0

Сообщение AlecP » Чт окт 07, 2004 12:35 pm

Как в коде плагина узнать где находится DLL этого плагина? Т.е. внутри его функций. Стандартные функции возвращают путь к EXE,т.е. к TC.
Последний раз редактировалось AlecP Чт окт 07, 2004 12:38 pm, всего редактировалось 1 раз.
AlecP
Ст. сержант
 
Сообщений: 39
Зарегистрирован: Чт авг 12, 2004 2:01 pm
Пункты репутации: 0

Сообщение Ipse » Чт окт 07, 2004 2:47 pm

2AlecP
Может быть так:

The GetModuleFileName function retrieves the full path and filename for the executable file containing the specified module.

Windows 95: The GetModuleFilename function will return long filenames when an application's version number is greater than or equal to 4.00 and the long filename is available. Otherwise, it returns only 8.3 format filenames.

DWORD GetModuleFileName(

HMODULE hModule, // handle to module to find filename for
LPTSTR lpFilename, // pointer to buffer for module path
DWORD nSize // size of buffer, in characters
);


Parameters

hModule

Identifies the module whose executable filename is being requested. If this parameter is NULL, GetModuleFileName returns the path for the file used to create the calling process.

lpFilename

Points to a buffer that is filled in with the path and filename of the given module.

nSize

Specifies the length, in characters, of the lpFilename buffer. If the length of the path and filename exceeds this limit, the string is truncated.



Return Values

If the function succeeds, the return value is the length, in characters, of the string copied to the buffer.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

If a module is loaded in two processes, its module filename in one process may differ in case from its module filename in the other process.

HMODULE hModule передается твоему плагину в функции BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) как параметр HANDLE hModule. Надо только сохранить его в какой-нибудь глобальной переменной для дальнейшего юзания.
Ipse
Прапор
 
Сообщений: 65
Зарегистрирован: Вс окт 26, 2003 4:19 pm
Пункты репутации: 0

Сообщение dest » Пт окт 08, 2004 5:22 pm

Еще тебе наверное понадобится функция:
_splitpath(FullName,Disk,Path,File,Ext);
Вроде все само за себя говорит ...
Наша работа во тьме -
Мы делаем, что умеем,
Мы отдаем, что имеем,
Наша работа во тьме.
Сомнения стали страстью,
А страсть стала судьбою.
Все остальное - искуство
В безумии быть собой.
dest
Ст. лейтенант
 
Сообщений: 114
Зарегистрирован: Вс май 09, 2004 4:34 am
Пункты репутации: 0

Сообщение Alextp » Вс окт 10, 2004 10:45 pm

Hello Alecp,

Узнать путь к DLL из плагина можно ф-цией
GetModuleFileName, для которой в параметре hModule передаешь handle своей загруженной DLL.
На Delphi этот handle - переменная hInstance.


Regards,
Alexey aka Alextp
Alextp
Ст. сержант
 
Сообщений: 44
Зарегистрирован: Сб авг 21, 2004 1:30 pm
Откуда: Москва
Пункты репутации: 0


Вернуться в Total Commander

Кто сейчас на форуме

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 10

cron