1 windows 2 緩存 3 函數 4 this 5 spa |
DWORDGetModuleFileName( debug HMODULEhModule, 指針 LPTSTRlpFilename, 調試 DWORDnSize code ); orm |
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.