windows mobile下实现非全屏窗口显示

//切换到别的窗口再返回后,出现全屏显示的问题,已解决。初始化中代码将窗口居中显示。  
//实现方法:创建如下Dialog,继承它的Dialog都是非全屏窗口。  
 
NonFSDialog.h  
#pragma once  
 
// CNonFSDialog dialog  
class CNonFSDialog : public CDialog  
{  
DECLARE_DYNAMIC(CNonFSDialog)  
public:  
CNonFSDialog(UINT nIDTemplate,CWnd* pParent = NULL);   // standard constructor  
virtual ~CNonFSDialog();  
// Dialog Data  
enum { IDD = IDD_DIALOG_POPUP };  
protected:  
virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support  
DECLARE_MESSAGE_MAP()  
public:  
virtual BOOL OnInitDialog();  
afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection);  
};  
NonFSDialog.c  
// NonFSDialog.cpp : implementation file  
//  
#include "stdafx.h"  
#include "NonFSDialog.h"  
 
// CNonFSDialog dialog  
IMPLEMENT_DYNAMIC(CNonFSDialog, CDialog)  
CNonFSDialog::CNonFSDialog(UINT nIDTemplate,CWnd* pParent /*=NULL*/)  
: CDialog(/*CNonFSDialog::IDD*/nIDTemplate, pParent)  
{  
m_bFullScreen = FALSE; //文档中没有提到的  
}  
CNonFSDialog::~CNonFSDialog()  
{  
}  
void CNonFSDialog::DoDataExchange(CDataExchange* pDX)  
{  
CDialog::DoDataExchange(pDX);  
}  
 
BEGIN_MESSAGE_MAP(CNonFSDialog, CDialog)  
ON_WM_SETTINGCHANGE()  
END_MESSAGE_MAP()  
 
// CNonFSDialog message handlers  
BOOL CNonFSDialog::OnInitDialog()  
{  
CDialog::OnInitDialog();  
// TODO:  Add extra initialization here  
RECT Rect;  
this->GetWindowRect(&Rect);  
this->MoveWindow( (GetSystemMetrics(SM_CXSCREEN)-(Rect.right-Rect.left))/2,(GetSystemMetrics(SM_CYSCREEN)-(Rect.bottom-Rect.top))/2,Rect.right-Rect.left,Rect.bottom-Rect.top );  
return TRUE;  // return TRUE unless you set the focus to a control  
// EXCEPTION: OCX Property Pages should return FALSE  
}  
void CNonFSDialog::OnSettingChange(UINT uFlags, LPCTSTR lpszSection)  
{  
       //zhaozm del for 切换到别的窗口再返回后,popup全屏显示的问题。  
       //CDialog::OnSettingChange(uFlags, lpszSection);  
       // TODO: Add your message handler code here  
}  

 

你可能感兴趣的:(windows,exception,mobile,dialog,Constructor,initialization)