#include <afxwin.h>
#include "resource1.h"
class MyDialog :public CDialog
{
public:
MyDialog() : CDialog(IDD_DIALOG1)
{
}
//初始化函数
BOOL OnInitDialog()
{
//设置对话框标题
//SetWindowText(L"顿开教育");
//HICON tb = ::LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_ICON1));
HICON tb = ::LoadIcon(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(IDI_ICON1));
//TURE表示设置大图标还是小图标,FALSE表示设置小图标还是大图标来着
SetIcon(tb,TRUE);
SetIcon(tb, FALSE);
//MFC封装了一个类
CString str = L"CPDD";
SetWindowText(str);
//cpoint类代表一个点
CPoint point(4,5);
//获得当前鼠标坐标
CPoint dq;
GetCursorPos(&dq);
CString str2;
str2.Format(L"当前鼠标位置X: %d ,Y: %d ",dq.x,dq.y);
SetWindowText(str2);
//代表一个大小,多宽,多高
CSize size(800,500);
//实践类
CTime time = CTime::GetCurrentTime();
int year = time.GetYear();
int month = time.GetMonth();
int day = time.GetDay();
int hour = time.GetHour();
int mintue = time.GetMinute();
int sec = time.GetSecond();
CString sj;
//sj.Format(L"当前时间:%d:%d:%d:%d:%d:%d",year,month,day,hour,mintue,sec);
sj = time.Format(L"当前时间:%Y:%m:%d:%H:%M:%S");
SetWindowText(sj);
//代表一个矩形区域
//四个点上下左右
CRect rect(10,10,10,10);
return TRUE;
}
};
class MFCFirstApp :public CWinApp
{
public:
//InitInstance 入口函数,MFC的初始化函数
//启动管理,初始化
BOOL InitInstance()
{
//MessageBox(NULL,L"MFC",L"TIPS", NULL);
MyDialog dlg;
dlg.DoModal();
return TRUE;
}
BOOL ExitInstance()
{
return 0;
}
};
MFCFirstApp firstapp;
MFC------初体验
最新推荐文章于 2024-08-09 12:15:18 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)