关于wince中的全屏显示

1. 在WinCe下如何让程序全屏

;修改任务栏

[HKEY_LOCAL_MACHINESoftwareMicrosoftShellAutoHide]

"Default"=dword:1

[HKEY_LOCAL_MACHINESoftwareMicrosoftClock]

"SHOW_CLOCK"=dword:0

[HKEY_LOCAL_MACHINESoftwareMicrosoftShellOnTop]

"Default"=dword:0

或者:

1 将dialog属性中的styles的title bar去掉

2 在dialog初始化时加入:

int iFullWidth = GetSystemMetrics(SM_CXSCREEN);

int iFullHeight = GetSystemMetrics(SM_CYSCREEN);

::SetWindowPos(this->m_hWnd, HWND_TOPMOST, 0, 0, iFullWidth, iFullHeight, SWP_NOOWNERZORDER|SWP_SHOWWINDOW);

 

2. 对于Pocket PC,也有类似的方法

MFC PocketPC应用程序全屏方法

基于对话框的MFC PocketPC应用程序全屏方法

1.需要将整个窗口向上平移26个像素以到达屏幕顶部,同时使用SHFullScreen()函数隐藏任务栏;

  在OnInitDialog()函数中添加如下语句

  RECT rc;

GetWindowRect(&rc);

rc.top-=26

MoveWindow(rc.left,rc.top,rc.right,rc.bottom,FALSE); //上移26像素

SHFullScreen(this->m_hWnd,SHFS_HIDETASKBAR); //隐藏任务栏

 

2.防止使用Input Panel时任务栏出现

  说明,依据MSDN,在Input Panel活动时会发送WM_SETTING_CHANGE和WM_ACTIVATE两个消息。需要手工接管两个消息的处理保持全屏。

  MFC类中,CDialog类由CWnd类直接派生,所以这里可以直接手工添加函数。

  在主程序的对话框类*Dlg.h头文件中这个位置,加入这两项(声明这两个函数):

  // Implementation:

   protected:e:

        HICON m_hIcon;

// Generated message map functions

//{{AFX_MSG(CFullScreenDialogDlg)

 virtual BOOL OnInitDialog();

 virtual void OnSettingChange();  =====================================>1

afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);  =========>2

 //}}AFX_MSG

DECLARE_MESSAGE_MAP()

  在主程序的对话框类*Dlg.cpp实现文件中做如下修改::

 (1)在消息映射处加入

BEGIN_MESSAGE_MAP(CFullScreenDialogDlg, CDialog)

 //{{AFX_MSG_MAP(CFullScreenDialogDlg)

ON_WM_SETTINGCHANGE()  ========================================>1

ON_WM_ACTIVATE()  ============================================>2

 //}}AFX_MSG_MAP

  END_MESSAGE_MAP()

 

  手工添加这两个函数:

  void CFullScreenDialogDlg::OnSettingChange()

  {

 }

 

void CFullScreenDialogDlg::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)

{

CWnd::OnActivate(nState, pWndOther, bMinimized);  //注意这里从CWnd继承        

SHFullScreen( this->m_hWnd, SHFS_HIDETASKBAR);//\D*k/a-@!O:n ~

 

=======================================================

wince中不使用SHFullScreen的全屏方法
2008-07-22 12:53

Introduction

The usual method of creating a full screen window in Windows CE involves using the function SHFullScreen. This article describes a method of creating full screen windows with standard window management calls.

The Variables

HWND hWnd;                     // The main window handle

HWND hWndInputPanel = NULL;    // The SIP
HWND hWndTaskBar    = NULL;    // The TaskBar
HWND hWndSipButton  = NULL;    // The SIP Button

BOOL mode = false;             // Our current window mode.  
                               //  True = Fullscreen
                               //  False - Windowed (Startup Default)

Finding the Window Information

The first step is to find the handles of the three main windows that handle the TaskBar, Standard Input Panel (SIP) and SIP Button Bar. This should be done early on in the application during initialization.

void InitFullScreen (void)
{
    hWndInputPanel = FindWindow(TEXT("SipWndClass"), NULL);
    hWndSipButton = FindWindow(TEXT("MS_SIPBUTTON"), NULL);
    hWndTaskBar = FindWindow(TEXT("HHTaskBar"), NULL);
}

Toggling Between The Two Modes

Toggling between the two modes is a simple matter of setting the windows states, and sizing our window appropriately.

To Enter Fullscreen mode we use ShowWindow(HWND,SW_HIDE) on each of the system windows.

To Exit Fullscreen mode we use ShowWindow(HWND,SW_SHOW) on each of the system windows. This will however also show the input panel, which is not desirable, so hWndInputPanel should be ignored.

Sizing the window to the correct size involves a different system call depending on whether you are entering or exiting Fullscreen Mode.

Entering Fullscreen mode we call SetWindowPos(hWnd... using the results from a GetSystemMetrics call.

Exiting Fullscreen mode we call SetWindowPos(hWnd... using the results from a SystemParametersInfo(... call.

void ToggleFullScreen()
{
    RECT rtDesktop;

    if (mode)
    {
        if(hWndTaskBar != NULL)        
        ShowWindow(hWndTaskBar, SW_SHOW);
        //if(hWndInputPanel != NULL)    
        ShowWindow(hWndInputPanel, SW_SHOW);
        //Never forcibly show the input panel
        if(hWndSipButton != NULL)    
        ShowWindow(hWndSipButton, SW_SHOW);

        if(SystemParametersInfo(SPI_GETWORKAREA, 0, &rtDesktop, NULL) == 1)
            SetWindowPos(hWnd,HWND_TOPMOST,0,0,rtDesktop.right - 
        rtDesktop.left,rtDesktop.bottom - rtDesktop.top, SWP_SHOWWINDOW);

        mode = false;
    }
    else
    {
        if (hWndTaskBar != NULL)    ShowWindow(hWndTaskBar, SW_HIDE);
        if (hWndInputPanel != NULL)    ShowWindow(hWndInputPanel, SW_HIDE);
        if (hWndSipButton != NULL)    ShowWindow(hWndSipButton, SW_HIDE);

        SetWindowPos(hWnd,HWND_TOPMOST,0,0,GetSystemMetrics(SM_CXSCREEN),
                GetSystemMetrics(SM_CYSCREEN), SWP_SHOWWINDOW);

        mode = true;
    }
}

 

posted @ 2009-04-18 18:01  Scorpio_逸尘  阅读(6508)  评论(0编辑  收藏  举报