![]() |
|
Модераторы: Daevaorn |
![]()
|
|
| SeregaLBN |
|
|||
![]() Бывалый ![]() Профиль Группа: Участник Сообщений: 178 Регистрация: 3.10.2003 Где: Киев Репутация: нет Всего: нет |
Понадобилось узнать реальное значение переменной окружения %USERPROFILE%.
В SDK нашёл, вроде бы, подходящую ф-цию: LPCTSTR FindEnvironmentString(LPCTSTR pszEnvVar); Looks up the specified environment variable and returns a pointer to its value. И написано, что обьявлена в <shellapi.h>. Но у меня, в VC++ 6, в <shellapi.h> нет обьявления данной ф-ции. Посмотрел в VC++ 5 - есть обьявление, но при линковке происходит ошибка - error LNK2001: unresolved external symbol. Подскажите как можно по другому узнать занчения переменных окружения. |
|||
|
||||
| Borisff2003 |
|
|||
![]() Бывалый ![]() Профиль Группа: Участник Сообщений: 198 Регистрация: 26.2.2004 Где: г. Уфа Репутация: 1 Всего: 1 |
А в моей shellapi есть только ето макрос с переключением для уникод
Поиши FindEnvironmentStringA и FindEnvironmentStringW на них собственно макрос и перенапраляет --------------------
Лень, двигатель прогресса |
|||
|
||||
| OlegsDP |
|
|||
|
Новичок Профиль Группа: Участник Сообщений: 37 Регистрация: 25.2.2004 Репутация: нет Всего: 1 |
В хелпе к Windows API я функции FindEnvironmentString не нашел. Но там есть вот что:
The GetEnvironmentVariable function retrieves the value of the specified variable from the environment block of the calling process. The value is in the form of a null-terminated string of characters. DWORD GetEnvironmentVariable( LPCTSTR lpName, // address of environment variable name LPTSTR lpBuffer, // address of buffer for variable value DWORD nSize // size of buffer, in characters ); Parameters lpName Points to a null-terminated string that specifies the environment variable. lpBuffer Points to a buffer to receive the value of the specified environment variable. nSize Specifies the size, in characters, of the buffer pointed to by the lpBuffer parameter. Return Values If the function succeeds, the return value is the number of characters stored into the buffer pointed to by lpBuffer, not including the terminating null character. If the specified environment variable name was not found in the environment block for the current process, the return value is zero. If the buffer pointed to by lpBuffer is not large enough, the return value is the buffer size, in characters, required to hold the value string and its terminating null character. |
|||
|
||||
| Borisff2003 |
|
|||
![]() Бывалый ![]() Профиль Группа: Участник Сообщений: 198 Регистрация: 26.2.2004 Где: г. Уфа Репутация: 1 Всего: 1 |
SeregaLBN
Существует и FindEnvironmentString и GetEnvironmentVariable --------------------
Лень, двигатель прогресса |
|||
|
||||
| AlexNor |
|
|||
|
Unregistered |
Вызови эту функцию -FindEnvironmentString- напрямую из shellapi.dll:
LoadLibrary(...) GetProcAddr(...) ну и т.д. |
|||
|
||||
![]()
|
| Правила форума "С++:Общие вопросы" | |
|
|
Добро пожаловать!
Если Вам понравилась атмосфера форума, заходите к нам чаще! С уважением, Earnest Daevaorn |
| 0 Пользователей читают эту тему (0 Гостей и 0 Скрытых Пользователей) | |
| 0 Пользователей: | |
| « Предыдущая тема | C/C++: Общие вопросы | Следующая тема » |
|
|
По вопросам размещения рекламы пишите на vladimir(sobaka)vingrad.ru
Отказ от ответственности Powered by Invision Power Board(R) 1.3 © 2003 IPS, Inc. |