1,win32 console程式示例:
#include
#include
#include
#include
const int filemax = 300; // allow max. 300 files in each directory
typedef struct _destfile
destfile;
typedef struct _srcfile
srcfile;
int main(int argc, char *ar**)
for (i=0; i< argc; i++)
printf("ar**[%d]: %s \n", i, ar**[i]);
strcpy(src, ar**[1]);
if (argc == 2)
else
strcat(src, "*.*"); // src should be something like g:*.*
// prepare srcfiles
bret = true;
isrcfiles = 0;
// printf("directory listing of %s\n", src);
hfile = findfirstfile(src, &fd);
while (hfile != invalid_handle_value && bret)
bret = findnextfile(hfile, &fd); }
// prepare destfiles
bret = true;
idestfiles = 0;
// printf("directory listing of %s\n", dest);
hfile = findfirstfile(dest, &fd);
while (hfile != invalid_handle_value && bret)
bret = findnextfile(hfile, &fd); }
// check for new files and redudant files
for (i=0; ibfound = false;
for (j=0; jif (!(destfiles[j].bmatch))
break; // break j loop, because found! }
} }if (bfound == false) // not found, so is new.
srcfiles[i].bisnew = true; }
// updating new files
for (i=0, j=0; iif (srcfiles[i].bisnew) }
if (j==0)
else
for (i=0; i }
// deleting redudant files
for (j=0, i=0; j }
if (i==0)
else
for (j=0; j }
return 0; }
_2,string型轉換為lpwstr
在textout中想直接輸出乙個string型不行,它引數非得是乙個lpwstr,解決的辦法是用multibytetowidechar,multibytetowidechar 函式可以把普通字串轉換為乙個寬字元字串(unicode)
long onpaint(hwnd hwnd,uint nmessage,wparam wparam,lparam lparam)
3,對上一節的**進行修改,加入乙個新的功能,使得能從選單呼出系統中的記事本
首先修改命令對映表
msgmap_entry _commandentries = ;
再新增乙個處理函式,在函式中建立乙個記事本程序:
long onnotebook(hwnd hwnd,uint nmessage,wparam wparam,lparam lparam)
return 0; }
4,新開乙個執行緒獲取系統時間
case idm_getsystime:
} break;
void readcurtime(void)
深入淺出MFC筆記
深入淺出mfc筆記 一 勿在浮砂築高台 1 並不是擴充套件名為 dll dynamic link library 的才是動態鏈結庫。事實上,exe dll fon mod drv 和.ocx 都是所謂的動態鏈結函式庫。2 windows 程式編譯時需要包含 windows.h 標頭檔案,若需要使用諸...
深入淺出MFC 卷首語
昨晚有點睡不著,想起還有些書還沒看完,於是,起床把 深入淺出mfc 看完了。看這本書斷斷續續也有乙個多月了,我看完之後的第一衝動是找本mfc應用的書來深入熟悉熟悉mfc。因為,看這本書的時候,才發現自己的mfc知識是那麼的貧乏,總有點力不從心的感覺,以至於很多東西都一看而過,根本進入不了思考的階段。...
深入淺出MFC 卷首語
昨晚有點睡不著,想起還有些書還沒看完,於是,起床把 深入淺出mfc 看完了。看這本書斷斷續續也有乙個多月了,我看完之後的第一衝動是找本mfc應用的書來深入熟悉熟悉mfc。因為,看這本書的時候,才發現自己的mfc知識是那麼的貧乏,總有點力不從心的感覺,以至於很多東西都一看而過,根本進入不了思考的階段。...