一、窗口全屏顯示,去掉任務(wù)欄
成都創(chuàng)新互聯(lián)是一家集網(wǎng)站建設(shè),烏海企業(yè)網(wǎng)站建設(shè),烏海品牌網(wǎng)站建設(shè),網(wǎng)站定制,烏海網(wǎng)站建設(shè)報價,網(wǎng)絡(luò)營銷,網(wǎng)絡(luò)優(yōu)化,烏海網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強企業(yè)競爭力??沙浞譂M足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時我們時刻保持專業(yè)、時尚、前沿,時刻以成就客戶成長自我,堅持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實用型網(wǎng)站。//全屏顯示 //隱藏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);
二、獲取當(dāng)前程序路徑
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 = GetApplicationPath()+_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庫的方式發(fā)布程序,須將如下目錄中DLL全部復(fù)制到目標(biāo)機器上。
C:\Program Files (x86)\Microsoft Visual Studio 8\VC\ce\Dll\armv4i
六、wchar_t*轉(zhuǎn)char*
如,sCaption為 LPCTSTR類型字符串,要轉(zhuǎn)成char *字符串,如下:
int num = WideCharToMultiByte(CP_OEMCP, NULL, sCaption, -1, NULL, 0, NULL, FALSE); char *pChar = new char[num]; WideCharToMultiByte(CP_OEMCP, NULL, sCaption, -1, pChar, num, NULL, FALSE);
七、字體平滑,需要修改注冊表
HKEY_LOCAL_MACHINE\\System\\GDI\\ClearType Default=2
八、不關(guān)閉屏幕,常期顯示工作界面
//電源參數(shù)請求更新 HANDLE hevReloadActivityTimeouts = OpenEvent(EVENT_ALL_ACCESS, FALSE, _T("PowerManager/ReloadActivityTimeouts")); if (hevReloadActivityTimeouts) { SetEvent(hevReloadActivityTimeouts); CloseHandle(hevReloadActivityTimeouts); }
同時,在注冊表中也要修改超時設(shè)置。
九、Sqlite數(shù)據(jù)庫讀寫
void CSimpleModeData::TempTableWrite(CString CarNo,CString strWeight,CString GoodsName, CString Time) { CString str ; str.Format(_T("insert into SimpleModeTempTable(CarNo,GoodsName,Weight,Time)\ values('%s','%s','%s','%s')"),CarNo,strWeight,GoodsName, Time); TRACE(str); m_sqliteDB.execQuery(str); } BOOL CSimpleModeData::TempTableRead(CString strCarNo) { CString str ; str.Format(_T("select * from SimpleModeTempTable where CarNo = '%s'")); TRACE(str); CppSQLite3Query query = m_sqliteDB.execQuery(str); if(!query.eof()) { wcscpy_s(CGlobal::g_TempTable.CarNo,20,query.fieldValue(1)); wcscpy_s(CGlobal::g_TempTable.GoodsName,20 ,query.fieldValue(2)); wcscpy_s(CGlobal::g_TempTable.Weight,20,query.fieldValue(3)); return TRUE; } query.finalize(); return FALSE; }
十、軟件重啟
#include "windows.h" #include "winioctl.h" #define POWER_STATE_RESET (DWORD)(0x00800000) #define POWER_FORCE (DWORD)(0x00001000) extern "C" __declspec(dllimport) DWORD SetSystemPowerState(LPCWSTR pwsSystemState, DWORD StateFlags,DWORD Options); void CtestDlg::OnBnClickedButton2() { SetSystemPowerState(NULL, POWER_STATE_RESET, POWER_FORCE); }
十一、字符串轉(zhuǎn)浮點數(shù)
_tstof在WinCE中未實現(xiàn),需要自己實現(xiàn)。如果轉(zhuǎn)成double型可以如下:
double StringToDouble(LPCTSTR lpszSrc) { TCHAR * endptr; return _tcstod(lpszSrc, &endptr); }
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機、免備案服務(wù)器”等云主機租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。