1 2 3 4 5 |
DWORDGetModuleFileName( HMODULEhModule, LPTSTRlpFilename, DWORDnSize ); |
HMODULE hModule 装载一个程序实例的句柄。如果该参数为NULL,该函数返回该当前 应用程序全路径。
LPTSTR lpFileName 是你存放返回的名字的内存块的指针,是一个输出参数
DWORD nSize,装载到缓冲区lpFileName的最大值
如果返回为成功,将在lpFileName的 缓冲区当中返回相应模块的路径,如果所设的nSize过小,那么返回仅按所设置缓冲区大小返回相应字符串内容。
如果函数失败,返回值将为0,利用GetLastError可获得异常代码。
DWORD GetPrivateProfileString(lpszSection, lpszKey, lpszDefault,lpReturnedString, cchReturnBuffer, lpszFile)
Retrieves a string from the specified section in an initialization file.
从一个初始化文件中的指定的小节中获取一个字符串
参数 类型及说明
DWORD WINAPI GetPrivateProfileString( _In_ LPCTSTR lpAppName, _In_ LPCTSTR lpKeyName, _In_ LPCTSTR lpDefault, _Out_ LPTSTR lpReturnedString, _In_ DWORD nSize, _In_ LPCTSTR lpFileName );
Avoid specifying a default string with trailing blank characters. The function inserts a null character in the lpReturnedString buffer to strip any trailing blanks.
lpReturnedString [out] A pointer to the buffer that receives the retrieved string.
nSize [in] The size of the buffer pointed to by the lpReturnedString parameter, in characters.
lpFileName [in] The name of the initialization file. If this parameter does not contain a full path to the file, the system searches for the file in the Windows directory.
If neither lpAppName nor lpKeyName is NULL and the supplied destination buffer is too small to hold the requested string, the string is truncated and followed by anull character, and the return value is equal to nSize minus one.
If either lpAppName or lpKeyName is NULL and the supplied destination buffer is too small to hold all the strings, the last string is truncated and followed by two nullcharacters. In this case, the return value is equal to nSize minus two.
In the event the initialization file specified by lpFileName is not found, or contains invalid values, this function will set errorno with a value of '0x2' (File Not Found). To retrieve extended error information, call GetLastError.