本文共 2880 字,大约阅读时间需要 9 分钟。
BOOL CStandardDialog::OnInitDialog()
{ CDialog::OnInitDialog(); DWORD dwStyle = ::GetWindowLong(m_hWnd, GWL_STYLE); VERIFY((dwStyle & WS_POPUP) != 0); VERIFY((dwStyle & WS_BORDER) == 0); VERIFY((dwStyle & WS_SIZEBOX) == 0); VERIFY((dwStyle & WS_DLGFRAME) == 0); m_brush.CreateSolidBrush(m_clrTransparent); DWORD dwExStyle = ::GetWindowLong(m_hWnd, GWL_EXSTYLE); VERIFY((dwExStyle & WS_EX_APPWINDOW) == 0); ::SetWindowLong(m_hWnd, GWL_EXSTYLE, dwExStyle | 0x80000); HMODULE hInst = LoadLibrary(_T("User32.DLL")); typedef BOOL (WINAPI *MYFUNC)(HWND, COLORREF, BYTE, DWORD); MYFUNC SetLayeredWindowAttributes = NULL; SetLayeredWindowAttributes = (MYFUNC)::GetProcAddress(hInst, "SetLayeredWindowAttributes"); SetLayeredWindowAttributes(GetSafeHwnd(), m_clrTransparent, 0, 1); ::FreeLibrary(hInst); m_ctrlProgress.SetRange(0,100); m_nMilliSecond=10; //UpdateData(FALSE); //UpdateData(TRUE); //GetDlgItem(IDOK)->SetWindowText(_T("正在更新")); m_btn2.SubclassDlgItem(IDOK,this); m_btn2.SetIcon(IDI_STAD); isWndDisable = GetDlgItem(IDOK)->EnableWindow(0); // GetDlgItem(IDCANCEL)->EnableWindow(0);//DISABLE CANCEL //m_btn.EnableWindow(0); //m_bmpBtn.LoadBitmaps(0,0,0,IDB_BIT_DSA);//,IDB_BMP_FOCUS,IDB_BMP_DISABLE //m_bmpBtn.SubclassDlgItem(IDOK , this); //m_bmpBtn.SizeToContent(); //m_bmpBtn2.LoadBitmaps(IDB_BMP_UP,IDB_BMP_DOWN,0,IDB_BMP_DSA);//,IDB_BMP_FOCUS,IDB_BMP_DISABLE //m_bmpBtn2.SubclassDlgItem(IDCANCEL , this); //m_bmpBtn2.SizeToContent(); //====================================================== Info.nMilliSecond=m_nMilliSecond; Info.pctrlProgress=&m_ctrlProgress; Info.pDlg = this; Info2.nMilliSecond=m_nMilliSecond; Info2.pctrlProgress=&m_ctrlProgress; Info2.pDlg = this; hThread2=CreateThread( //启动线程下载服务器版本到本地 NULL, 0, (LPTHREAD_START_ROUTINE)ThreadFunc2, &Info2, 0, &ThreadID2); return TRUE; }class kwFilePath : public CString
{ public: kwFilePath() { drive[0] = 0; dir[0] = 0; fname[0] = 0; ext[0] = 0; } BOOL Split( const char* pszPathName ){ _splitpath( pszPathName, drive, dir, fname, ext ); return TRUE; } BOOL MakeDirectoryForFile( const char* pszPathName ){ Split( pszPathName ); return TRUE; } const char* GetDrive(){ if( drive[0] ) return drive; return ""; } const char* GetDirectory(){ if( dir[0] ) return dir; return ""; } const char* GetFileName(){ if( fname[0] ) return fname; return ""; } const char* GetExt() { if( ext[0] ) return ext; return ""; } protected: char drive[_MAX_DRIVE]; char dir[_MAX_DIR]; char fname[_MAX_FNAME]; char ext[_MAX_EXT]; };struct threadInfo
{ UINT nMilliSecond; CProgressCtrl* pctrlProgress; CStandardDialog* pDlg; volatile bool bFinish; volatile unsigned _int64 dwCurSize; unsigned _int64 dwFileSize; //CHttpFile* pHttpFile; CString strFilePath; //CString strUrlFilePath; std::vector<CString> vecUrlFile; std::vector<CString> vecFile; }; UINT ThreadFunc(LPVOID lpParam); UINT ThreadFunc2(LPVOID lpParam); void DownList(void);转载地址:http://uvfci.baihongyu.com/