Форум программистов «Весельчак У»
  *
Добро пожаловать, Гость. Пожалуйста, войдите или зарегистрируйтесь.
Вам не пришло письмо с кодом активации?

  • Рекомендуем проверить настройки временной зоны в вашем профиле (страница "Внешний вид форума", пункт "Часовой пояс:").
  • У нас больше нет рассылок. Если вам приходят письма от наших бывших рассылок mail.ru и subscribe.ru, то знайте, что это не мы рассылаем.
   Начало  
Наши сайты
Помощь Поиск Календарь Почта Войти Регистрация  
 
Страниц: [1]   Вниз
  Печать  
Автор Тема: Работа с директориями  (Прочитано 6527 раз)
0 Пользователей и 1 Гость смотрят эту тему.
krulik
Гость
« : 11-06-2005 10:31 » 

Помогите пожалуйста. Как можно из проги получить полный адрес к папке в которой установленна сама прога.
Помогите плииииз.   Так больше нельзя...
Записан
Finch
Спокойный
Администратор

il
Offline Offline
Пол: Мужской
Пролетал мимо


« Ответ #1 : 11-06-2005 10:55 » 

Функция WinAPI    GetModuleFileName даст тебе в строке полный путь и имя файла согласно Instance модуля. Тебе останется только выкинуть из строки имя файла.
Цитата
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.
« Последнее редактирование: 20-12-2007 17:51 от Алексей1153++ » Записан

Не будите спашяго дракона.
             Джаффар (Коша)
krulik
Гость
« Ответ #2 : 11-06-2005 12:04 » 

Finch а можшь дать пример. Я с функциями API не работал.
Записан
krulik
Гость
« Ответ #3 : 11-06-2005 12:24 » 

Все нашел. "ExtractFilePath(Application.ExeName)" - возвращает путь запуска программы. Finch спасибо что откликнулся
Записан
Страниц: [1]   Вверх
  Печать  
 

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines