当前位置:网站首页>WTL第一个窗口
WTL第一个窗口
2022-07-16 19:19:00 【Len因为】
#include <iostream>
#include<atlbase.h>
#include<atlwin.h>
#include"resource.h"
//窗口样式
typedef CWinTraits<WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, WS_EX_APPWINDOW> MyTrais;
class MyWindow :
public CWindowImpl<MyWindow,CWindow,MyTrais>
{
public:
DECLARE_WND_CLASS(_T("My Class"));
BEGIN_MSG_MAP(MyWindow)
MESSAGE_HANDLER(WM_CLOSE,OnClose)
MESSAGE_HANDLER(WM_DESTROY,OnDestroy)
COMMAND_ID_HANDLER(IDR_ABOUT,OnAbout)
END_MSG_MAP()
LRESULT OnClose(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL bHandled)
{
DestroyWindow();
return 0;
}
LRESULT OnDestroy(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL bHandled)
{
PostQuitMessage(0);
return 0;
}
LRESULT OnAbout(UINT wNotifyCode, WORD wID, HWND hWndCtrl, BOOL& bHandled)
{
OutputDebugString(_T("OnAbou called!\r\n"));
return 0;
}
};
CComModule gModule;
int main()
{
HRESULT hRes = gModule.Init(NULL, GetModuleHandle(NULL));
if (hRes != 0)
{
std::cout << hRes << std::endl;
}
MyWindow win;
HWND hWnd = win.Create(NULL, CWindow::rcDefault, _T("MyWindow!"));
if (hWnd == NULL)
{
std::cout << "create window failed\r\n";
}
win.ShowWindow(SW_SHOW);
win.UpdateWindow();
MSG msg;
while (GetMessage(&msg, NULL, 0, 0) > 0)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
gModule.Term();
}边栏推荐
- conda 创建删除环境
- Application of Apache E7 series industrial computer minipicecan card in meal delivery robot
- MySQL variables, process control and cursor exercises
- CONDA installation requirements Txt specified dependent package
- Why is network security important in factories?
- 【C】动态内存管理
- LeetCode 第23天
- FreeSwitch的限流配置
- 阿普奇 ABOX-700 工控机 MinipiceCAN卡在电力巡检机器人中的应用
- LETV has become the king of anti involution: employees have lived a fairy life without 996!
猜你喜欢

Istio gray Publishing: deploy bookinfo microservice project

PyQt5-文件对话框(QFileDialog)

乐视成了反内卷之王:员工过上了没有996的神仙日子!

FreeSwitch的限流配置

What if win11 always pops up the input experience

AcWing 396. Solution to the problem of mine construction (tarjan cut point)

FreeSwitch的限流配置

Characteristics and usage of Ni MH battery (FDK Ni MH battery charging mechanism)

Inventory of major RPA products at home and abroad

星巴克、可口可乐、苹果这些顶级企业是如何进行品牌营销
随机推荐
Flutter 文字上下滚动切换 用于公告消息提示
如何制作选中项的下划线样式
MySQL notes: the latest tutorial of song Hongkang at site B (under continuous update)
Multithreaded operation list
升级版打榜活动再次火热袭来,放眼望去全是奖金
Characteristics and usage of Ni MH battery (FDK Ni MH battery charging mechanism)
Case study on how low code helps the new growth of non-standard retail business
基于分类分级的个人信息保护
Comparison and reference of collaborative office system (OA system) selection in 2022
New energy enterprises use low code development platform to build a new mode of digital management case analysis
Installing MySQL database on Linux server (detailed tutorial)
Caractéristiques et mode d'utilisation de la batterie ni MH (mécanisme de charge de la batterie ni MH FDK)
LeetCode 第23天
(笔记整理未完成)【图论:最小生成树】
Other new features of MySQL MySQL 8
低代码平台搭建学生事务一门式管理系统解决方案
Neutral energy optimization of transport layer triple handshake
[original] migration of rm500u-cn module driver
How to open 3D viewer in win11
阿普奇 E8 工控机——MinipiceCAN卡在建筑机器人的应用