예제 #1
0
파일: BassMusic.cpp 프로젝트: 3rdexp/soui
int CBassMusicEngine::ShowError( LPCTSTR lpError )
{
	CString StrError;
	StrError.Format(TEXT("%s 错误码: %d"),lpError,BASS_ErrorGetCode());

	//return AfxMessageBox(StrError);
	return SMessageBox(NULL,StrError,_T("警告"),MB_OK|MB_ICONEXCLAMATION);	
}
예제 #2
0
파일: MainDlg.cpp 프로젝트: FuckGOV/soui
void CMainDlg::OnBtnClick_Project_File_Add()
{
	CNewFileDlg dlg(this);
	if(!m_strPrjPath.IsEmpty() && IDOK==dlg.DoModal())
	{
		xml_document xmlDoc;
		if(!xmlDoc.load_file(m_strPrjIndex)) return;
        xml_node xmlRoot = xmlDoc.child(L"resource");
        if(!xmlRoot)
        {
            return;
        }
        xml_node xmlType=xmlRoot.child(S_CT2W(dlg.m_strResType));
        xml_node xmlNode=xmlType.child(L"file");
        SStringW strName = S_CT2W(dlg.m_strResName);
        while(xmlNode)
        {
            if(xmlNode.attribute(L"name").value() == strName)
            {
                break;
            }
            xmlNode = xmlNode.next_sibling(L"file");
        }
        if(xmlNode)
        {//检查type,name重复
            SMessageBox(GetActiveWindow(),_T("指定的资源名重复"),_T("错误"),MB_OK|MB_ICONSTOP);
            return;
        }

		BuildFilePath(m_strPrjPath,dlg.m_strResPath,FALSE);
		CopyFile(dlg.m_strSrcFile,m_strPrjPath+_T("\\")+dlg.m_strResPath,FALSE);
		//改写XML文件
        
        if(!xmlType)
        {
            xmlType = xmlRoot.append_child(S_CT2W(dlg.m_strResType));
        }
        xmlNode = xmlType.append_child(L"file");
		xmlNode.append_attribute(L"name").set_value(S_CT2W(dlg.m_strResName));
		xmlNode.append_attribute(L"path").set_value(S_CT2W(dlg.m_strResPath));

		FILE *f=_tfopen(m_strPrjIndex,_T("wb"));
		if(f)
		{
			xml_writer_file xmlfile(f);
 			xmlDoc.print(xmlfile);
			fclose(f);
 			OpenProject(m_strPrjIndex);			
		}

	}
}
예제 #3
0
void SDesktopDock::OnLButtonUp(UINT nFlags, CPoint point)
{
	for (int i=0; i<MAX_COUNT; i++)
	{
		if (m_RTRect[i].PtInRect(point))
		{
			SMessageBox(NULL,SStringT().Format(_T("索引===%d号"),i),_T("多点WIFI"),MB_OK);

			ShellExecute(NULL, _T("open"),adUrls[i], NULL, NULL, SW_SHOWNORMAL);
			return ;
		}
	}
}
예제 #4
0
void CMusicOpreat::InitDatas()
{
	//初始化声音组件
	m_pBassMusic = CBassMusicEngine::GetInstance();
	if ( m_pBassMusic == NULL )
	{
		if ( SMessageBox(NULL,TEXT("声音引擎初始化失败"),_T("警告"),MB_OK|MB_ICONEXCLAMATION) == IDOK )
		{
			PostQuitMessage(0);
		}
	}
	m_pBassMusic->Init(m_hWnd,this);

}
예제 #5
0
파일: MainWnd.cpp 프로젝트: ming-hai/soui
void CMainWnd::OnBtnOpen()	//打开文件
{
	CFileDialogEx openDlg(TRUE,_T("mp4"),0, OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_ALLOWMULTISELECT,_T("视频文件(*.mp4)\0*.mp4\0All files (*.*)\0*.*\0\0"));
	if(openDlg.DoModal()==IDOK)
		//SMessageBox(NULL,_T("OnBtnOpen"),_T("haha"),MB_OK|MB_ICONEXCLAMATION);
	{
		TCHAR szPath[MAX_PATH];  
		TCHAR szFileName[80 * MAX_PATH];  

		TCHAR * p;  
		int nLen = 0; 

		lstrcpyn(szPath, szFileName, openDlg.m_ofn.nFileOffset);  

		szPath[openDlg.m_ofn.nFileOffset] = '\0';  
		nLen = lstrlen(szPath);  

		if( szPath[nLen - 1] != '\\' )
		{  
			lstrcat(szPath, TEXT("\\"));  
		}  
		//p = szFile + openDlg.m_ofn.nFileOffset; //把指针移到第一个文件  
		p = szFileName + openDlg.m_ofn.nFileOffset; //把指针移到第一个文件
		int sum=0;
		while( *p )  
		{    
			ZeroMemory(szFileName, sizeof(szFileName)); 
			lstrcat(szFileName, szPath);  //给文件名加上路径    
			lstrcat(szFileName, p);    //加上文件名

			//std::wstring file_name = szFileName;
			char* file_name=THCAR2char(szFileName);

			p += lstrlen(p) +1;     //移至下一个文件  
			sum++;
			//cout<<file_name<<endl ;
			lstrcat(szFileName, TEXT("\n")); //换行
			//STRACE("%s",szFileName);
		}
		printf("%d",sum);
		SMessageBox(NULL, szFileName, TEXT("MultiSelect"), MB_OK);
	}
}
예제 #6
0
void SDesktopDock::OnLButtonUp(UINT nFlags, CPoint point)
{
	for (int i=0; i<MAX_COUNT; i++)
	{
		if (m_RTRect[i].PtInRect(point))
		{
			TCHAR chTemp[MAX_PATH]=_T("");
			wsprintfW(chTemp,TEXT("索引===%d号"), i);
			SMessageBox(NULL,chTemp,L"多点WIFI",MB_OK);
			if (i==0){
				ShellExecute(NULL, L"open",L"http://www.wf06.com", NULL, NULL, SW_SHOWNORMAL);

			}else if (i==1){

				ShellExecute(NULL, L"open",L"http://www.sk53.com", NULL, NULL, SW_SHOWNORMAL);
			}


			return ;
		}
	}
}
예제 #7
0
파일: MainWnd.cpp 프로젝트: ming-hai/soui
void CMainWnd::OnBtnToolShoot()			//连拍
{
	SMessageBox(NULL,_T("连拍"),_T("haha"),MB_OK|MB_ICONEXCLAMATION);
}
예제 #8
0
파일: MainWnd.cpp 프로젝트: ming-hai/soui
void CMainWnd::OnBtnAdd()					//【+】
{
	SMessageBox(NULL,_T("【+】"),_T("haha"),MB_OK|MB_ICONEXCLAMATION);
}
예제 #9
0
파일: MainWnd.cpp 프로젝트: ming-hai/soui
void CMainWnd::OnBtnToolNews()			//资讯
{
	SMessageBox(NULL,_T("资讯"),_T("haha"),MB_OK|MB_ICONEXCLAMATION);
}
예제 #10
0
파일: MainWnd.cpp 프로젝트: ming-hai/soui
void CMainWnd::OnBtnToolScreebshots()	//截图
{
	SMessageBox(NULL,_T("截图"),_T("haha"),MB_OK|MB_ICONEXCLAMATION);
}
예제 #11
0
파일: MainWnd.cpp 프로젝트: ming-hai/soui
void CMainWnd::OnBtnToolBarrage()		//弹幕
{
	SMessageBox(NULL,_T("弹幕"),_T("haha"),MB_OK|MB_ICONEXCLAMATION);
}
예제 #12
0
파일: MainWnd.cpp 프로젝트: ming-hai/soui
void CMainWnd::OnBtnToolDlna()			//dlna
{
	SMessageBox(NULL,_T("dlna"),_T("haha"),MB_OK|MB_ICONEXCLAMATION);
}
예제 #13
0
파일: MainWnd.cpp 프로젝트: ming-hai/soui
void CMainWnd::OnBtnBgOpen()	//播放区域打开文件按钮
{
	CFileDialogEx openDlg(TRUE,_T("rmvb"),0,6,_T("视频文件(*.rmvb)\0*.rmvb\0All files (*.*)\0*.*\0\0"));
	if(openDlg.DoModal()==IDOK)
		SMessageBox(NULL,_T("OnBtnBgOpen"),_T("haha"),MB_OK|MB_ICONEXCLAMATION);
}
예제 #14
0
파일: MainWnd.cpp 프로젝트: ming-hai/soui
void CMainWnd::OnBtnTool3D()		//3D
{
	SMessageBox(NULL,_T("3D"),_T("haha"),MB_OK|MB_ICONEXCLAMATION);
}
예제 #15
0
파일: MainWnd.cpp 프로젝트: ming-hai/soui
void CMainWnd::OnBtnToolGame()			//游戏
{
	SMessageBox(NULL,_T("游戏"),_T("haha"),MB_OK|MB_ICONEXCLAMATION);
}
예제 #16
0
파일: NewSkinDlg.cpp 프로젝트: 3rdexp/soui
void CNewSkinDlg::OnOK()
{
	xml_document xmlInit;
	if(xmlInit.load_file(m_pMainDlg->m_strInitFile))
	{
		xml_node xmlSkins=xmlInit.first_child().child(L"skins");
		if(!xmlSkins) xmlSkins=xmlInit.first_child().append_child(L"skins");
		SStringT strSkinName=FindChildByName2<SRichEdit>(L"edit_skin_name")->GetWindowText();
		if(strSkinName.IsEmpty())
		{
			SMessageBox(GetActiveWindow(),_T("没有指定的皮肤名"),_T("错误"),MB_OK|MB_ICONSTOP);
			return;
		}
		SStringW strSkinNameW=S_CT2W(strSkinName);
		{
			//检查名字重复
			xml_node xmlSkin=xmlSkins.first_child();
			while(xmlSkin)
			{
				if(strSkinNameW==xmlSkin.attribute(L"name").value())
				{
					SMessageBox(GetActiveWindow(),_T("指定的皮肤名与现有皮肤重复"),_T("错误"),MB_OK|MB_ICONSTOP);
					return;
				}
				xmlSkin=xmlSkin.next_sibling();
			}
		}

		STabCtrl *pTabSkinType=FindChildByName2<STabCtrl>(L"tab_skin_type");
		wchar_t szTypes[][20]={
			L"imglist",L"imgframe",L"scrollbar",L"button",L"gradation"
		};
		int iType=pTabSkinType->GetCurSel();
		xml_node xmlSkin=xmlSkins.append_child(szTypes[iType]);

		xmlSkin.append_attribute(L"name").set_value(strSkinNameW);
		switch(iType)
		{
		case 0://imglist
			{
				SStringT strSrcName=FindChildByName2<SRichEdit>(L"edit_imglist_src_name")->GetWindowText();
				xmlSkin.append_attribute(L"src").set_value(strSkinNameW);
				SStringT strStates=FindChildByName2<SRichEdit>(L"edit_imglist_states")->GetWindowText();
				int nStates=_ttoi(strStates);
				if(nStates!=0) xmlSkin.append_attribute(L"states").set_value(nStates);
				if(FindChildByName(L"chk_imglist_vert")->IsChecked())
					xmlSkin.append_attribute(L"vertical").set_value(L"1");
				if(FindChildByName(L"chk_imglist_tile")->IsChecked())
					xmlSkin.append_attribute(L"tile").set_value(L"1");
			}
			break;
		case 1://imgframe
			{
				SStringT strSrcName=FindChildByName2<SRichEdit>(L"edit_imgframe_src_name")->GetWindowText();
				xmlSkin.append_attribute(L"src").set_value(strSkinNameW);
				SStringT strStates=FindChildByName2<SRichEdit>(L"edit_imgframe_states")->GetWindowText();
				int nStates=_ttoi(strStates);
				if(nStates!=0) xmlSkin.append_attribute(L"states").set_value(nStates);
				if(FindChildByName(L"chk_imgframe_vert")->IsChecked())
					xmlSkin.append_attribute(L"vertical").set_value(L"1");
				if(FindChildByName(L"chk_imgframe_tile")->IsChecked())
					xmlSkin.append_attribute(L"tile").set_value(L"1");

				SStringT strFrame=FindChildByName2<SRichEdit>(L"edit_imgframe_frame")->GetWindowText();
				CRect rcMargin;
				int nSegs=_stscanf(strFrame,_T("%d,%d,%d,%d"),&rcMargin.left,&rcMargin.top,&rcMargin.right,&rcMargin.bottom);
				if(nSegs==4)
				{
					xmlSkin.append_attribute(L"left").set_value(rcMargin.left);
					xmlSkin.append_attribute(L"top").set_value(rcMargin.top);
					xmlSkin.append_attribute(L"right").set_value(rcMargin.right);
					xmlSkin.append_attribute(L"bottom").set_value(rcMargin.bottom);
				}
			}
			break;
		case 2://scrollbar
			{
				SStringT strSrcName=FindChildByName2<SRichEdit>(L"edit_imgframe_src_name")->GetWindowText();
				xmlSkin.append_attribute(L"src").set_value(strSkinNameW);
				SStringT strMargin=FindChildByName2<SRichEdit>(L"edit_scrollbar_margin")->GetWindowText();
				int nMargin=_ttoi(strMargin);
				if(nMargin>0) xmlSkin.append_attribute(L"margin").set_value(nMargin);
				if(FindChildByName(L"chk_scrollbar_hasgripper")->IsChecked())
					xmlSkin.append_attribute(L"hasGripper").set_value(L"1");
				if(FindChildByName(L"chk_scrollbar_inactive")->IsChecked())
					xmlSkin.append_attribute(L"hasInactive").set_value(L"1");
			}
			break;
		case 3://button
			{
				xmlSkin.append_attribute(L"colorUp").set_value(Color2Hex(FindChildByName2<SColorPicker>(L"crpk_bt1_up")->GetColor()));
				xmlSkin.append_attribute(L"colorDown").set_value(Color2Hex(FindChildByName2<SColorPicker>(L"crpk_bt1_down")->GetColor()));
				xmlSkin.append_attribute(L"colorUpHover").set_value(Color2Hex(FindChildByName2<SColorPicker>(L"crpk_bt2_up")->GetColor()));
				xmlSkin.append_attribute(L"colorDownHover").set_value(Color2Hex(FindChildByName2<SColorPicker>(L"crpk_bt2_down")->GetColor()));
				xmlSkin.append_attribute(L"colorUpPush").set_value(Color2Hex(FindChildByName2<SColorPicker>(L"crpk_bt3_up")->GetColor()));
				xmlSkin.append_attribute(L"colorDownPush").set_value(Color2Hex(FindChildByName2<SColorPicker>(L"crpk_bt3_down")->GetColor()));
				xmlSkin.append_attribute(L"colorUpDisable").set_value(Color2Hex(FindChildByName2<SColorPicker>(L"crpk_bt4_up")->GetColor()));
				xmlSkin.append_attribute(L"colorDownDisable").set_value(Color2Hex(FindChildByName2<SColorPicker>(L"crpk_bt4_down")->GetColor()));
				xmlSkin.append_attribute(L"colorBorder").set_value(Color2Hex(FindChildByName2<SColorPicker>(L"crpk_bt_border")->GetColor()));
			}
			break;
		case 4://gradation
			{
				xmlSkin.append_attribute(L"from").set_value(Color2Hex(FindChildByName2<SColorPicker>(L"crpk_gradation_from")->GetColor()));
				xmlSkin.append_attribute(L"to").set_value(Color2Hex(FindChildByName2<SColorPicker>(L"crpk_gradation_to")->GetColor()));
				xmlSkin.append_attribute(L"dir").set_value(FindChildByName(L"chk_gradation_dir")->IsChecked()?L"vert":L"horz");
			}
			break;
		}

		//save xml
		FILE *f=_tfopen(m_pMainDlg->m_strInitFile,_T("wb"));
		if(f)
		{
			xml_writer_file xmlPrinter(f);
			xmlInit.print(xmlPrinter);
			fclose(f);
			m_pMainDlg->InitSkinList();
		}

	}
	EndDialog(IDOK);
}
예제 #17
0
파일: MainWnd.cpp 프로젝트: ming-hai/soui
void CMainWnd::OnBtnToolFlyscreen()		//飞屏
{
	SMessageBox(NULL,_T("飞屏"),_T("haha"),MB_OK|MB_ICONEXCLAMATION);
}
예제 #18
0
파일: MainWnd.cpp 프로젝트: ming-hai/soui
void CMainWnd::OnBtnToolSurronudsound()		//环绕声
{
	SMessageBox(NULL,_T("环绕声"),_T("haha"),MB_OK|MB_ICONEXCLAMATION);
}
예제 #19
0
파일: MainWnd.cpp 프로젝트: ming-hai/soui
void CMainWnd::OnBtnToolLefteye()		//左眼
{
	SMessageBox(NULL,_T("左眼"),_T("haha"),MB_OK|MB_ICONEXCLAMATION);
}
예제 #20
0
파일: MainWnd.cpp 프로젝트: ming-hai/soui
void CMainWnd::OnBtnDelete()				//【-】
{
	SMessageBox(NULL,_T("【-】"),_T("haha"),MB_OK|MB_ICONEXCLAMATION);
}
예제 #21
0
파일: MainWnd.cpp 프로젝트: ming-hai/soui
void CMainWnd::OnBtnStop()	// 停止
{
	SMessageBox(NULL,_T("OnBtnStop"),_T("haha"),MB_OK|MB_ICONEXCLAMATION);
}
예제 #22
0
파일: MainWnd.cpp 프로젝트: ming-hai/soui
void CMainWnd::OnBtnClear()				//清空列表按钮
{
	SMessageBox(NULL,_T("清空列表按钮"),_T("haha"),MB_OK|MB_ICONEXCLAMATION);
}
예제 #23
0
파일: MainWnd.cpp 프로젝트: ming-hai/soui
void CMainWnd::OnBtnPageDown()	//下一个
{
	SMessageBox(NULL,_T("OnBtnPageDown"),_T("haha"),MB_OK|MB_ICONEXCLAMATION);
}
예제 #24
0
파일: MainWnd.cpp 프로젝트: ming-hai/soui
void CMainWnd::OnBtnToolDownload()		//下载管理
{
	SMessageBox(NULL,_T("下载管理"),_T("haha"),MB_OK|MB_ICONEXCLAMATION);
}
예제 #25
0
void CMainDlg::OnFileTypeRadioSwitch(int nID)
{
    SMessageBox(NULL, SStringT().Format(L"Change to %s", ft_str[nID - 20000]), L"File type", MB_OK);
}
예제 #26
0
void CCodeLineCounterHandler::OnBtnGo()
{
    if(m_strDir.IsEmpty())
    {
        SMessageBox(m_pPageRoot->GetContainer()->GetHostHwnd(),_T("没有指定扫描目录"),_T("错误"),MB_OK|MB_ICONSTOP);
        return;
    }
    SStringT strTypes = m_pPageRoot->FindChildByName(L"edit_filetypes")->GetWindowText();
    SStringWList lstTypes;
    SplitString(S_CT2W(strTypes),L';',lstTypes);
    CODECFGMAP cfg;
    for(UINT i=0;i<lstTypes.GetCount();i++)
    {
        CODECFGMAP::CPair *pPair = m_mapCodeCfg.Lookup(lstTypes[i]);
        if(!pPair) continue;
        cfg[lstTypes[i]] = pPair->m_value;
    }
    if(cfg.IsEmpty())
    {
        SMessageBox(m_pPageRoot->GetContainer()->GetHostHwnd(),_T("没有指定文件类型或者类型无效"),_T("错误"),MB_OK|MB_ICONSTOP);
        return;
    }

    //获得文件列表,计每个目标文件的文件大小
    HSTREEITEM hRoot = m_pDirTree->GetRootItem();
    SList<FILEINFO> lstFileInfo;
    int nDirs = 1;
    DWORD szAll = EnumFileInfo(cfg,m_strDir,hRoot,lstFileInfo,nDirs);
    if(lstFileInfo.GetCount() == 0)
    {
        SMessageBox(m_pPageRoot->GetContainer()->GetHostHwnd(),_T("指定的目录下没有找到满足条件的文件类型"),_T("提示"),MB_OK|MB_ICONINFORMATION);
        return;
    }

    //SWindow *pPageResult = m_pPageRoot->FindChildByName(L"page_dir");   
    SSplitWnd_Row *pSplitTree = m_pPageRoot->FindChildByName2<SSplitWnd_Row>(L"split_tree");
    pSplitTree->ShowPane(1);

    SProgress *pProgBar = pSplitTree->FindChildByName2<SProgress>(L"prog_run");
    pProgBar->SetRange(0,szAll);
    pProgBar->SetValue(0);

    CLineInfo lineInfoAll;

    SMap<SStringW,CLineInfo> mapLineInfo;
    for(UINT i=0;i<lstTypes.GetCount();i++)
    {
        mapLineInfo[lstTypes[i]] = CLineInfo();
    }

    //统计代码行
    DWORD dwProg = 0;
    SPOSITION pos = lstFileInfo.GetHeadPosition();
    while(pos)
    {
        FILEINFO fi = lstFileInfo.GetNext(pos);

        CLineInfo lineInfo;
        CountCodeLines(S_CW2T(fi.strFileName),fi.cfg,lineInfo.nCodeLines,lineInfo.nRemarkLines,lineInfo.nBlankLines);
        lineInfoAll += lineInfo;
        mapLineInfo[fi.cfg.strExt] += lineInfo;

        dwProg += fi.dwSize;
        pProgBar->SetValue(dwProg);
        pProgBar->UpdateWindow();
    }

    pSplitTree->HidePane(1);
    STabCtrl *pTab = m_pPageRoot->FindChildByName2<STabCtrl>(L"tab_codeline");
    pTab->SetCurSel(1);
    SWindow *pWndRes = pTab->GetPage(_T("page_result"),FALSE);
    pWndRes->FindChildByName(L"txt_folders")->SetWindowText(SStringT().Format(_T("%d"),nDirs));
    pWndRes->FindChildByName(L"txt_files")->SetWindowText(SStringT().Format(_T("%d"),lstFileInfo.GetCount()));
    pWndRes->FindChildByName(L"txt_codelines")->SetWindowText(SStringT().Format(_T("%d"),lineInfoAll.nCodeLines));
    pWndRes->FindChildByName(L"txt_blanklines")->SetWindowText(SStringT().Format(_T("%d"),lineInfoAll.nBlankLines));
    pWndRes->FindChildByName(L"txt_remarklines")->SetWindowText(SStringT().Format(_T("%d"),lineInfoAll.nRemarkLines));

    SListCtrl *plstReport = pWndRes->FindChildByName2<SListCtrl>(L"lst_linecounter_report");
    plstReport->DeleteAllItems();
    for(UINT i=0;i<lstTypes.GetCount();i++)
    {
        CCodeConfig codeCfg = cfg[lstTypes[i]];
        CLineInfo lineInfo = mapLineInfo[lstTypes[i]];

        plstReport->InsertItem(i,S_CW2T(codeCfg.strType));
        plstReport->SetSubItemText(i,1,S_CW2T(codeCfg.strExt));
        plstReport->SetSubItemText(i,2,SStringT().Format(_T("%d"),lineInfo.nCodeLines));
        plstReport->SetSubItemText(i,3,SStringT().Format(_T("%d"),lineInfo.nBlankLines));
        plstReport->SetSubItemText(i,4,SStringT().Format(_T("%d"),lineInfo.nRemarkLines));
    }
}
예제 #27
0
파일: MainWnd.cpp 프로젝트: ming-hai/soui
void CMainWnd::OnBtnToolTranscode()		//转码
{
	SMessageBox(NULL,_T("转码"),_T("haha"),MB_OK|MB_ICONEXCLAMATION);
}
예제 #28
0
파일: UIEditor.cpp 프로젝트: ming-hai/soui
//定义唯一的一个R,UIRES对象,ROBJ_IN_CPP是resource.h中定义的宏。
ROBJ_IN_CPP


int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int /*nCmdShow*/)
{
    HRESULT hRes = OleInitialize(NULL);
    SASSERT(SUCCEEDED(hRes));

    int nRet = 0;
    
    SComMgr *pComMgr = new SComMgr;

    HMODULE hSci = LoadLibrary(_T("SciLexer.dll"));
	if(!hSci){
		MessageBox(GetActiveWindow(),_T("Load SciLexer.dll failed! \nCopying third-part/SciLexer/bin/SciLexer.dll to the running folder should resolve the problem!!"),_T("error"),MB_OK|MB_ICONSTOP);
		return -1;
	}

    //将程序的运行路径修改到项目所在目录所在的目录
    TCHAR szCurrentDir[MAX_PATH] = { 0 };
    GetModuleFileName(NULL, szCurrentDir, sizeof(szCurrentDir));
    LPTSTR lpInsertPos = _tcsrchr(szCurrentDir, _T('\\'));
    _tcscpy(lpInsertPos + 1, _T("..\\demos\\uieditor\\"));
    SetCurrentDirectory(szCurrentDir);
    {
        BOOL bLoaded=FALSE;
        CAutoRefPtr<SOUI::IImgDecoderFactory> pImgDecoderFactory;
        CAutoRefPtr<SOUI::IRenderFactory> pRenderFactory;

        bLoaded = pComMgr->CreateRender_GDI((IObjRef**)&pRenderFactory); //SRenderFactory_GDI
        SASSERT_FMT(bLoaded,_T("load interface [render] failed!"));

        bLoaded=pComMgr->CreateImgDecoder((IObjRef**)&pImgDecoderFactory);//SImgDecoderFactory_GDIP
        SASSERT_FMT(bLoaded,_T("load interface [%s] failed!"),_T("imgdecoder"));

        pRenderFactory->SetImgDecoderFactory(pImgDecoderFactory);//SImgDecoderFactory_GDIP
        SApplication *theApp = new SApplication(pRenderFactory, hInstance);


		//向app注册自定义类
		theApp->RegisterWndFactory(TplSWindowFactory<SMyButton>());
		theApp->RegisterWndFactory(TplSWindowFactory<SMoveWnd>());
		theApp->RegisterWndFactory(TplSWindowFactory<SFreeMoveWindow>());
		theApp->RegisterWndFactory(TplSWindowFactory<SToolbox>());



		theApp->RegisterWndFactory(TplSWindowFactory<STurn3dView>());

		// extened controls
		theApp->RegisterWndFactory(TplSWindowFactory<SChromeTabCtrl>());//注册ChromeTabCtrl
		theApp->RegisterWndFactory(TplSWindowFactory<SImageMaskWnd>());//注册SImageMaskWnd
		theApp->RegisterWndFactory(TplSWindowFactory<SButtonEx>());
		theApp->RegisterWndFactory(TplSWindowFactory<SWindowEx>());
		theApp->RegisterWndFactory(TplSWindowFactory<SImRichEdit>());
		theApp->RegisterWndFactory(TplSWindowFactory<SImagePlayer>());
		theApp->RegisterWndFactory(TplSWindowFactory<SText>());
		theApp->RegisterWndFactory(TplSWindowFactory<SImageEx>());
		theApp->RegisterWndFactory(TplSWindowFactory<SSplitBar>());
		theApp->RegisterWndFactory(TplSWindowFactory<SImageSwitcher>());

		theApp->RegisterWndFactory(TplSWindowFactory<STabPage2>());//注册STabPage2
		theApp->RegisterWndFactory(TplSWindowFactory<STabCtrl2>());//注册STabCtrl2
		theApp->RegisterWndFactory(TplSWindowFactory<SAnimImg>());//注册SAnimImg
		theApp->RegisterWndFactory(TplSWindowFactory<SGifPlayer>());//注册gif

		theApp->RegisterWindowClass<SListBoxDrop>();
		theApp->RegisterWindowClass<CDropWnd>();

        theApp->RegisterWndFactory(TplSWindowFactory<SPropertyGrid>());//注册属性表控件
        theApp->RegisterWndFactory(TplSWindowFactory<SScrollText>());
        theApp->RegisterWndFactory(TplSWindowFactory<SRotateWindow>());

		//extened skins
		theApp->RegisterSkinFactory(TplSkinFactory<SColorMask>());
		theApp->RegisterSkinFactory(TplSkinFactory<SSkinMutiFrameImg>());
		theApp->RegisterSkinFactory(TplSkinFactory<SSkinVScrollbar>());
		theApp->RegisterSkinFactory(TplSkinFactory<SSkinNewScrollbar>());
		theApp->RegisterSkinFactory(TplSkinFactory<SSkinGif>());
		theApp->RegisterSkinFactory(TplSkinFactory<SSkinAPNG>());
        {
			#ifdef _DEBUG
				HMODULE hSysRes = LoadLibrary(_T("soui-sys-resourced.dll"));		

			#else
				HMODULE hSysRes = LoadLibrary(_T("soui-sys-resource.dll"));		
			#endif

            CAutoRefPtr<IResProvider> sysResProvider;
            CreateResProvider(RES_PE, (IObjRef**)&sysResProvider);
            sysResProvider->Init((WPARAM)hSysRes, 0);
            theApp->LoadSystemNamedResource(sysResProvider);
			FreeLibrary(hSysRes);
        }

		

        CAutoRefPtr<IResProvider>   pResProvider;
#if (RES_TYPE == 0)
        CreateResProvider(RES_FILE, (IObjRef**)&pResProvider);
        if (!pResProvider->Init((LPARAM)_T("uires"), 0))
        {
            SASSERT(0);
            return 1;
        }
#else 
        CreateResProvider(RES_PE, (IObjRef**)&pResProvider);
        pResProvider->Init((WPARAM)hInstance, 0);
#endif
		//如果需要在代码中使用R::id::namedid这种方式来使用控件必须要这一行代码:2016年2月2日,R::id::namedXmlID是由uiresbuilder 增加-h .\res\resource.h idtable 这3个参数后生成的。
		//theApp->InitXmlNamedID(namedXmlID,ARRAYSIZE(namedXmlID),TRUE);
		//theApp->Init(_T("XML_INIT"));  //这一句不在需要了 在AddResProvider时自动执行初始化
		

		theApp->AddResProvider(pResProvider, L"uidef:UIDESIGNER_XML_INIT");   // theApp->AddResProvider(pResProvider, L"uidef:xml_init");



		//设置真窗口处理接口
		CSouiRealWndHandler * pRealWndHandler = new CSouiRealWndHandler();
		theApp->SetRealWndHandler(pRealWndHandler);
		pRealWndHandler->Release();

        ////加载LUA脚本模块。
        //CAutoRefPtr<IScriptModule> pScriptLua;
        //bLoaded=pComMgr->CreateScrpit_Lua((IObjRef**)&pScriptLua);
        //SASSERT_FMT(bLoaded,_T("load interface [%s] failed!"),_T("script_lua"));

        ////加载多语言翻译模块。
        //CAutoRefPtr<ITranslatorMgr> trans;
        //bLoaded=pComMgr->CreateTranslator((IObjRef**)&trans);
        //SASSERT_FMT(bLoaded,_T("load interface [%s] failed!"),_T("translator"));
        //if(trans)
        //{//加载语言翻译包
        //    theApp->SetTranslator(trans);
        //    pugi::xml_document xmlLang;
        //    if(theApp->LoadXmlDocment(xmlLang,_T("lang_cn"),_T("translator")))
        //    {
        //        CAutoRefPtr<ITranslator> langCN;
        //        trans->CreateTranslator(&langCN);
        //        langCN->Load(&xmlLang.child(L"language"),1);//1=LD_XML
        //        trans->InstallTranslator(langCN);
        //    }
        //}
        
        // BLOCK: Run application
        {			
            CMainDlg dlgMain;
            dlgMain.Create(GetActiveWindow());
            dlgMain.SendMessage(WM_INITDIALOG);
            dlgMain.CenterWindow(dlgMain.m_hWnd);
            dlgMain.ShowWindow(SW_SHOWNORMAL);	
			SStringT uideffile = lpstrCmdLine;		
			if (!uideffile.IsEmpty())
			{
				uideffile.Trim(_T('\"'));
				uideffile += _T("uires.idx");
#ifdef _DEBUG
				SMessageBox(NULL, uideffile, NULL, MB_OK);
#endif
				if(FileIsExist(uideffile))
					dlgMain.OpenProject(uideffile);
			}
            nRet = theApp->Run(dlgMain.m_hWnd);
        }

        delete theApp;
    }
	FreeLibrary(hSci);
    
    delete pComMgr;
    
    OleUninitialize();
    return nRet;
}
예제 #29
0
파일: MainWnd.cpp 프로젝트: ming-hai/soui
void CMainWnd::OnBtnToolMovielib()		//影视库
{
	SMessageBox(NULL,_T("影视库"),_T("haha"),MB_OK|MB_ICONEXCLAMATION);
}