SetCurrentDirectory

SetCurrentDirectory切換當前進程的當前工作目錄。

基本介紹

  • 中文名:SetCurrentDirectory
  • 簡介:切換當前進程的當前工作目錄
  • VC函式原型:BOOL WINAPI SetCurrent
  • 參數說明:lpPathName
目錄,VC函式原型,參數說明,R V,Remark,VB聲明,說明,返回值,參數表,Example,

目錄

切換當前進程的當前工作目錄。

VC函式原型

BOOL WINAPI SetCurrentDirectory( __in LPCTSTR lpPathName);

參數說明

lpPathName [in]
The path to the new current directory. This parameter may specify a relative path or a full path. In either case, the full path of the specified directory is calculated and stored as the current directory. For more information, see File Names, Paths, and Namespaces.
The string must not exceed MAX_PATH characters, including the terminating null character. The final character before the null character must be a backslash ('\'). If you do not specify the backslash, it will be added for you; therefore, specify MAX_PATH-2 characters for the path unless you include the trailing backslash, in which case, specify MAX_PATH-1 characters for the path.

R V

If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remark

Each process has a single current directory made up of two parts:
A disk designator that is either a drive letter followed by a colon, or a server name and share name (\\servername\sharename)A directory on the disk designator

VB聲明

Declare Function SetCurrentDirectory Lib "kernel32" Alias "SetCurrentDirectoryA" (ByVal lpPathName As String) As Long

說明

設定當前目錄

返回值

Long,非零表示成功,零表示失敗。會設定GetLastError

參數表

參數 類型及說明
lpPathName String,新目錄的路徑

Example

CString g_strDirect = "\\vcpp32\\ex34a\\WebSite";SetCurrentDirectory(g_strDirect);

相關詞條

熱門詞條

聯絡我們