;
帖子
3919 
精华
积分
11710 
鱼币
0 ¥ 
来自
大连 
在线时间
1858 小时 
注册时间
2007-6-11 
最后登录
2009-10-20 

贴图大师勋章新人进步勋章宣传大使勋章论坛元老勋章

3
发表于 2009-1-5 19:48 | 只看该作者
VC甯哥敤鐭ヨ瘑 - 缂栫▼搴 - Powered by SupeSite

浣犵殑浣嶇疆锛缂栫▼搴 >> 璧勮 >> VC >> CC++MFC >> 璇︾粏鍐呭 鍦ㄧ嚎鎶曠ǹ

VC甯哥敤鐭ヨ瘑

鍙戝竷: 2008-6-26 11:25 |  浣滆: admin |   鏌ョ湅: 71娆

1: 寰楀埌绯荤粺鏃堕棿鏃ユ湡(浣跨敤GetLocalTime)

CString sTime,sYear,sMonth,sDay;

SYSTEMTIME CurTime;

GetLocalTime(&CurTime);

sYear.Format("%d骞",CurTime.wYear);

sMonth.Format("%d鏈",CurTime.wMonth);

sDay.Format("%d鏃",CurTime.wDay);

sTime = sYear+ sMonth + sDay;

// CurTime.wHour

// CurTime.wMinute

// CurTime.wSecond IBM鐨

AfxMessageBox(sTime);

2: 鍒嗙瀛椾覆

CString str = "4d3f0a2278";

unsigned char a[12];

long x;

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

{

sscanf(str.Mid(2*i,2),"%x",&x);

a[i] = x;

}

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);

6: 寰楀埌绐楀彛缁濆鍧愭爣

CString strNum,strNum1;

CRect rect;

GetClientRect(&rect);

ClientToScreen(&rect);

strNum.Format("X: %d",rect.top);

strNum1.Format(" Y: %d",rect.left);

strNum = strNum + strNum1;

AfxMessageBox(strNum);

7: 澶嶅埗鏂囦欢澶

SHFILEOPSTRUCT Op;

char FromBuf[]="E:\\temp\0";

char ToBuf[]="\\\\SINTEKSERVER\\涓汉鏂囨。\\闄 浼焅0";;

Op.hwnd = NULL;

Op.wFunc = FO_COPY;

Op.pFrom = FromBuf;

Op.pTo = ToBuf;

Op.fFlags = FOF_NOCONFIRMATION | FOF_RENAMEONCOLLISION ;

Op.fAnyOperationsAborted = FALSE;

Op.hNameMappings = NULL;

Op.lpszProgressTitle = NULL;

if(SHFileOperation(&Op) == 0)

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:

if(GetKeyState(VK_CONTROL)<0)

MessageBox(hwnd,"aaa","bbb",MB_OK);

break;

鎵撳嵃 | 鏀惰棌姝ら〉 |  鎺ㄨ崘缁欏ソ鍙 | 涓炬姤
涓婁竴绡 涓嬩竴绡
 

璇勫垎锛0

鍙戣〃璇勮
鏌ョ湅鍏ㄩ儴鍥炲銆愬凡鏈0浣嶇綉鍙嬪彂琛ㄤ簡鐪嬫硶銆