对CWnd类的模拟
来源:互联网 发布:mac mysql可视化界面 编辑:程序博客网 时间:2024/05/17 09:27
孙鑫用模拟CWnd类来说明类对象和窗口资源的关系: 通过m_hWnd来联系.
class CWnd
{
public:
CWnd()
{
m_hWnd=NULL;
}
BOOL CreateEx(
DWORD dwExStyle, // extended window style
LPCTSTR lpClassName, // pointer to registered class name
LPCTSTR lpWindowName, // pointer to 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, // handle to menu, or child-window identifier
HINSTANCE hInstance, // handle to application instance
LPVOID lpParam // pointer to window-creation data
);
BOOL ShowWindow(int nCmdShow);
BOOL UpdateWindow();
public:
HWND m_hWnd;
};
BOOL CWnd::CreateEx(
DWORD dwExStyle, // extended window style
LPCTSTR lpClassName, // pointer to registered class name
LPCTSTR lpWindowName, // pointer to 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, // handle to menu, or child-window identifier
HINSTANCE hInstance, // handle to application instance
LPVOID lpParam // pointer to window-creation data
)
{
m_hWnd=::CreateWindowEx(dwExStyle, lpClassName,lpWindowName, dwStyle,
x,y, nWidth,nHeight, hWndParent,hMenu, hInstance, lpParam );
if(m_hWnd)
return TRUE;
else
return FALSE;
}
BOOL CWnd::ShowWindow(int nCmdShow)
{
return ::ShowWindow(m_hWnd,nCmdShow);
}
BOOL CWnd:: UpdateWindow()
{
return ::UpdateWindow(m_hWnd);
}
int WINAPI WinMain( HINSTANCE hInstance, // handle to current instance HINSTANCE hPrevInstance, // handle to previous instance LPSTR lpCmdLine, // pointer to command line int nCmdShow // show state of window)
{
......
CWnd wnd;
wnd.CreateEx(...);
wnd.ShowWindow(SW_SHOWNORMAL);
wnd.UpdateWindow();
原来利用API的调拥
HWND hWnd;
hWnd=::CreateWindowEx(...);
::ShowWindow(hWnd,SW_SHOWNORMAL);
::UpdateWindow(hWnd);
.....
}
- 对CWnd类的模拟
- 模拟CWnd编写一个简单的窗口封装类
- 模拟CWnd编写一个简单的窗口封装类
- CWnd类的成员函数
- CWnd类
- CWnd 类
- CWnd类
- CWnd 类 和 CWindow类 的区别
- CWnd继承类事件的添加
- 一个CWnd子类化的类
- CWnd类与Windows窗口的关系-3、CWnd类如何封装Windows窗口
- 有趣的CWnd::WalkPreTranslateTree
- CWnd 、CWindow 的区别
- CWnd::WindowProc的理解
- CWnd 、CWindow 的区别
- CWnd::WindowProc的理解
- MFC窗口类CWnd
- CWND窗口类
- JAVA语言的BUG?
- Inside Sqlite翻译结果
- Symbian 多线程使用详解
- 态度决定一切
- 创建守护进程步骤
- 对CWnd类的模拟
- reactos操作系统实现(11)
- [VB.NET源码]会议记录系统sql2000三层开发
- 通宵
- 僵死进程
- [VB.NET源码]接收UDP广播
- [VB.NET源码]开发的WinCE下的串口通讯类
- [VB.NET源码]考试试题
- 用数组实现栈