資源簡介
開發(fā)環(huán)境基于vs2012 實現(xiàn)了計算器的簡單功能 此代碼是我在學習windows與C時做的 如果大家也在學習這門課 且沒什么思路可以 參考

代碼片段和文件信息
#include?“l(fā)ianzheng.h“
int?WINAPI?WinMain(HINSTANCE?hInstanceHINSTANCE?hprevinstanceLPSTR?lpCmdlineint?nCmdshow){
MSG?msg;?????????//消息
HWND?hwnd; ?//?窗口句柄?????
hIns=hInstance;
//判斷是否能夠正常注冊窗口
if(!Register(hInstance))
return?false;
//?創(chuàng)建窗口?
hwnd?=?Create(hInstance);
if(!hwnd)
return?false;
//顯示窗口
ShowWindow(?hwnd?nCmdshow?);?
????UpdateWindow(?hwnd?);?????????
//消息循環(huán)
???while(?GetMessage(?&msg?NULL?0?0)?)???
???{
??????TranslateMessage(?&msg?);?
??????DispatchMessage(?&msg?);??
???}
return?msg.wParam;
}
LRESULT?CALLBACK?WndProc(?HWND?hWnd?UINT?uMsg?WPARAM?wParam?LPARAM?lParam?)
{
??switch(?uMsg?)
??{???
??case?WM_CREATE:
//?激活并顯示模態(tài)對話框
DialogBox(hIns?MAKEINTRESOURCE(IDD_DIALOG1)?hWnd?DlgProc);
????//對話框結束?同時結束主窗口
????PostQuitMessage(0);
break;
???}
?return(?DefWindowProc(?hWnd?uMsg?wParam?lParam?)?);
??
}
//?模態(tài)對話框過程?---?顯示程序相關的消息
BOOL?CALLBACK?DlgProc?(HWND?hDlg?UINT?messageWPARAM?wParam?LPARAM?lParam)
{
//記錄輸入數(shù)據(jù)
static?CHAR?buffer[20];
//記錄文本域中獲取的文本數(shù)據(jù)
static?CHAR?in[20];
//操作數(shù)?operater3記錄復制結果
static?float?operater1operater2operater3;
//記錄?操作數(shù)個數(shù)
static?int?num=0;
//記錄結果
static?float?sum=0;
//運算標記?1?+?2?-?3?*?4?/
static?int?flag;
switch(message)
{
case?WM_INITDIALOG:
SetFocus(GetDlgItem(hDlg?IDC_EDIT1));?//?設置輸入焦點
break;
case?WM_COMMAND:
switch(LOWORD(wParam))
{
case?IDC_NUM0:
//將數(shù)據(jù)?放入到?buffer緩存中
sprintf(buffer“%s%d“buffer0);?
//更新文本域中文字
SetWindowTextA(GetDlgItem(hDlgIDC_EDIT1)buffer);
break;
case?IDC_NUM1:
//將數(shù)據(jù)?放入到?buffer緩存中
sprintf(buffer“%s%d“buffer1);
SetWindowTextA(GetDlgItem(hDlgIDC_EDIT1)buffer);
break;
case?IDC_NUM2:
//將數(shù)據(jù)?放入到?buffer緩存中
sprintf(buffer“%s%d“buffer2);
//更新文本域中文字
SetWindowTextA(GetDlgItem(hDlgIDC_EDIT1)buffer);
break;
case?IDC_NUM3:
//將數(shù)據(jù)?放入到?buffer緩存中
sprintf(buffer“%s%d“buffer3);
//更新文本域中文字
SetWindowTextA(GetDlgItem(hDlgIDC_EDIT1)buffer);
break;
case?IDC_NUM4:
//將數(shù)據(jù)?放入到?buffer緩存中
sprintf(buffer“%s%d“buffer4);
//更新文本域中文字
SetWindowTextA(GetDlgItem(hDlgIDC_EDIT1)buffer);
break;
case?IDC_NUM5:
//將數(shù)據(jù)?放入到?buffer緩存中
sprintf(buffer“%s%d“buffer5);
//更新文本域中文字
SetWindowTextA(GetDlgItem(hDlgIDC_EDIT1)buffer);
break;
case?IDC_NUM6:
//將數(shù)據(jù)?放入到?buffer緩存中
sprintf(buffer“%s%d“buffer6);
//更新文本域中文字
SetWindowTextA(GetDlgItem(hDlgIDC_EDIT1)buffer);
break;
case?IDC_NUM7:
//將數(shù)據(jù)?放入到?buffer緩存中
sprintf(buffer“%s%d“buffer7);
//更新文本域中文字
SetWindowTextA(GetDlgItem(hDlgIDC_EDIT1)buffer);
break;
case?IDC_NUM8:
//將數(shù)據(jù)?放入到?buffer緩存中
sprintf(buffer“%s%d“buffer8);
//更新文本域中文字
SetWindowTextA(GetDlgItem(hDlgIDC_EDIT1)buffer);
break;
case?IDC_NUM9:
//將數(shù)據(jù)?放入到?buffer緩存中
sprintf(buffer“%s%d“buffer9);
//更新文本域中文字
SetWindowTextA(GetDlgItem(hDlgIDC_EDIT1)
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???29097984??2017-04-20?19:28??count\count.sdf
?????文件????????882??2017-04-19?15:38??count\count.sln
????..A..H.?????22528??2017-04-20?19:28??count\count.v11.suo
?????文件???????4194??2017-04-19?15:54??count\count\count.vcxproj
?????文件???????1290??2017-04-19?15:54??count\count\count.vcxproj.filters
?????文件???????1862??2017-04-20?19:11??count\count\lianzheng.h
?????文件??????38660??2017-04-19?23:30??count\count\Resource.aps
?????文件???????2986??2017-04-20?13:36??count\count\resource.h
?????文件???????6510??2017-04-19?23:30??count\count\Resource.rc
?????文件???????6643??2017-04-20?19:27??count\count\源.cpp
?????文件????????690??2017-04-20?19:27??count\count\Debug\cl.command.1.tlog
?????文件??????18114??2017-04-20?19:27??count\count\Debug\CL.read.1.tlog
?????文件????????462??2017-04-20?19:27??count\count\Debug\CL.write.1.tlog
?????文件?????????91??2017-04-20?19:27??count\count\Debug\count.lastbuildstate
?????文件???????2771??2017-04-20?19:27??count\count\Debug\count.log
?????文件??????????2??2017-04-20?19:27??count\count\Debug\li
?????文件??????????2??2017-04-20?19:27??count\count\Debug\li
?????文件??????????2??2017-04-20?19:27??count\count\Debug\li
?????文件??????????2??2017-04-20?19:27??count\count\Debug\li
?????文件??????????2??2017-04-20?19:27??count\count\Debug\li
?????文件??????????2??2017-04-20?19:27??count\count\Debug\li
?????文件??????????2??2017-04-20?19:27??count\count\Debug\li
?????文件??????????2??2017-04-20?19:27??count\count\Debug\li
?????文件??????????2??2017-04-20?19:27??count\count\Debug\li
?????文件??????????2??2017-04-20?19:27??count\count\Debug\li
?????文件??????????2??2017-04-20?19:27??count\count\Debug\li
?????文件??????????2??2017-04-20?19:27??count\count\Debug\li
?????文件??????????2??2017-04-20?19:27??count\count\Debug\li
?????文件??????????2??2017-04-20?19:27??count\count\Debug\li
?????文件??????????2??2017-04-20?19:27??count\count\Debug\li
............此處省略69個文件信息
- 上一篇:winrar5.7無廣告版
- 下一篇:unity 畫畫, 直線,畫筆,橡皮擦,選色
評論
共有 條評論