回顧VC常用知識

2021-04-12 20:07:56 字數 2094 閱讀 1322

1: 得到系統時間日期(使用getlocaltime)

cstring stime,syear,**onth,sday;

systemtime curtime;

getlocaltime(&curtime);

syear.format(%d年,curtime.wyear);

**onth.format(%d月,curtime.wmonth);

sday.format(%d日,curtime.wday);

stime = syear+ **onth + sday;

// curtime.whour

// curtime.wminute

// curtime.wsecond ibm的

afxmessagebox(stime);

2: 分離字串

cstring str = 4d3f0a2278;

unsigned char a12;

long x;

for(int i = 0;i< (str.getlength()/2);i++)

3: 得到當前目錄 (getcurrentdirectory)

char curpath[max_path];

dword size=max_path;

getcurrentdirectory(size,curpath);

afxmessagebox(curpath);

//cstring number;

int len = linelength(lineindex(0));

lptstr p=number.getbuffer(len);

this->getline(0,p,len);

afxmessagebox(number);

得到系統目錄 (getsystemdirectory)

4: 從字串中提取數字

cstring strnum;

cstring str(測試125各國87kk);

strnum = getstr(str);

afxmessagebox(strnum);

5: 建立無模對話方塊

cdlg_test *aa = new cdlg_test;

aa->create(idd_dialog1,null);

aa->showwindow(sw_show);1

6: 得到視窗絕對座標

cstring strnum,strnum1;

crect rect;

getclientrect(&rect);

clienttoscreen(&rect);

strnum.format(x: %d,rect.top);

strnum1.format( y: %d,rect.center);

strnum = strnum + strnum1;

afxmessagebox(strnum);

7: 複製資料夾

shfileopstruct op;

char frombuf=e:temp;

char tobuf=sintekserver個人文件陳 偉;;

op.hwnd = null;

op.wfunc = fo_copy;

op.pfrom = frombuf;

op.pto = tobuf;

op.fflags = fof_noconfirmation | fof_renameoncollision ;

op.fanyoperationsaborted = false;

op.lpszprogresstitle = null;

messagebox(複製完畢,提示,mb_ok|mb_iconinformation);

8: 捕獲 ctrl+滑鼠左鍵 組合

case

wm_lbuttondown://滑鼠訊息wparam ==

if (wparam & mk_control)

messagebox(hwnd,aaa,bbb,mb_ok);

break;

或case wm_lbuttondown:

messagebox(hwnd,aaa,bbb,mb_ok);

break;

VC常用知識

1 得到系統時間日期 使用getlocaltime cstring stime,syear,onth,sday systemtime curtime getlocaltime curtime syear.format d年 curtime.wyear onth.format d月 curtime.w...

vc 基礎知識 常用控制代碼

控制代碼型別 說明hwnd 視窗控制代碼 hinstance 當前實列控制代碼 hcursor 游標控制代碼 hfont 字型控制代碼 hpen 畫筆控制代碼 hbrush 畫刷控制代碼 hdc 裝置環境控制代碼 hbitmap 位圖控制代碼 hicon 圖示控制代碼 hmenu 選單控制代碼 hf...

MySQL知識回顧 MySQL基礎知識回顧

markdownpad document mysql mysql 是用於管理檔案的乙個軟體 服務端軟體 socket服務端 本地檔案操作 解析指令 sql語句 客戶端軟體 各種各樣 socket客戶端 傳送指令 解析指令 sql語句 ps dbms 資料庫管理系統 sql語句 需要掌握的技能 安裝 ...