WTL Hello World
来源:互联网 发布:项目管理流程软件 编辑:程序博客网 时间:2024/06/05 22:53
构建最简单的WTL Hello World程序,基于:WTL91_5321_Final + VS2013 + WIN7
添加->新建项目
为了简单起见,我们删除一些button和对应的处理代码(一般我们只需要修改dialog对应的.h/.cpp代码)
MainDlg.h
// MainDlg.h : interface of the CMainDlg class///////////////////////////////////////////////////////////////////////////////#pragma onceclass CMainDlg : public CDialogImpl<CMainDlg>{public:enum { IDD = IDD_MAINDLG };BEGIN_MSG_MAP(CMainDlg)MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)COMMAND_ID_HANDLER(IDCANCEL, OnCancel)END_MSG_MAP()// Handler prototypes (uncomment arguments if needed)://LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)//LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)//LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);LRESULT OnCancel(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);};MainDlg.cpp
// MainDlg.cpp : implementation of the CMainDlg class///////////////////////////////////////////////////////////////////////////////#include "stdafx.h"#include "resource.h"#include "MainDlg.h"LRESULT CMainDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/){// center the dialog on the screenCenterWindow();// set iconsHICON hIcon = AtlLoadIconImage(IDR_MAINFRAME, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON));SetIcon(hIcon, TRUE);HICON hIconSmall = AtlLoadIconImage(IDR_MAINFRAME, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON));SetIcon(hIconSmall, FALSE);return TRUE;}LRESULT CMainDlg::OnCancel(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/){EndDialog(wID);return 0;}最初的运行样子:
我们新建一个Static Text
我们可以直接在Caption属性修改成我们想要的文字
或者在OnInitDialog编码实现:
CWindow wnd = this->GetDlgItem(IDC_STATIC);CStatic *pEdit = (CStatic*)&wnd;pEdit->SetWindowText(_T("Hello World"));
更改字体:
CFont font;font.CreatePointFont(16, TEXT("Arial"));CWindow wnd = this->GetDlgItem(IDC_STATIC);CStatic *pEdit = (CStatic*)&wnd;pEdit->SetFont(font);pEdit->SetWindowText(_T("Hello World"));
0 0
- WTL Hello World
- WTL学习笔记——(2)WTL Hello World !
- Hello World!【Hello World】
- Hello, world!
- Hello World!
- Hello world!
- Hello World!
- Hello World!
- hello world!
- Hello World !
- Hello,World!
- Hello World!
- Hello world!
- Hello World!
- Hello World
- Hello World
- Hello world
- Hello World!
- java连接SQL Server 2005数据库教程(手把手教程)
- SAP GUI740 PATCH10 下载
- HTML中>的含义
- 函数调用过程(详解)
- 十六进制转十进制
- WTL Hello World
- java运行jar类、scala运行jar类
- PHP关于金额数值的处理,number_format()与round()的使用
- 【51Nod算法马拉松18 A】染色问题
- java基础学习总结--操作符
- AFNetworking 3.0 源码解析之Reachability
- Xcode8上传应用包成功后,iTunes里不显示构建版本
- 移动端WebApp自适应实践
- 电路交换、报文交换和分组交换