在使用VS1020中的VC++开发SDI程序的时候发现仅修改
BOOL CXX::PreCreateWindow(CREATESTRUCT& cs)
方法中CREATESTRUCT结构,如:
cs.x = 300;
cs.y = 200;
cs.cx = 600;
cs.cy = 400;
cs.lpszName = _T("测试程序");
cs.style = WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX;
是不能够得到想要的窗体大小的.
解决方法:
修改程序的App类中的ExitInstance方法,添加如下语句:
CleanState();//清除程序在注册表写入的状态信息
这个方法一般在以项目名称命名的.cpp文件中
得到如下:
int CXXApp::ExitInstance()
{
//TODO: 处理可能已添加的附加资源
AfxOleTerm(FALSE);
CleanState();//清除程序在注册表写入的状态信息
return CWinAppEx::ExitInstance();
}
即可
分享到:
相关推荐
MFC程序的WinMain函数是通过调用AfxWinMain函数来完成它的功能的 注:Afx前缀的函数代表应用程序框架(Application Framework)函数,它们可以在程序的任何地方被调用 11、CTestApp::InitInstance函数 在AfxWinMain...
制作mfc的计算器 BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; // TODO: Modify the Window class or styles here by modifying // the ...
Visual C++ 知识库电子书 VC 知识库文章 VC 知识库Faqs VC 知识库Tips VC++5.0是Microsoft新近推出的可视化C++集成开发环境。它在继承以前VC++的基础上增加了... //通过修改CREATESTRUCT结构来修改窗口类或风格
在可视化程序设计中,建立了一个MFC单文档应用程序工程,该工程包括了视图类、文档类对话框类和主框架类。在主框架类中修改窗口等属性,使整个时间的显示更加协调。模拟电子时钟是一个显示和计时的小程序,因此只要...
创建没有Document的MFC MDI应用程序 在CMyTreeView中新增三个函数,显示些示例数据 virtual BOOL PreCreateWindow(CREATESTRUCT& cs);//本例没有使用该函数 afx_msg int OnCreate(LPCREATESTRUCT ...
BOOL CMyView::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs return CView::PreCreateWindow(cs); } ////////////////////////...
BOOL CChildView::PreCreateWindow(CREATESTRUCT& cs) { if (!CWnd::PreCreateWindow(cs)) return FALSE; cs.dwExStyle |= WS_EX_CLIENTEDGE; cs.style &= ~WS_BORDER; cs.lpszClass = AfxRegisterWndClass...
BOOL CDrawView::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs return CView::PreCreateWindow(cs); } /////////////////////...
这是用MFC编写的使用openGL的视口代码。 CChildView::CChildView()...void CChildView::OnSize( UINT nType, int cx, int cy ) 当窗口大小发生改变时重新设置OPenGL的视口参数。 void CChildView::OnDestroy() 销毁窗口
一般来说,应用程序可以通过以下两种途径来实现以上的方法: 1. 在父窗口里,截获自身的或者由子元素(包括控件和菜单等元素)传递的关于界面绘制的消息; 2. 子类化子元素,或者为子元素准备一个新的类(一般来说该...
系统信息程序的开发片段: // MainFrm.cpp : implementation of the CMainFrame class // #include "stdafx.h" #include "sysinfo.h" #include "MainFrm.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_...
BOOL CCSView::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs return CView::PreCreateWindow(cs); } ////////////////////////...
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs cs.style = WS_CHILD | WS_VISIBLE | WS_OVERLAPPED | WS_...
BOOL CLeftView::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying the CREATESTRUCT cs cs.style |= TVS_HASBUTTONS | TVS_LINESATROOT | TVS_HASLINES; ...
基于vfw的AVI视频捕获OOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs return CFrameWnd::PreCreateWindow(cs); }...
自己写的数据库大作业,用MFC ODBC +access 写的 内含完整工程,解压后就能用 // MainFrm.cpp : implementation of the CMainFrame class // #include "stdafx.h" #include "ODBCdemo.h" #include "MainFrm.h" #...
种子法扫描EGIN_MESSAGE_MAP...BOOL CTView::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs return CView::PreCreateWindow(cs); }
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs ...
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs ...
完整的程序,可直接下载运行。 /************** MainFrm.h**************/ // MainFrm.h : CMainFrame 类的接口 // #pragma once #include "FileView.h" #include "ClassView.h" #include "OutputWnd.h" #include...