`
Z草履虫
  • 浏览: 17008 次
社区版块
存档分类
最新评论

VS2010开发MFC程序无法通过改变CREATESTRUCT结构来控制窗体大小的解决办法

    博客分类:
  • VC++
 
阅读更多

在使用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的程序框架剖析

    MFC程序的WinMain函数是通过调用AfxWinMain函数来完成它的功能的 注:Afx前缀的函数代表应用程序框架(Application Framework)函数,它们可以在程序的任何地方被调用 11、CTestApp::InitInstance函数 在AfxWinMain...

    用mfc编写的计算器

    制作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++ 知识库电子书

    Visual C++ 知识库电子书 VC 知识库文章 VC 知识库Faqs VC 知识库Tips VC++5.0是Microsoft新近推出的可视化C++集成开发环境。它在继承以前VC++的基础上增加了... //通过修改CREATESTRUCT结构来修改窗口类或风格

    面向对象程序设计课程设计报告 电子时钟

    在可视化程序设计中,建立了一个MFC单文档应用程序工程,该工程包括了视图类、文档类对话框类和主框架类。在主框架类中修改窗口等属性,使整个时间的显示更加协调。模拟电子时钟是一个显示和计时的小程序,因此只要...

    MFC_MDI_BUT_NO_DOC.7z

    创建没有Document的MFC MDI应用程序 在CMyTreeView中新增三个函数,显示些示例数据  virtual BOOL PreCreateWindow(CREATESTRUCT& cs);//本例没有使用该函数  afx_msg int OnCreate(LPCREATESTRUCT ...

    计算机图形学 种子填充算法 MFC、VC

    BOOL CMyView::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs return CView::PreCreateWindow(cs); } ////////////////////////...

    用c++和mfc写的单文档画正弦曲线

    BOOL CChildView::PreCreateWindow(CREATESTRUCT& cs) { if (!CWnd::PreCreateWindow(cs)) return FALSE; cs.dwExStyle |= WS_EX_CLIENTEDGE; cs.style &= ~WS_BORDER; cs.lpszClass = AfxRegisterWndClass...

    黑白棋mfc简单版

    BOOL CDrawView::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs return CView::PreCreateWindow(cs); } /////////////////////...

    aaa.rar_OnDestroy_PreTranslateMessage_childview opengl_onsize_vi

    这是用MFC编写的使用openGL的视口代码。 CChildView::CChildView()...void CChildView::OnSize( UINT nType, int cx, int cy ) 当窗口大小发生改变时重新设置OPenGL的视口参数。 void CChildView::OnDestroy() 销毁窗口

    VC之美化界面篇本文专题讨论VC中的界面美化,适用于具有中等VC水平的读者。读者最好具有以下VC基础:

    一般来说,应用程序可以通过以下两种途径来实现以上的方法: 1. 在父窗口里,截获自身的或者由子元素(包括控件和菜单等元素)传递的关于界面绘制的消息; 2. 子类化子元素,或者为子元素准备一个新的类(一般来说该...

    Visual C++课程设计案例精编(第二版) --第一章 系统信息程序的开发

    系统信息程序的开发片段: // MainFrm.cpp : implementation of the CMainFrame class // #include "stdafx.h" #include "sysinfo.h" #include "MainFrm.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_...

    cs 线段裁剪算法 MFC下实现

    BOOL CCSView::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs return CView::PreCreateWindow(cs); } ////////////////////////...

    Visual C++课程设计案例精编(第二版)--第十一章 画图软件的开发

    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_...

    vc++浏览器的原代码和步骤

    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;  ...

    AVI视频捕获.zip

    基于vfw的AVI视频捕获OOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs return CFrameWnd::PreCreateWindow(cs); }...

    图书馆管理系统 ODBC+ACCESS

    自己写的数据库大作业,用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); }

    贪食蛇.rar

    BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs ...

    深入了解VC++源代码3

    BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs ...

    ShapeReader

    完整的程序,可直接下载运行。 /************** MainFrm.h**************/ // MainFrm.h : CMainFrame 类的接口 // #pragma once #include "FileView.h" #include "ClassView.h" #include "OutputWnd.h" #include...

Global site tag (gtag.js) - Google Analytics