1. Get the program path TCHAR EXEFULLPATH [MAX_PATH]; getModuleFileName (Null, ExefullPath, Max_Path) 2. Get a folder char szdir [max_path] from the dialog; browseinfo bi; itemidlist * PIDL;
Bi.hwndowner = this-> m_hwnd; bi.pidlroot = null; bi.pszdisplayName = szdir; bi.lpsztitle = "Please select a controlled directory"; // strdlgtitle; bi.ulflags = bif_returnonlyfsdirs; bi.lpfn = null; Bi.lparam = 0; bi.iimage = 0;
PIDL = shbrowseForfolder (& Bi); if (pidl == null) return; if (! SHGETPATHFROMIDLIST (PIDL, SZDIR)) Return; 3. Segment string
CString S = "AAA, BBB, CCC, DDD"; Char A1 [4], A2 [4], A3 [4], A4 [4]; SSCANF (s, "% [^,],% [^,] ,% [^,],% [^,], A1, A2, A3, A4); AFXMessageBox (A4); // Displays DDD4. Turn off Display :: SendMessage (GetsafehWnd (), WM_SYSCOMMAND, SC_MONITORPOWER, 1) 4. Open the monitor: :: SendMessage (getSafehWnd (), wm_syscommand, sc_monitorpower, -1); 6. Get system time, language, etc. GetLocaleInfo (locale_user_dfault, local_itime, lplcdata, cchdata); 7. Calculate Windows running time Ulong time_mm = gettickcount (); ulong time_sec = (time_mm / 1000)% 60; int Time_MIN = (TIME_MM / (1000 * 60))% 60; int Time_Hour = (TIME_MM / (1000 * 60 * 60))% 24; INT TIME_DAY = (TIME_MM / (1000 * 60 * 60 * 24); cout << Time_DAY << "DAY (s)" << Time_Hour << "Hour (s)" << Time_min << "Minute (s) "<< time_sec <<" second (s) ./ n "; 8. Whether the file exists (header IO.H) IF (_Access (" c: //somefile.file ", 0)! = - 1) / /exist
9. else // get clipboard data does not exist if (OpenClipboard ()) {HANDLE hData = GetClipboardData (CF_TEXT); char * buffer = (char *) GlobalLock (hData); fromClipboard = buffer; GlobalUnlock (hData); CloseClipboard ( );} 10. Related pictures on CSTATIC