duilib的一些bug
来源:互联网 发布:osi网络层 编辑:程序博客网 时间:2024/06/02 21:02
duilib是一个开源的界面库,我的一个软件--小妞会装机就是用它做界面库。小妞会装机这个软件界面比较简单,就用到了一些基本控件,所以用duilib是挺合适的。但是有个问题真是让人郁闷,那就是它的界面编辑器总是崩溃。看来duilib用的人还是很少,要不不会有这么多问题。我自己是不能忍受了,就把这个bug改了一下。本想将修复代码提交给duilib,但是申请加入duilib群没有成功。算了,贴在这儿吧。如果有人正遇到这个问题倒是可以做一个参考。
出问题的地方:
void CLayoutManager::TestForm(LPCTSTR pstrFile){CFormTestWnd* pFrame=new CFormTestWnd();CPaintManagerUI* pManager=new CPaintManagerUI();SIZE size=m_Manager.GetInitSize();pManager->SetInitSize(size.cx,size.cy);pManager->SetSizeBox(m_Manager.GetSizeBox());RECT rect=m_Manager.GetCaptionRect();if (rect.bottom==0){rect.bottom=30;}pManager->SetCaptionRect(rect);size=m_Manager.GetRoundCorner();pManager->SetRoundCorner(size.cx,size.cy);size=m_Manager.GetMinInfo();pManager->SetMinInfo(size.cx,size.cy);size=m_Manager.GetMaxInfo();pManager->SetMaxInfo(size.cx,size.cy);pManager->SetShowUpdateRect(m_Manager.IsShowUpdateRect());if( pFrame == NULL )return;g_HookAPI.EnableInvalidate(false);pFrame->SetManager(pManager);HWND h_wnd =pFrame->Create(m_Manager.GetPaintWindow(),_T("FormTest"),UI_WNDSTYLE_FRAME,0,0,0,size.cx,size.cy);// CControlUI* pRoot=CloneControls(GetForm()->GetItemAt(0));// 使用新建的XML树来预览,不会挂掉pManager->Init(h_wnd);CDialogBuilder builder;CContainerUI* pRoot=static_cast<CContainerUI*>(builder.Create(pstrFile,(UINT)0,NULL,pManager));if(pRoot==NULL)return;//pRoot->SetManager(NULL,NULL);pFrame->SetRoot(pRoot);pFrame->Init();pFrame->CenterWindow();HWND m_hWnd=pFrame->GetHWND();MSG msg = { 0 };while( ::IsWindow(m_hWnd) && ::GetMessage(&msg, NULL, 0, 0) ) {if( msg.hwnd != m_hWnd ) {if( (msg.message >= WM_MOUSEFIRST && msg.message <= WM_MOUSELAST) )continue;if( msg.message >= WM_KEYFIRST && msg.message <= WM_KEYLAST ) continue;if( msg.message == WM_SETCURSOR )continue;}if( !CPaintManagerUI::TranslateMessage(&msg) ) {::TranslateMessage(&msg);::DispatchMessage(&msg);}if( msg.message == WM_QUIT ) break;}if( msg.message == WM_QUIT ) ::PostQuitMessage(msg.wParam);g_HookAPI.EnableInvalidate(true);DeleteFile(pstrFile);}
改为
void CLayoutManager::TestForm(LPCTSTR pstrFile){CFormTestWnd* pFrame=new CFormTestWnd();CPaintManagerUI* pManager=new CPaintManagerUI();SIZE size=m_Manager.GetInitSize();pManager->SetInitSize(size.cx,size.cy);pManager->SetSizeBox(m_Manager.GetSizeBox());RECT rect=m_Manager.GetCaptionRect();if (rect.bottom==0){rect.bottom=30;}pManager->SetCaptionRect(rect);size=m_Manager.GetRoundCorner();pManager->SetRoundCorner(size.cx,size.cy);size=m_Manager.GetMinInfo();pManager->SetMinInfo(size.cx,size.cy);size=m_Manager.GetMaxInfo();pManager->SetMaxInfo(size.cx,size.cy);pManager->SetShowUpdateRect(m_Manager.IsShowUpdateRect());if( pFrame == NULL )return;g_HookAPI.EnableInvalidate(false);pFrame->SetManager(pManager);HWND h_wnd =pFrame->Create(m_Manager.GetPaintWindow(),_T("FormTest"),UI_WNDSTYLE_FRAME,0,0,0,size.cx,size.cy);// CControlUI* pRoot=CloneControls(GetForm()->GetItemAt(0));// 使用新建的XML树来预览,不会挂掉pManager->Init(h_wnd);CDialogBuilder builder;CContainerUI* pRoot=static_cast<CContainerUI*>(builder.Create(pstrFile,(UINT)0,NULL,pManager));if(pRoot==NULL)return;//pRoot->SetManager(NULL,NULL);pFrame->SetRoot(pRoot);pFrame->Init();pFrame->CenterWindow();// 修正win7下TestForm一开始没有反应,必须先激活其它程序在切换到TestFrom才有反应的bugpFrame->ShowModal();//HWND m_hWnd=pFrame->GetHWND();//MSG msg = { 0 };//while( ::IsWindow(m_hWnd) && ::GetMessage(&msg, NULL, 0, 0) ) {//if( msg.hwnd != m_hWnd ) {//if( (msg.message >= WM_MOUSEFIRST && msg.message <= WM_MOUSELAST) )//continue;//if( msg.message >= WM_KEYFIRST && msg.message <= WM_KEYLAST ) //continue;//if( msg.message == WM_SETCURSOR )//continue;//}//if( !CPaintManagerUI::TranslateMessage(&msg) ) {//::TranslateMessage(&msg);//::DispatchMessage(&msg);//}//if( msg.message == WM_QUIT ) break;//}//if( msg.message == WM_QUIT ) ::PostQuitMessage(msg.wParam);g_HookAPI.EnableInvalidate(true);DeleteFile(pstrFile);}
就好了
- duilib的一些bug
- Duilib的一些资料
- 使用Duilib的一些技术
- duilib-erp修正了Grid的bug
- DuiLib中CTileLayoutUI的一个bug
- 对DUILIB重构的一些看法
- Duilib 一些可能被忽略的问题
- Duilib 使用的一些记录-01
- Duilib Combo bug
- duilib进阶教程 -- Container控件的bug (14)
- duilib进阶教程 -- TreeView控件的bug (9)
- duilib进阶教程 -- Label控件的bug (8)
- 修复duilib库UISlider控件的4个bug
- duilib relativepos属性导致控件错误的bug修复
- duilib 修复CTreeViewUI复选功能判断不准确的bug
- duilib CDateTimeUI 在Xp下的bug修复
- Duilib界面库Capture系列的相关bug解决
- Duilib界面库Capture系列的相关bug解决
- 记录两个一问一答的在线编程题
- 语法练习(静态字段,文件读写)
- Adapter中getView的理解!
- shell 引号处理
- 打开和保存CFileDialog
- duilib的一些bug
- Google Tag Manager 入门指南
- Android拍照、录像、录音代码范例
- VS2010 如何缩减编译文件大小(statically linked MFC)
- 五大常用算法(二)动态规划
- IOS开发(51)之UITableView建立索引搜索
- 未来的竞争已不在行业中, 而是在行业外!!
- YUV420-RGB 以点的方式进行转换 原创by: GanYJ
- 内存映射修改大文件