window编程脉络
来源:互联网 发布:地史学知乎 编辑:程序博客网 时间:2024/04/29 03:29
windows应用程序编程是一种基于消息的编程。
一般创建一个窗口应用程序, 按以下步骤:
1. winmain函数是windows程序的入口函数。
int WINAPI WinMain( HINSTANCE hInstance, // handle to current instance HINSTANCE hPrevInstance, // handle to previous instance LPSTR lpCmdLine, // command line int nCmdShow // show state);
2. 创建窗口对象, 并初始化其成员函数。
typedef struct _WNDCLASS { UINT style; WNDPROC lpfnWndProc; int cbClsExtra; int cbWndExtra; HINSTANCE hInstance; HICON hIcon; HCURSOR hCursor; HBRUSH hbrBackground; LPCTSTR lpszMenuName; LPCTSTR lpszClassName; } WNDCLASS, *PWNDCLASS;
3. 注册窗口对象。
ATOM RegisterClass( CONST WNDCLASS *lpWndClass // class data);
4. 创建窗口。HWND CreateWindow( LPCTSTR lpClassName, // registered class name LPCTSTR lpWindowName, // window name DWORD dwStyle, // window style int x, // horizontal position of window int y, // vertical position of window int nWidth, // window width int nHeight, // window height HWND hWndParent, // handle to parent or owner window HMENU hMenu, // menu handle or child identifier HINSTANCE hInstance, // handle to application instance LPVOID lpParam // window-creation data);5. 显示更新窗口。BOOL ShowWindow( HWND hWnd, // handle to window int nCmdShow // show state);BOOL UpdateWindow( HWND hWnd // handle to window);
6.消息循环。BOOL GetMessage( LPMSG lpMsg, // message information HWND hWnd, // handle to window UINT wMsgFilterMin, // first message UINT wMsgFilterMax // last message);BOOL TranslateMessage( CONST MSG *lpMsg // message information);
LRESULT DispatchMessage( CONST MSG *lpmsg // message information);
如下一个win32的简单窗口应用程序:MFC-----Microsoft Foundation ClassesMFC编写win32应用程序基本脉络和上面是一样的。但是我们用Wizard新建程序时, Wizard都替我们把这些事情都做好了。我们只要基于它的框架进行修改和消息循环操作即可。MFC更能体现出面向对象的编程思维。如我们进行窗口应用程序编程时, 主要就是对窗口类的设计和操作。
- window编程脉络
- 服务端编程技术脉络梳理
- AI自动编程脉络梳理
- 以ExcelVBA的脉络为主线学习VBA编程
- 以ExcelVBA的脉络为主线学习VBA编程
- Window编程
- window编程问题
- X Window开发编程
- Window GINA 编程
- window编程学习总结
- window 核心编程
- window socket 编程
- window编程大师兼容性
- 多线程,window, 游戏编程,
- window核心编程--堆
- window编程一
- window网络编程
- 编程window服务
- 很久没写什么代码了
- Java报表软件定时器年报专题
- HTML文档中小meta标签的大作用
- 当你扛不住的时候就读一遍
- Every day to make meaning of their own future. . . . . .
- window编程脉络
- 手机有哪些智能操作系统
- FineReport十周年活动电子杂志正式发布
- 心情
- Extjs 使用icon属性添加图标 使用cls设置字体样式 使用iconCls设置图标宽高
- TMG logs
- 解决Windows自带NTFS加密(EFS)后打开文件乱码的问题
- 什么是IDOC及IDOC开发示例
- android LayoutInflater的使用