一、窗口全屏显示,去掉任务栏
//全屏显示 //隐藏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!");
四、加载位图用LoadImage无效
HBITMAP hBitmap = (HBITMAP)::SHLoadDIBitmap(szBitmapFile);
五、要以共享MFC的DLL库的方式发布程序,须将如下目录中DLL全部复制到目标机器上。
C:\Program Files (x86)\Microsoft Visual Studio 8\VC\ce\Dll\armv4i
原文地址:http://9233403.blog.51cto.com/9223403/1972306