WINCE中的一些常用代码
2021-05-06 09:27
标签:mfc wince 一、窗口全屏显示,去掉任务栏 二、获取当前程序路径 三、加载字库 程序退出时,卸载字库 四、加载位图用LoadImage无效 五、要以共享MFC的DLL库的方式发布程序,须将如下目录中DLL全部复制到目标机器上。 WINCE中的一些常用代码 标签:mfc wince 原文地址:http://9233403.blog.51cto.com/9223403/1972306//全屏显示
//隐藏HHTaskBar窗口代码如下:
HWND hTaskBar = ::FindWindow(TEXT("HHTaskBar"), NULL);
if (hTaskBar != NULL)
{
::EnableWindow(hTaskBar, FALSE);
::ShowWindow(hTaskBar, SW_HIDE);
}
int iFullWidth = GetSystemMetrics(SM_CXSCREEN);
int iFullHeight = GetSystemMetrics(SM_CYSCREEN);
::SetWindowPos(this->m_hWnd, HWND_TOPMOST, 0, 0, iFullWidth, iFullHeight,
SWP_NOOWNERZORDER|SWP_SHOWWINDOW);
CString CscaleweightDlg::GetAppllicationPath()
{
WCHAR buff[255]={0};
::GetModuleFileName(0,buff,255);
CString strAppFullName;
strAppFullName.Format(_T("%s"),buff);
CString strAppPath = _T("");
strAppPath = strAppFullName.Left(strAppFullName.ReverseFind(‘\\‘)+1);
return strAppPath;
}
//加载字体
CString strFontPath = GetAppllicationPath()+_T("msyh.ttf");
if (NULL != AddFontResource(strFontPath))
{
::SendMessage( HWND_BROADCAST, WM_FONTCHANGE, 0, 0);
}
else
{
AfxMessageBox(L"字体加载失败");
}
CString strFontPath = GetAppllicationPath()+_T("msyh.ttf");
if(RemoveFontResource(strFontPath))
{
::SendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0);
}
else
AfxMessageBox(L"Failed to UNLOAD font!");
HBITMAP hBitmap = (HBITMAP)::SHLoadDIBitmap(szBitmapFile);
C:\Program Files (x86)\Microsoft Visual Studio 8\VC\ce\Dll\armv4i