c#編寫的番茄鐘倒計時器代碼。本站提示廣大學習愛好者:(c#編寫的番茄鐘倒計時器代碼)文章只能為提供參考,不一定能成為您想要的結果。以下是c#編寫的番茄鐘倒計時器代碼正文
/*
一個簡略的win32窗口挪用
*/
#include<Windows.h>
#include<tchar.h>
//聲明窗口函數
LRESULT CALLBACK WindowProc(HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lparam
);
int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInatance,
LPSTR lpCmdLine,
int nCmdShow
)
{
WNDCLASS wndclass;
wndclass.lpfnWndProc=WindowProc;
wndclass.cbClsExtra=0;
wndclass.cbWndExtra=0;
wndclass.style=CS_HREDRAW|CS_VREDRAW;
wndclass.lpszClassName=_T("我的窗體");
wndclass.hInstance=hInstance;
wndclass.hCursor=LoadCursor(NULL,IDC_ARROW);
wndclass.hIcon=0;
wndclass.hbrBackground=(HBRUSH)(COLOR_WINDOW+1);
wndclass.lpszMenuName=0;
//注冊窗口類
if(RegisterClass(&wndclass)==0)
{
MessageBox(0,_T("注冊窗口類掉敗"),_T("我的窗體"),MB_OK);
return 0;
}
//創立窗話柄列
HWND hWnd = CreateWindow(_T("我的窗體"),_T("我的第一個窗體"),WS_OVERLAPPEDWINDOW,100,100,500,400,0,0,hInstance,0);
//顯示和更新窗口
ShowWindow(hWnd,SW_SHOW);
UpdateWindow(hWnd);
//新聞輪回
MSG msg;
while(GetMessage(&msg,0,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
//界說窗口函數
LRESULT CALLBACK WindowProc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM IParam
)
{
switch(uMsg)
{
case WM_CLOSE:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd,uMsg,wParam,IParam);
}
return 0;
}