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;




发表于 2009-1-5 19:48
| 











