#include "windows.h"LRESULT CALLBACK WindowProc(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);
MSG msg;
HWND hwnd;
HINSTANCE hInstance;
int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // command line
int nCmdShow // show state
)
{
WNDCLASSEX wndclassex;
wndclassex.cbClsExtra=0;
wndclassex.cbSize=sizeof(wndclassex);
wndclassex.cbWndExtra=0;
wndclassex.hbrBackground=(HBRUSH)GetStockObject(0);
wndclassex.hCursor=NULL;
wndclassex.hIcon=NULL;
wndclassex.hIconSm=NULL;
wndclassex.hInstance=hInstance;
wndclassex.lpfnWndProc=WindowProc;
wndclassex.lpszClassName="window";
wndclassex.style= CS_VREDRAW|CS_SAVEBITS;
RegisterClassEx(&wndclassex);
hwnd = CreateWindow(
"window", // name of window class
"Sample", // title-bar string
WS_OVERLAPPEDWINDOW, // top-level window
CW_USEDEFAULT, // default horizontal position
CW_USEDEFAULT, // default vertical position
CW_USEDEFAULT, // default width
CW_USEDEFAULT, // default height
hwnd, // no owner window
(HMENU) NULL, // use class menu
hInstance, // handle to application instance
(LPVOID) NULL); // no window-creation data
ShowWindow(hwnd,1);
UpdateWindow(hwnd); while (GetMessage(&msg, NULL, 0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam; return 0;
}LRESULT CALLBACK WindowProc(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
)
{
switch(uMsg)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_CLOSE:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
return 0;
}
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);
MSG msg;
HWND hwnd;
HINSTANCE hInstance;
int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // command line
int nCmdShow // show state
)
{
WNDCLASSEX wndclassex;
wndclassex.cbClsExtra=0;
wndclassex.cbSize=sizeof(wndclassex);
wndclassex.cbWndExtra=0;
wndclassex.hbrBackground=(HBRUSH)GetStockObject(0);
wndclassex.hCursor=NULL;
wndclassex.hIcon=NULL;
wndclassex.hIconSm=NULL;
wndclassex.hInstance=hInstance;
wndclassex.lpfnWndProc=WindowProc;
wndclassex.lpszClassName="window";
wndclassex.style= CS_VREDRAW|CS_SAVEBITS;
RegisterClassEx(&wndclassex);
hwnd = CreateWindow(
"window", // name of window class
"Sample", // title-bar string
WS_OVERLAPPEDWINDOW, // top-level window
CW_USEDEFAULT, // default horizontal position
CW_USEDEFAULT, // default vertical position
CW_USEDEFAULT, // default width
CW_USEDEFAULT, // default height
hwnd, // no owner window
(HMENU) NULL, // use class menu
hInstance, // handle to application instance
(LPVOID) NULL); // no window-creation data
ShowWindow(hwnd,1);
UpdateWindow(hwnd); while (GetMessage(&msg, NULL, 0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam; return 0;
}LRESULT CALLBACK WindowProc(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
)
{
switch(uMsg)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_CLOSE:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
return 0;
}
解决方案 »
- 请教 CRecordSet m_strFilter
- 如何在MFC中打开指定的TXT文件 急!!!
- VC6.0中如何扩展CHtmlView控件或者CWebBrowser控件才能使其支持html中的external对象?
- 当程序运行时会有啥消息吗?
- 如何使检查一个特定的文件夹下面哪些是新生成的文件
- 机器老重新启动会是什么问题?
- 如何让程序不得到焦点?(请高手们帮助小弟,不胜感激)
- 如何在主线程控制子线程得启动,挂起,唤醒,停止那?(对于用户界面线程)
- 一个字符串里面有16进制的颜色值,怎样把它以10进制取出来???
- 为何从www.microsoft.com/msj下载的TraceWin一加入到项目就出错(编译错误),有谁知道其用法?
- 请教用控件实现扑克牌序列的办法
- 在wtl使用CSplitterWindow分隔窗口,左边放入一个CTreeViewCtrl,请问这个树的消息映射怎么做?
wndclassex.lpszMenuName = NULL;