1: Get the system time and date (using getlocaltime)
Cstring stime, syear, smonth, SDAY;
Systemtime curtime;
Getlocaltime (& amp; curtime );
Syear. Format ("% d Year", curtime. wyear );
Smonth. Format ("% d month", curtime. wmonth );
SDAY. Format ("% d", curtime. wday );
Stime = syear + smonth + SDAY;
// Curtime. whour
// Curtime. wminute
// Curtime. wsecond from IBM
Afxmessagebox (stime );
2: separating strings
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", & amp; x );
A [I] = X;
}
3: Get the current directory (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 );
Get the system directory (getsystemdirectory)
4: extract numbers from strings
Cstring strnum;
Cstring STR ("test 125 87kk ");
Strnum = getstr (STR );
Afxmessagebox (strnum );
5: Create a mode-free dialog box
Cdlg_test * AA = new cdlg_test;
Aa-> Create (idd_dialog1, null );
Aa-> showwindow (sw_show );
6. Obtain the absolute coordinates of the window.
Cstring strnum, strnum1;
Crect rect;
Getclientrect (& amp; rect );
Clienttoscreen (& amp; rect );
Strnum. Format ("X: % d", rect. Top );
Strnum1.format ("Y: % d", rect. Left );
Strnum = strnum + strnum1;
Afxmessagebox (strnum );
7. Copy a folder
Shfileopstruct op;
Char frombuf [] = "E: \ temp \ 0 ";
Char tobuf [] = "\\\\ sintekserver \ personal document \ CHEN Wei \ 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 (& amp; OP) = 0)
MessageBox ("copied", "prompt", mb_ OK | mb_iconinformation );
8: capture Ctrl + left mouse button combination
Case wm_lbuttondown: // wparam =
If (wparam & amp; mk_control)
MessageBox (hwnd, "AAA", "BBB", mb_ OK );
Break;
Or
Case wm_lbuttondown:
If (getkeystate (vk_control) <0)
MessageBox (hwnd, "AAA", "BBB", mb_ OK );
Break;