Windows Mobile Phone全屏开发
来源:互联网 发布:vb菜单内缩符号是什么 编辑:程序博客网 时间:2024/05/07 12:21
一般来讲,通过函数SHFullScreen就可以实现,如通过如下调用SHFullScreen(hWnd, SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON | SHFS_HIDESTARTICON)即可实现,但有一个注意点,如果你的窗口里有MENU Bar 的话,则需要在全屏幕的时候隐藏MENU Bar可以调用SHGetMenuBar()来获取MENU的句柄,这里不能直接将HMENU用CAST成HWND,然后再使用ShowWindow(hWndMenu, SW_HIDE)来隐藏Menu。这样就是全屏的窗口了,返回非全屏模式,也是调用SHFullScreen()来实现,只是把里面的标志位置换成SHOW的就好。下面是例子代码:
BOOL rb;
BOOL chgScreen;
int rc;
RECT rect;
HWND hWnd;
rb = SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0);
if (rb == FALSE) // SystemParametersInfo failed.
{
rc = MessageBox(NULL, _T("Could not get work area."),
_T("Error"), MB_OK);
if (rc == 0) // Not enough memory to create MessageBox.
return E_OUTOFMEMORY;
return E_FAIL; // Replace with specific error handling.
}
hWnd = CreateWindow(szWindowClass, szTitle, WS_VISIBLE,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
if (hWnd == NULL)// CreateWindow failed.
{
rc = MessageBox(NULL, _T("Could not create main window."),
_T("Error"), MB_OK);
if (rc == 0) // Not enough memory to create MessageBox.
return E_OUTOFMEMORY;
return E_FAIL; // Replace with specific error handling.
}
GetWindowRect(hWnd, &rect);
chgScreen = SHFullScreen(hWnd, SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON |
SHFS_HIDESTARTICON);
if (chgScreen == FALSE);
{
// SHFullScreen failed.
rc = MessageBox(NULL, _T("Could not modify the window."),
_T("Error"), MB_OK);
if (rc == 0) // Not enough memory to create MessageBox.
return E_OUTOFMEMORY;
return E_FAIL; // Replace with specific error handling.
}
MoveWindow( hWnd,
rect.left,
rect.top - MENU_HEIGHT,
rect.right,
rect.bottom + MENU_HEIGHT,
TRUE);复制代码我的应用程序需要在运行时全屏化,所以使用SHFullScreen来实现,不过我发现总是一个输入法栏无法隐藏,请参见附件中的截图,不知是何故。我的运行平台为Windows Mobile 5.0 ppc,代码如下:
BOOL CTestDlg::OnInitDialog()
{
........
DWORD dwState = ( SHFS_HIDETASKBAR | SHFS_HIDESTARTICON | SHFS_HIDESIPBUTTON );
SHFullScreen( m_hWnd, dwState );
CRect rc;
SetRect( &rc, 0, 0, GetSystemMetrics( SM_CXSCREEN ),
GetSystemMetrics( SM_CYSCREEN ) );
MoveWindow( &rc, TRUE );
.........
}
BOOL rb;
BOOL chgScreen;
int rc;
RECT rect;
HWND hWnd;
rb = SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0);
if (rb == FALSE) // SystemParametersInfo failed.
{
rc = MessageBox(NULL, _T("Could not get work area."),
_T("Error"), MB_OK);
if (rc == 0) // Not enough memory to create MessageBox.
return E_OUTOFMEMORY;
return E_FAIL; // Replace with specific error handling.
}
hWnd = CreateWindow(szWindowClass, szTitle, WS_VISIBLE,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
if (hWnd == NULL)// CreateWindow failed.
{
rc = MessageBox(NULL, _T("Could not create main window."),
_T("Error"), MB_OK);
if (rc == 0) // Not enough memory to create MessageBox.
return E_OUTOFMEMORY;
return E_FAIL; // Replace with specific error handling.
}
GetWindowRect(hWnd, &rect);
chgScreen = SHFullScreen(hWnd, SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON |
SHFS_HIDESTARTICON);
if (chgScreen == FALSE);
{
// SHFullScreen failed.
rc = MessageBox(NULL, _T("Could not modify the window."),
_T("Error"), MB_OK);
if (rc == 0) // Not enough memory to create MessageBox.
return E_OUTOFMEMORY;
return E_FAIL; // Replace with specific error handling.
}
MoveWindow( hWnd,
rect.left,
rect.top - MENU_HEIGHT,
rect.right,
rect.bottom + MENU_HEIGHT,
TRUE);
- //隐藏任务栏
- HWND lpClassName;
- lpClassName = ::FindWindow(TEXT("HHTaskBar"), NULL);
- ::ShowWindow(lpClassName, SW_HIDE);
BOOL CTestDlg::OnInitDialog()
{
........
DWORD dwState = ( SHFS_HIDETASKBAR | SHFS_HIDESTARTICON | SHFS_HIDESIPBUTTON );
SHFullScreen( m_hWnd, dwState );
CRect rc;
SetRect( &rc, 0, 0, GetSystemMetrics( SM_CXSCREEN ),
GetSystemMetrics( SM_CYSCREEN ) );
MoveWindow( &rc, TRUE );
.........
}
http://bbs.koxo.cn/thread-28390-1-1.html
- Windows Mobile Phone全屏开发
- Windows Phone 开发 设置屏幕方向 & 全屏
- [Windows Mobile]全屏对话框
- [Windows Mobile]全屏对话框
- Windows Mobile 窗口全屏
- windows mobile 全屏代码
- [Windows Mobile]全屏对话框
- windows mobile全屏
- Windows Mobile 6(Smart Phone)开发基础
- Windows Mobile 6 (Smart Phone)开发基础
- Windows Mobile 6 (Smart Phone)开发基础
- Windows Mobile程序全屏与非全屏
- Windows Mobile窗口全屏总结
- Windows Mobile窗口全屏总结
- Windows Mobile窗口全屏总结
- Windows Mobile窗口全屏总结
- Windows Mobile窗口全屏总结(zhuan)
- [Windows Phone] Windows Phone开发环境搭建
- VC++动态链接库编程之DLL典型实例(转)
- 使用Timer
- SQL性能调校命令
- webservice的开发流程
- zz可以让你少奋斗十年的工作经验
- Windows Mobile Phone全屏开发
- j2me程序移植入android总结
- 一个经典的 JAVA ME 手机程序入门级源码
- 我们的去处
- excel||单元格自定义,个性的追求
- 水煮互联网创业,互联网创业的盲区
- 使用java线程扫描局域网ip简单方案
- jJavaScript 数组
- 东莞打工作家 郑小琼《铁.塑料厂》