常用的小函式

2021-04-12 20:01:38 字數 1618 閱讀 8989

1獲取命令列的第n個引數值

cstring getstring(cstring stropt,int n,cstring sign=_t(""))     //傳入字串  n  以什麼做為分格符

hw=hw->getwindow(gw_hwndnext);

hwnd=hw->getsafehwnd();

}return i==1;

}6 顯示模組資訊   以下是列舉特定程序的所有模組

bool cmfc_formdlg::findmodulename(dword pid,cstring modulename)//程序id,模組名  

;bool isout=true;

hmodulesnap   =   createtoolhelp32snapshot(th32cs_snapmodule,pid);    

if   (hmodulesnap   ==   (handle)-1)    

return   (false);

pe32.dwsize   =   sizeof(moduleentry32);    

if (module32first(hmodulesnap,   &pe32))

isout=module32next(hmodulesnap,   &pe32);}}

return(true);

}7 通過視窗控制代碼得到所屬程序

dword pid;        getwindowthreadprocessid(::getactivewindow(), &pid );

8 解除安裝注入的東西

handle hthread = createremotethread( hprocess, null, 0, (lpthread_start_routine)pfunc, lpbuf, 0, null );

// 等待getmodulehandle執行完畢

waitforsingleobject( hthread, infinite );

// 獲得getmodulehandle的返回值

getexitcodethread( hthread, &dwhandle );

// 釋放目標程序中申請的空間

virtualfreeex( hprocess, lpbuf, dwsize, mem_decommit );

closehandle( hthread );

9 cstring 轉char

char * cstringtochar(lpwstr csstr/*cstring csstr*/)

2 有一函式 void callfn(int i,notifyevent notifyevent)            typedef void(*notifyevent)();

//呼叫

3 a a1;     typedef void(a::*notify)();         notify ppfn=&a::print;         callfn(1,(notifyevent)&ppfn);

只是該函式必須是靜態的,要想不是靜態的,不行,因為方法是在類裡的,耐用例項確包含著資料,這樣,知道方法的位址,確沒有資料是不行的。   但我覺得,只要是了解了內部類的構造情況,應該可以加多乙個引數,即例項的位址,或許可以傳入某例項的方法進來

postgresql 常用小函式

將字串按照分隔符劃分成為陣列 create or replace function tools str2array in originstr varchar 800 in delimeter varchar 10 returns varchar 800 as declare strres varch...

幾個常用的小函式2

opt1 小數 opt2 負數 當opt2為1時檢查num是否是負數 當opt1為1時檢查num是否是小數 返回1是正確的,0是錯誤的 function chknbr num,opt1,opt2 當最後一位為.時出錯 if num.charat i 1 for j 0 j1 if num.chara...

小程式常用的函式封裝

讀取本地儲存 getuserinfo function fail function res 獲取本地快取 that.setdata uid res.id geturlimg 解決帶網域名稱或不帶網域名稱的位址 封裝post請求 post function url,data wx.removestor...