Freme 类中
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
{
// TODO: add member initialization code here
}
CMainFrame::~
CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -
1)
return -
1;
if (!m_wndToolBar.CreateEx(
this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE |
CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!
m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbarn");
return -
1;
// fail to create
}
if (!m_wndStatusBar.Create(
this) ||
!
m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/
sizeof(UINT)))
{
TRACE0("Failed to create status barn");
return -
1;
// fail to create
}
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&
amp;m_wndToolBar);
//
//用SetWindowLong 可以在窗口创建之后改变窗口属性
//让窗口标题可改变:
// SetWindowLong(m_hWnd,GWL_STYLE,WS_OVERLAPPEDWINDOW);
// SetWindowText("测试窗口");
//让窗口最大化按钮失效
//SetWindowLong(m_hWnd,GWL_STYLE,GetWindowLong(m_hWnd,GWL_STYLE)& ~WS_MAXIMIZEBOX);
//更改ICON图标
//SetClassLong(m_hWnd,GCL_HICON,(long)LoadIcon(NULL,IDI_ERROR));
return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT&
amp; cs)
{
if( !CFrameWnd::PreCreateWindow(cs <a href=
"http://www.leboudoirbydel.com/">reverse phone lookup email</a>
) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
/************************************************************************/
/* 如何改变窗体大小
CREATESTRUCT结构体内包含和窗口相关的一些数据,比如大小,标题,颜色等等
/************************************************************************/
// cs.cx = 500;
// cs.cy = 400;
//
// 如何改变窗体的标题
// 因为MFC创建的单文档程序的窗口类型默认为: WS_OVERLAPPEDWINDOW和FWS_ADDTOTITLE类型
// 而FWS_ADDTOTITLE 类型表示的是把文档标题放置到窗口之上,如果需要改变该窗口的标题。
// 需要把该类型从窗口类型中去掉,如下操作
//
// cs.style&= ~FWS_ADDTOTITLE;//方法1
// cs.style = WS_OVERLAPPED;// 方法2
// cs.lpszName = "风行";
//
//重新注册装口类,修改其资源。
//
/* WNDCLASS wndclass;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wndclass.hCursor = LoadCursor(NULL,IDC_CROSS);
wndclass.hIcon = LoadIcon(NULL,IDI_ERROR);
wndclass.hInstance = AfxGetInstanceHandle();
wndclass.lpfnWndProc = ::DefWindowProc;
wndclass.lpszClassName = "fengxing.me";
wndclass.lpszMenuName = NULL;
wndclass.style = CS_HREDRAW | CS_VREDRAW;
RegisterClass(&wndclass);
cs.lpszClass ="fengxing.me";
return TRUE;*/
}
View中:
BOOL CStyleView::PreCreateWindow(CREATESTRUCT&
amp; cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
//cs.lpszClass = "fengxing.me";
//AfxRegisterWndClass来重新构造窗口类信息。
// cs.lpszClass = AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW,
// LoadCursor(NULL,IDC_CROSS),(HBRUSH)GetStockObject(GRAY_BRUSH));
return CView::PreCreateWindow(cs);
}
转载于:https://www.cnblogs.com/luyuxibaby/p/5217476.html
相关资源:数据结构—成绩单生成器