獲得各種系統路徑

2021-08-07 06:05:56 字數 1394 閱讀 8751

①獲取系統system32路徑:(c:\windows\system32)

使用函式getsystemdirectory.  cstring版封裝:

[cpp]view plain

copy

static

cstring getsysfolder ()  

;  getsystemdirectory( szpath, 100 ) ;  

return

cstring(szpath) ;  

}  ②獲取

系統windows

路徑:(c:\windows)

[cpp]view plain

copy

static

cstring getwindowsfolder()  

;  getwindowsdirectory( szpath, 100 ) ;  

return

cstring(szpath) ;  

}  ③獲取模組執行所在資料夾(exe所在目錄)

[cpp]view plain

copy

//獲取執行目錄(exe所在目錄)

static

cstring getmodulefolder( 

hmodule

hmodule )  

;  getmodulefilename( hmodule, szpath, max_path ) ;  

zeromemory(_tcsrchr(szpath,_t('\\')), _tcslen(_tcsrchr(szpath,_t('

\\') ) )*

sizeof

(tchar

)) ;  

return

cstring(szpath) ;  

}  ④獲取模組檔案完整路徑(包含exe檔名及字尾)

[cpp]view plain

copy

//獲取執行模組檔案全路徑

static

cstring getmodulefilepath( 

hmodule

hmodule )  

;  getmodulefilename( hmodule, szpath, max_path ) ;  

return

cstring(szpath) ;  

}  ⑤

上級目錄

[cpp]view plain

copy

//得到上一級目錄

static

cstring getupfolder(cstring strpath)  

路徑相關方法 1,獲取各種系統路徑

介紹獲取windows常用的一些系統路徑的方法 當前使用者 如 桌面 我的文件等。並提供簡單封裝為類pathhelper,供以後工程快捷呼叫。獲取系統system32路徑 c windows system32 使用函式getsystemdirectory.cstring版封裝 static cstr...

獲取Android各種系統資訊

string phoneinfo cpu abi android.os.build.cpu abi phoneinfo tags android.os.build.tags phoneinfo version codes.base android.os.build.version codes.bas...

各種系統的登入介面

介面效果 連線資料庫 註冊使用者和密碼 1 首先先檢查資料庫中是否有相應的資料,如果有的話提示 該使用者存在,請直接登入。private void cheak string username,string userpass throws exception else 判斷資料庫中是否有該使用者名稱和...