如何在VC++程序中得到Windows的系统目录的路径?
问题点数:20、回复次数:4Top
1 楼breath(跨马倚斜桥,满楼红袖招)回复于 2001-01-03 22:09:00 得分 20
终于让我等到了,我抢
GetSystemDirectoryTop
2 楼antwork(人活着总得有点精神)回复于 2001-01-03 22:11:00 得分 0
哈哈Top
3 楼witsoft2000(踏雪无痕)回复于 2001-01-03 22:18:00 得分 0
breath说得一点没错Top
4 楼Jans(网事如风)回复于 2001-01-03 22:21:00 得分 0
我重复一下:
UINT GetWindowsDirectory(
LPTSTR lpBuffer, // address of buffer for Windows directory
UINT uSize // size of directory buffer
);
Parameters
lpBuffer
Pointer to the buffer to receive the null-terminated string containing the path. This path does not end with a backslash unless the Windows directory is the root directory. For example, if the Windows directory is named WINDOWS on drive C, the path of the Windows directory retrieved by this function is C:\WINDOWS. If the system was installed in the root directory of drive C, the path retrieved is C:\.
uSize
Specifies the maximum size, in characters, of the buffer specified by the lpBuffer parameter. This value should be set to at least MAX_PATH to allow sufficient room in the buffer for the path.
Return Values
If the function succeeds, the return value is the length, in characters, of the string copied to the buffer, not including the terminating null character.
If the length is greater than the size of the buffer, the return value is the size of the buffer required to hold the path.
If the function fails, the return value is zero. To get extended error information, callGetLastError.
The GetSystemDirectory function retrieves the path of the system directory. The system directory contains such files as dynamic-link libraries, drivers, and font files.
UINT GetSystemDirectory(
LPTSTR lpBuffer, // address of buffer for system directory
UINT uSize // size of directory buffer
);
Parameters
lpBuffer
Pointer to the buffer to receive the null-terminated string containing the path. This path does not end with a backslash unless the system directory is the root directory. For example, if the system directory is named WINDOWS\SYSTEM on drive C, the path of the system directory retrieved by this function is C:\WINDOWS\SYSTEM.
uSize
Specifies the maximum size of the buffer, in characters. This value should be set to at least MAX_PATH.
Return Values
If the function succeeds, the return value is the length, in characters, of the string copied to the buffer, not including the terminating null character. If the length is greater than the size of the buffer, the return value is the size of the buffer required to hold the path.
If the function fails, the return value is zero. To get extended error information, callGetLastError.
Top




