void CRemote::PageNewSearch() { if ( CheckCookie() ) return; CMainWnd* pMainWnd = (CMainWnd*)theApp.m_pMainWnd; if ( pMainWnd == NULL || ! pMainWnd->IsKindOf( RUNTIME_CLASS(CMainWnd) ) ) return; CSingleLock pLock( &theApp.m_pSection ); if ( ! SafeLock( pLock ) ) return; const CString strSearch = GetKey( L"search" ); const CString strSchema = GetKey( L"schema" ); if ( strSearch.IsEmpty() || ( ! strSchema.IsEmpty() && SchemaCache.Get( strSchema ) == NULL ) ) { m_sRedirect = L"home"; return; } CQuerySearchPtr pSearch = new CQuerySearch(); pSearch->m_sSearch = strSearch; pSearch->m_pSchema = SchemaCache.Get( strSchema ); CString strURI; if ( pSearch->m_pSchema != NULL ) strURI = pSearch->m_pSchema->GetURI(); Settings.Search.LastSchemaURI = strURI; pMainWnd->PostMessage( WM_OPENSEARCH, (WPARAM)pSearch.Detach() ); pLock.Unlock(); Sleep( 500 ); m_sRedirect = L"search"; }
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPSTR /*lpCmdLine*/, int nCmdShow) { EnableMemLeakCheck(); CPaintManagerUI::SetInstance(hInstance); GdiplusStartupInput gdiplusStartupInput; ULONG_PTR gdiplusToken; GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); HRESULT Hr = ::CoInitialize(NULL); if( FAILED(Hr) ) return 0; if( ::LoadLibrary(_T("d3d9.dll")) == NULL ) ::MessageBox(NULL, _T("加载 d3d9.dll 失败,一些特效可能无法显示!"), _T("信息提示"),MB_OK|MB_ICONWARNING); CMainWnd* pFrame = new CMainWnd(); if(pFrame == NULL) return 0; pFrame->Create(NULL,_T("UiLib Demos"), UI_WNDSTYLE_FRAME, 0L, 0, 0, 900, 600); pFrame->CenterWindow(); ::ShowWindow(*pFrame, SW_SHOW); CPaintManagerUI::MessageLoop(); ::CoUninitialize(); GdiplusShutdown(gdiplusToken); _CrtDumpMemoryLeaks(); return 0; }
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT) { CMessageLoop theLoop; _Module.AddMessageLoop(&theLoop); g_hMenuGroup = LoadMenu( _Module.GetResourceInstance(), MAKEINTRESOURCE( IDR_MENU_GROUP ) ); g_hMenuGroup = GetSubMenu( g_hMenuGroup, 0 ); g_hMenuColor = LoadMenu( _Module.GetResourceInstance(), MAKEINTRESOURCE( IDR_MENU_COLOR ) ); g_hMenuColor = GetSubMenu( g_hMenuColor, 0 ); CMainWnd wndMain; char szTitle[256] = { 0 }; sprintf( szTitle, "%s %s", GetAppName(), GetAppVer() ); if( NULL == wndMain.Create( NULL, CWindow::rcDefault, szTitle, WS_VISIBLE | WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX ) ) { ATLTRACE( _T("Main window creation failed!\n") ); return( 0 ); } wndMain.ShowWindow( nCmdShow ); int nRet = theLoop.Run(); _Module.RemoveMessageLoop(); return nRet; }
CMediaWnd* CFileExecutor::GetMediaWindow(BOOL bFocus) { CMainWnd* pMainWnd = (CMainWnd*)theApp.m_pSafeWnd; if ( pMainWnd == NULL ) return NULL; if ( pMainWnd->IsKindOf( RUNTIME_CLASS(CMainWnd) ) == FALSE ) return NULL; return (CMediaWnd*)pMainWnd->m_pWindows.Open( RUNTIME_CLASS(CMediaWnd), FALSE, bFocus ); }
CLibraryWnd* CFileExecutor::GetLibraryWindow() { CMainWnd* pMainWnd = (CMainWnd*)theApp.m_pSafeWnd; if ( pMainWnd == NULL ) return NULL; if ( pMainWnd->IsKindOf( RUNTIME_CLASS(CMainWnd) ) == FALSE ) return NULL; return (CLibraryWnd*)pMainWnd->m_pWindows.Open( RUNTIME_CLASS(CLibraryWnd), FALSE, TRUE ); }
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE , LPWSTR , int ) { CConfig* config = CConfig::get_instance(); if (!config->load()) return 0; using namespace DuiLib; CPaintManagerUI::SetInstance(hInstance); CPaintManagerUI::SetResourcePath(CPaintManagerUI::GetInstancePath() + L"\\skin"); HRESULT Hr = ::CoInitialize(nullptr); if (FAILED(Hr)) return 0; CMainWnd *wnd = new CMainWnd(L"MainWnd.xml"); wnd->Create(nullptr, L"player", UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE); wnd->ShowModal(); delete wnd; ::CoUninitialize(); delete config; _CrtDumpMemoryLeaks(); return 0; }
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPSTR /*lpCmdLine*/, int nCmdShow) { HRESULT Hr = ::CoInitialize(NULL); if( FAILED(Hr) ) return 0; HRESULT hRes = ::OleInitialize(NULL); // 初始化UI管理器 CPaintManagerUI::SetInstance(hInstance); // 初始化资源 InitResource(); ::SetCurrentDirectory(CPaintManagerUI::GetInstancePath()); #ifndef _DEBUG CPaintManagerUI::LoadPlugin(_T("TroyControls.dll")); #else CPaintManagerUI::LoadPlugin(_T("TroyControls_d.dll")); #endif CMainWnd* pFrame = new CMainWnd(); if( pFrame == NULL ) return 0; pFrame->Create(NULL, _T("TroyBrowser"), UI_WNDSTYLE_FRAME, 0L, 0, 0, 990,690); pFrame->CenterWindow(); pFrame->ShowModal(); CPaintManagerUI::MessageLoop(); OleUninitialize(); ::CoUninitialize(); return 0; }
// // Override InitInstance to create main window. // BOOL CPokerApp::InitInstance() { if (!AfxSocketInit()) { AfxMessageBox(IDS_SOCKETINITFAILED); return FALSE; } CMainWnd* pMainWnd = new CMainWnd(); m_pMainWnd = pMainWnd; BOOL rc = FALSE; if (pMainWnd) { rc = pMainWnd->Create(NULL, g_szWndClass); } else { rc = FALSE; AfxMessageBox(g_szNotEnoughMemory); } if (rc) rc = Global::Instance().initInstance(); return rc; }
LRESULT CWizardInterfacePage::OnWizardNext() { UpdateData( TRUE ); Settings.Downloads.SimpleBar = m_bSimpleDownloadBars != FALSE; if ( m_bExpert && Settings.General.GUIMode == GUI_BASIC ) { CWaitCursor pCursor; CMainWnd* pMainWnd = (CMainWnd*)AfxGetMainWnd(); Settings.General.GUIMode = GUI_TABBED; Settings.Skin.RowSize = 17; pMainWnd->SetGUIMode( Settings.General.GUIMode, FALSE ); } else if ( ! m_bExpert && Settings.General.GUIMode != GUI_BASIC ) { CWaitCursor pCursor; CMainWnd* pMainWnd = (CMainWnd*)AfxGetMainWnd(); Settings.General.GUIMode = GUI_BASIC; Settings.Skin.RowSize = 18; pMainWnd->SetGUIMode( Settings.General.GUIMode, FALSE ); } Settings.Save(); return 0; }
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { EnableMemLeakCheck(); CWangDianNiu_DLL::InitConsoleWindow(); HRESULT Hr = ::CoInitialize(NULL); if( FAILED(Hr) ) return 0; CWkeWebkitUI::WkeWebkit_Init(); CPaintManagerUI::SetInstance(hInstance); //DuiLib::CDuiString instancePath = CPaintManagerUI::GetInstancePath(); //instancePath += "Skin\\"; //CPaintManagerUI::SetResourcePath(instancePath); CMainWnd* pFrame = new CMainWnd(); if(pFrame == NULL) return 0; pFrame->Create(NULL,_T("ÍúµêÅ£"), UI_WNDSTYLE_FRAME, 0L, 0, 0, 1120, 600); pFrame->CenterWindow(); ::ShowWindow(*pFrame, SW_SHOW); CPaintManagerUI::MessageLoop(); CWkeWebkitUI::WkeWebkit_Shutdown(); ::CoUninitialize(); CWangDianNiu_DLL::FreeConsoleWindow(); _CrtDumpMemoryLeaks(); return 0; }
int Main() { CMainWnd main; MSG msg; HACCEL hAccelTable; if (main.Create()== FALSE) return 1; hAccelTable = LoadAccelerators(_Module.m_hInstResource, MAKEINTRESOURCEW(IDC_ACCEL)); while (GetMessage(&msg, NULL, 0, 0)) { if (main.PreTranslateMessage(&msg) == FALSE) { if (!TranslateAccelerator(main.m_hWnd, hAccelTable, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } } return 0; }
void CCoolMenuBarCtrl::UpdateWindowMenu(CMenu* pMenu) { for ( UINT nItem = 0 ; nItem < (UINT)pMenu->GetMenuItemCount() ; nItem++ ) { UINT nID = pMenu->GetMenuItemID( nItem ); if ( nID >= AFX_IDM_FIRST_MDICHILD ) { for ( UINT nRemove = nItem ; nRemove < (UINT)pMenu->GetMenuItemCount() ; ) pMenu->RemoveMenu( nItem, MF_BYPOSITION ); pMenu->RemoveMenu( nItem - 1, MF_BYPOSITION ); break; } } CMainWnd* pFrame = theApp.SafeMainWnd(); if ( ! pFrame->IsKindOf( RUNTIME_CLASS(CMDIFrameWnd) ) ) return; CWnd* pClient = pFrame->GetWindow( GW_CHILD ); for ( ; pClient ; pClient = pClient->GetNextWindow() ) { TCHAR szClass[64]; GetClassName( pClient->GetSafeHwnd(), szClass, 64 ); if ( _tcsicmp( szClass, _T("MDIClient") ) == 0 ) break; } if ( pClient == NULL ) return; CMDIChildWnd* pActive = pFrame->m_pWindows.GetActive(); BOOL bSeparator = TRUE; for ( UINT nIndex = 1, nID = AFX_IDM_FIRST_MDICHILD ; nIndex <= 10 ; nIndex++, nID++ ) { CChildWnd* pChildWnd = (CChildWnd*)pClient->GetDlgItem( nID ); if ( ! pChildWnd ) break; if ( pChildWnd->m_bTabMode ) { nIndex--; continue; } if ( bSeparator ) { pMenu->AppendMenu( MF_SEPARATOR, ID_SEPARATOR ); bSeparator = FALSE; } CString strMenu, strWindow; pChildWnd->GetWindowText( strWindow ); strMenu.Format( _T("&%u %s"), nIndex, (LPCTSTR)strWindow ); pMenu->AppendMenu( MF_STRING | ( pChildWnd == pActive ? MF_CHECKED : 0 ), nID, strMenu ); } }
BOOL CNeighbour::Setup() { CMainWnd* pMainWnd = (CMainWnd*)theApp.m_pMainWnd; m_pHomeWnd = (CHomeWnd*)pMainWnd->GetWindow( RUNTIME_CLASS(CHomeWnd) ); ASSERT( m_pHomeWnd->GetSafeHwnd() != NULL ); return TRUE; }
void CMailChannel::Setup() { CChannel::Setup(); fcnp = &FeeLogin; CMainWnd* pMainWnd = (CMainWnd*)theApp.m_pMainWnd; ASSERT( pMainWnd->GetSafeHwnd() != NULL ); m_pHomeWnd = (CNetworkWnd*)pMainWnd->GetWindow( RUNTIME_CLASS(CNetworkWnd) ); ASSERT( m_pHomeWnd->GetSafeHwnd() != NULL ); }
void CCallerChannel::Setup() { CChannel::Setup(); fcnp = &FeeLogin; CMainWnd* pMainWnd = (CMainWnd*)theApp.m_pMainWnd; ASSERT( pMainWnd->GetSafeHwnd() != NULL ); m_pUserWnd = (CUserWnd*)pMainWnd->GetWindow( RUNTIME_CLASS(CUserWnd) ); ASSERT( m_pUserWnd->GetSafeHwnd() != NULL ); }
CView* GetActiveView() { CView* pView = NULL; #ifdef PSPOT_TABLE_MODULE_ CMainWnd* pMainWnd = CMainWnd::Instance(); if (pMainWnd) pView = pMainWnd->GetActiveView(); #endif return pView; }
BOOL CChildWnd::IsActive(BOOL bFocused) { CMainWnd* pMainWnd = GetMainWnd(); if ( bFocused && GetForegroundWindow() != pMainWnd ) return FALSE; CChildWnd* pActive = (CChildWnd*)pMainWnd->MDIGetActive(); if ( pActive == this ) return TRUE; if ( bFocused ) return FALSE; return FALSE; }
BOOL CChildWnd::SetAlert(BOOL bAlert) { if ( m_bAlert == bAlert ) return FALSE; CMainWnd* pMainWnd = GetMainWnd(); if ( bAlert && pMainWnd->m_pWindows.GetActive() == this ) return FALSE; // Was MDIGetActive() m_bAlert = bAlert; pMainWnd->OnUpdateCmdUI(); return TRUE; }
StateLogin::~StateLogin() { /* if (pWaitDlg_) { pWaitDlg_->DestroyWindow(); // XXX DOUBLE DELETE!!! delete pWaitDlg_; pWaitDlg_ = 0; } */ CMainWnd* pWnd = CMainWnd::Instance(); ASSERT(pWnd); pWnd->EnableWindow(TRUE); }
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPSTR /*lpCmdLine*/, int nCmdShow) { CPaintManagerUI::SetInstance(hInstance); HRESULT Hr = ::CoInitialize(NULL); if( FAILED(Hr) ) return 0; CMainWnd* pFrame = new CMainWnd(); if( pFrame == NULL ) return 0; pFrame->Create(NULL, _T("я╦ювсно╥╨пвс"), UI_WNDSTYLE_FRAME, 0L, 0, 0, 990,690); pFrame->CenterWindow(); CPaintManagerUI::MessageLoop(); ::CoUninitialize(); return 0; }
BOOL CWizardSheet::RunWizard(CWnd* pParent) { BOOL bSuccess = FALSE; CWizardSheet pSheet( pParent ); CWizardWelcomePage pWelcome; CWizardConnectionPage pConnection; CWizardSharePage pShare; CWizardProfilePage pProfile; CWizardInterfacePage pInterface; CWizardNetworksPage pNetworks; CWizardFinishedPage pFinished; pSheet.AddPage( &pWelcome ); pSheet.AddPage( &pConnection ); pSheet.AddPage( &pShare ); pSheet.AddPage( &pProfile ); pSheet.AddPage( &pInterface ); pSheet.AddPage( &pNetworks ); pSheet.AddPage( &pFinished ); bSuccess = ( pSheet.DoModal() == IDOK ); CWaitCursor pCursor; CMainWnd* pMainWnd = (CMainWnd*)AfxGetMainWnd(); if ( pInterface.m_bExpert && Settings.General.GUIMode == GUI_BASIC ) { Settings.General.GUIMode = GUI_TABBED; pMainWnd->SetGUIMode( Settings.General.GUIMode, FALSE ); } else if ( ! pInterface.m_bExpert && Settings.General.GUIMode != GUI_BASIC ) { Settings.General.GUIMode = GUI_BASIC; pMainWnd->SetGUIMode( Settings.General.GUIMode, FALSE ); } Settings.Save(); return bSuccess; }
// // STATE: Log in. // StateLogin::StateLogin(const CString& username, const CString& password) : pWaitDlg_(0), retry_ (2), ticks_ (0) { CMainWnd* pWnd = CMainWnd::Instance(); ASSERT(pWnd); /* pWaitDlg_ = new CWaitDlg(pWnd); pWaitDlg_->Create(IDD_LOGGINGIN, pWnd); pWaitDlg_->ShowWindow(SW_SHOW); */ // XXX Disable main window! pWnd->EnableWindow(FALSE); // DPP::SendLoginPDU(username_, password_); }
int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPTSTR lpCmdLine, _In_ int nCmdShow) { ::CoInitialize(NULL); CPaintManagerUI::SetInstance(hInstance);// 加载XML的时候,需要使用该句柄去定位EXE的路径,才能加载XML的路径 窗口实例句柄 CMainWnd *pMainWnd = new CMainWnd; pMainWnd->Create(NULL, L"WeChatMain", UI_WNDSTYLE_FRAME, WS_EX_WINDOWEDGE); pMainWnd->CenterWindow(); pMainWnd->ShowWindow(); CPaintManagerUI::MessageLoop(); delete pMainWnd; ::CoInitialize(NULL); return 0; }
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPSTR /*lpCmdLine*/, int nCmdShow) { Poco::NamedMutex unique("SRTool"); if (!unique.tryLock()) return 0; CPaintManagerUI::SetInstance(hInstance); CPaintManagerUI::SetResourcePath(CPaintManagerUI::GetInstancePath() + _T("skin")); HRESULT Hr = ::CoInitialize(NULL); if (FAILED(Hr)) return 0; CMainWnd Frame; Frame.Create(NULL, NULL, UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE | WS_EX_ACCEPTFILES); Frame.SetIcon(IDI_ICON1); Frame.CenterWindow(); Frame.ShowWindow(true); CPaintManagerUI::MessageLoop(); ::CoUninitialize(); return 0; }
LRESULT CWizardInterfacePage::OnWizardNext() { UpdateData( TRUE ); Settings.Downloads.SimpleBar = m_bSimpleDownloadBars != FALSE; if ( ! m_bBasic && Settings.General.GUIMode == GUI_BASIC ) { CWaitCursor pCursor; CMainWnd* pMainWnd = (CMainWnd*)AfxGetMainWnd(); Settings.Skin.RowSize = 17; Settings.General.GUIMode = GUI_TABBED; pMainWnd->SetGUIMode( Settings.General.GUIMode, FALSE ); } else if ( m_bBasic && Settings.General.GUIMode != GUI_BASIC ) { CWaitCursor pCursor; CMainWnd* pMainWnd = (CMainWnd*)AfxGetMainWnd(); Settings.Skin.RowSize = 18; Settings.General.GUIMode = GUI_BASIC; pMainWnd->SetGUIMode( Settings.General.GUIMode, FALSE ); } Settings.Save(); if ( m_nSkin ) { CWaitCursor pCursor; ClearSkins(); if ( m_nSkin == 2 && theApp.m_nWinVer >= WIN_10) // Dark Mode { theApp.WriteProfileInt( L"Skins", L"Windows 10\\Windows10.Dark.xml", 1 ); theApp.WriteProfileInt( L"Skins", L"Windows 10\\Windows10.DarkFrames.xml", 1 ); } else if ( m_nSkin == 2) // Dark Skin { theApp.WriteProfileInt( L"Skins", L"Windows Collection\\SkinDark.xml", 1 ); theApp.WriteProfileInt( L"Skins", L"Windows Collection\\Skin8AltFrames.xml", 1 ); theApp.WriteProfileInt( L"Skins", L"Windows Collection\\SkinVistaRemote.xml", 1 ); } else if ( theApp.m_nWinVer >= WIN_10 ) { theApp.WriteProfileInt( L"Skins", L"Windows 10\\Windows10.xml", 1 ); theApp.WriteProfileInt( L"Skins", L"Windows 10\\Windows10.Frames.xml", 1 ); } else if ( theApp.m_nWinVer >= WIN_8 ) { theApp.WriteProfileInt( L"Skins", L"Windows Collection\\Skin8.xml", 1 ); theApp.WriteProfileInt( L"Skins", L"Windows Collection\\Skin8Frames.xml", 1 ); } else if ( theApp.m_nWinVer >= WIN_7 ) { theApp.WriteProfileInt( L"Skins", L"Windows Collection\\Skin7.xml", 1 ); theApp.WriteProfileInt( L"Skins", L"Windows Collection\\SkinVistaFrames.xml", 1 ); theApp.WriteProfileInt( L"Skins", L"Windows Collection\\SkinVistaRemote.xml", 1 ); } else if ( theApp.m_nWinVer < WIN_7 ) { theApp.WriteProfileInt( L"Skins", L"Windows Collection\\SkinVista.xml", 1 ); theApp.WriteProfileInt( L"Skins", L"Windows Collection\\SkinVistaFrames.xml", 1 ); theApp.WriteProfileInt( L"Skins", L"Windows Collection\\SkinVistaRemote.xml", 1 ); } if ( theApp.m_nWinVer >= WIN_7 && GetSystemMetrics( SM_CYSCREEN ) > 1050 ) // ToDo: Detect DPI theApp.WriteProfileInt( L"Skins", L"Flags\\Flags.xml", 1 ); PostMainWndMessage( WM_SKINCHANGED ); Sleep( 2500 ); // Wait a few seconds GetParent()->Invalidate(); } return 0; }
UINT_PTR CNavDesktopModule::Main() { if (!CheckInstance()) { return 0; } if (_InitDownInterface()) { _UpdateSelf();//程序升级 _UpdateXmlConfig();//更新界面布局xml文件 } CMessageLoop theLoop; _Module.AddMessageLoop(&theLoop); { TCHAR szPath[MAX_PATH + 1] = _T(""); ::GetModuleFileName(NULL, szPath, MAX_PATH); CPath ConfigFile; ConfigFile = szPath; ConfigFile.RemoveFileSpec(); ConfigFile.Append(L"config.dat"); CXmlReader XmlReader; if (XmlReader.LoadFile(CStringA(ConfigFile))) { if (XmlReader.Open("root\\SizeMode")) XmlReader.Read("value", Config::SizeMode); if (XmlReader.Open("root\\SkinTheme")) XmlReader.Read("value", Config::SkinTheme); if (XmlReader.Open("root\\ShowFloatBar")) XmlReader.Read("value", Config::ShowFloatBar); if (XmlReader.Open("root\\wVirtualKeyCode")) XmlReader.Read("value", (int&)Config::wVirtualKeyCode); if (XmlReader.Open("root\\wModifiers")) XmlReader.Read("value", (int&)Config::wModifiers); if (XmlReader.Open("root\\CloseMode")) XmlReader.Read("value", Config::CloseMode); if (XmlReader.Open("root\\StartupMode")) XmlReader.Read("value", Config::StartupMode); if (XmlReader.Open("root\\Transparent")) XmlReader.Read("value", Config::Transparent); if (XmlReader.Open("root\\TransparentPercent")) XmlReader.Read("value", Config::TransparentPercent); } } CMainWnd MainWnd; if (MainWnd.Create(NULL) == NULL) { ATLTRACE(_T("Main dialog creation failed!\n")); return 0; } int nRet = theLoop.Run(); _Module.RemoveMessageLoop(); return nRet; }
void CRemote::PageSearch() { if ( CheckCookie() ) return; m_nTab = tabSearch; CMainWnd* pMainWnd = static_cast< CMainWnd* >( theApp.m_pMainWnd ); if ( pMainWnd == NULL || ! pMainWnd->IsKindOf( RUNTIME_CLASS(CMainWnd) ) ) return; CSingleLock pLock( &theApp.m_pSection ); if ( ! SafeLock( pLock ) ) return; INT_PTR nSearchID = NULL; INT_PTR nCloseID = NULL; CSearchWnd* pSearchWnd = NULL; CString str; _stscanf( GetKey( L"id" ), L"%Ii", &nSearchID ); _stscanf( GetKey( L"close" ), L"%Ii", &nCloseID ); Prepare(); // Header Output( L"searchHeader" ); for ( CSearchWnd* pFindWnd = NULL; ( pFindWnd = static_cast< CSearchWnd* >( pMainWnd->m_pWindows.Find( RUNTIME_CLASS(CSearchWnd), pFindWnd ) ) ) != NULL; ) { Prepare(); INT_PTR nFindWnd = reinterpret_cast< INT_PTR >( pFindWnd ); if ( nCloseID == nFindWnd ) { pFindWnd->PostMessage( WM_CLOSE ); continue; } else if ( nSearchID == nFindWnd ) { pSearchWnd = pFindWnd; Add( L"search_selected", L"true" ); } str.Format( L"%Ii", nFindWnd ); Add( L"search_id", str ); str = pFindWnd->GetCaption(); if ( str.Find( L"Search : " ) == 0 ) str = str.Mid( 9 ).SpanExcluding( L"[" ); Add( L"search_caption", str ); Output( L"searchTab" ); } if ( pSearchWnd == NULL ) { str.Empty(); for ( POSITION pos = SchemaCache.GetIterator(); pos != NULL; ) { CSchemaPtr pSchema = SchemaCache.GetNext( pos ); if ( ! pSchema->m_bPrivate && pSchema->m_nType == CSchema::stFile ) { str += L"<option value=\"" + pSchema->GetURI(); str += L"\">" + pSchema->m_sTitle; str += L"</option>\r\n"; } } Prepare(); // Header Add( L"schema_option_list", str ); Output( L"searchNew" ); Output( L"searchFooter" ); return; } if ( ! GetKey( L"stop" ).IsEmpty() ) { pSearchWnd->PostMessage( WM_COMMAND, ID_SEARCH_STOP ); Sleep( 500 ); } CLockedMatchList pMatches( pSearchWnd->GetMatches() ); str = GetKey( L"sort" ); if ( ! str.IsEmpty() ) { int nColumn = 0; _stscanf( str, L"%i", &nColumn ); if ( pMatches->m_bSortDir != 1 && pMatches->m_nSortColumn == nColumn ) pMatches->SetSortColumn( nColumn, FALSE ); else pMatches->SetSortColumn( nColumn, TRUE ); pSearchWnd->PostMessage( WM_TIMER, 7 ); } str = GetKey( L"expcol" ); if ( ! str.IsEmpty() ) { CMatchFile** pLoop = pMatches->m_pFiles; for ( DWORD nCount = 0; nCount < pMatches->m_nFiles; nCount++, pLoop++ ) { if ( (*pLoop)->GetURN() == str ) { (*pLoop)->Expand( GetKey( L"collapse" ).IsEmpty() ); pSearchWnd->PostMessage( WM_TIMER, 7 ); break; } } } str = GetKey( L"download" ); if ( ! str.IsEmpty() ) { CMatchFile** pLoop = pMatches->m_pFiles; for ( DWORD nCount = 0; nCount < pMatches->m_nFiles; nCount++, pLoop++ ) { if ( (*pLoop)->GetURN() == str ) { Downloads.Add( *pLoop ); pSearchWnd->PostMessage( WM_TIMER, 7 ); m_sResponse.Empty(); m_sRedirect = L"downloads?group_reveal=all"; return; } } } if ( ! GetKey( L"setfilter" ).IsEmpty() ) { pMatches->m_sFilter = GetKey( L"filter" ); pMatches->Filter(); pSearchWnd->PostMessage( WM_TIMER, 7 ); } Prepare(); // Header str.Format( L"%Ii", nSearchID ); Add( L"search_id", str ); str.Format( L"%i", GetRandomNum( 0i32, _I32_MAX ) ); Add( L"random", str ); if ( ! pSearchWnd->IsPaused() ) Add( L"searching", L"true" ); Add( L"search_filter", pMatches->m_sFilter ); Output( L"searchTop" ); PageSearchHeaderColumn( MATCH_COL_NAME, Skin.GetHeaderTranslation( L"CMatchCtrl", L"File" ), L"left" ); PageSearchHeaderColumn( MATCH_COL_SIZE, Skin.GetHeaderTranslation( L"CMatchCtrl", L"Size" ), L"center" ); PageSearchHeaderColumn( MATCH_COL_RATING, Skin.GetHeaderTranslation( L"CMatchCtrl", L"Rating" ), L"center" ); PageSearchHeaderColumn( MATCH_COL_STATUS, Skin.GetHeaderTranslation( L"CMatchCtrl", L"Status" ), L"center" ); PageSearchHeaderColumn( MATCH_COL_COUNT, Skin.GetHeaderTranslation( L"CMatchCtrl", L"Host/Count" ), L"center" ); PageSearchHeaderColumn( MATCH_COL_SPEED, Skin.GetHeaderTranslation( L"CMatchCtrl", L"Speed" ), L"center" ); PageSearchHeaderColumn( MATCH_COL_CLIENT, Skin.GetHeaderTranslation( L"CMatchCtrl", L"Client" ), L"center" ); Output( L"searchMiddle" ); CMatchFile** pLoop = pMatches->m_pFiles; for ( DWORD nCount = 0; nCount < pMatches->m_nFiles; nCount++, pLoop++ ) { CMatchFile* pFile = *pLoop; if ( pFile->GetFilteredCount() == 0 ) continue; Add( L"row_urn", pFile->GetURN() ); Add( L"row_filename", pFile->m_sName ); if ( pFile->GetFilteredCount() <= 1 ) Add( L"row_single", L"true" ); else if ( pFile->m_bExpanded ) Add( L"row_expanded", L"true" ); else Add( L"row_collapsed", L"true" ); Output( L"searchRowStart" ); PageSearchRowColumn( MATCH_COL_SIZE, pFile, Settings.SmartVolume( pFile->m_nSize ) ); str.Empty(); for ( INT_PTR nStar = pFile->m_nRating / max( 1, pFile->m_nRated ); nStar > 1; nStar -- ) str += L'*'; PageSearchRowColumn( MATCH_COL_RATING, pFile, str ); str.Empty(); str += pFile->m_bBusy == TRI_TRUE ? L'B' : L'-'; str += pFile->m_bPush == TRI_TRUE ? L'F' : L'-'; str += pFile->m_bStable == TRI_FALSE ? L'U' : L'-'; PageSearchRowColumn( MATCH_COL_STATUS, pFile, str ); str.Empty(); if ( pFile->GetFilteredCount() > 1 ) str.Format(L"(%u sources)", pFile->GetFilteredCount()); else str = (CString)inet_ntoa( pFile->GetBestAddress() ); PageSearchRowColumn( MATCH_COL_COUNT, pFile, str ); PageSearchRowColumn( MATCH_COL_SPEED, pFile, pFile->m_sSpeed ); PageSearchRowColumn( MATCH_COL_CLIENT, pFile, pFile->GetFilteredCount() == 1 ? pFile->GetBestVendorName() : L"" ); Output( L"searchRowEnd" ); Prepare( L"column_" ); Prepare( L"row_" ); if ( pFile->m_bExpanded ) { for ( CQueryHit* pHit = pFile->GetHits(); pHit != NULL; pHit = pHit->m_pNext ) { if ( ! pHit->m_bFiltered ) continue; Add( L"row_urn", pFile->GetURN() ); Add( L"row_filename", pHit->m_sName ); Add( L"row_source", L"true" ); Output( L"searchRowStart" ); PageSearchRowColumn( MATCH_COL_SIZE, pFile, Settings.SmartVolume( pHit->m_nSize ) ); str.Empty(); for ( int nStar = pHit->m_nRating; nStar > 1; nStar -- ) str += L"*"; PageSearchRowColumn( MATCH_COL_RATING, pFile, str ); str.Empty(); str += pFile->m_bBusy == TRI_TRUE ? L'B' : L'-'; str += pFile->m_bPush == TRI_TRUE ? L'F' : L'-'; str += pFile->m_bStable == TRI_FALSE ? L'U' : L'-'; PageSearchRowColumn( MATCH_COL_STATUS, pFile, str ); PageSearchRowColumn( MATCH_COL_COUNT, pFile, (CString)inet_ntoa( pHit->m_pAddress ) ); PageSearchRowColumn( MATCH_COL_SPEED, pFile, pHit->m_sSpeed ); PageSearchRowColumn( MATCH_COL_CLIENT, pFile, pHit->m_pVendor->m_sName ); Output( L"searchRowEnd" ); Prepare( L"column_" ); Prepare( L"row_" ); } } } Output( L"searchBottom" ); Prepare(); Output( L"searchFooter" ); }