示例#1
0
LRESULT CQuickFilterDlg::OnInitDialog(HWND /*hwndFocus*/, LPARAM /*lp*/)
{
	DlgResize_Init(false);

	m_comboLevel = GetDlgItem(IDC_QF_LEVEL);
	m_editTags = GetDlgItem(IDC_QF_TAGS);
	m_frame = GetTopLevelParent();
	m_tagSelector.Create(m_hWnd);
	m_tagSelector.AssignWindow(m_editTags);

	m_brsHasFilter.CreateSolidBrush(RGB(128,255,128));
	m_brsNormal.CreateSolidBrush(::GetSysColor(COLOR_BTNFACE));

	m_internalUpdatingUI = true;
	SyncLevels();
	SyncTags();
	UpdateUI();
	m_internalUpdatingUI = false;
	::PostMessage(GetTopLevelParent(), WM_FILTER_CHANGE, 0, 0);

	m_hook = SetWindowsHookExW(WH_CALLWNDPROC, (HOOKPROC)&CQuickFilterDlg::CallWndProc, NULL, GetCurrentThreadId());

	SetTimer(IDT_REFRESH, 1000, NULL);

	g_dlg = this;
	m_initing = false;
	return FALSE;
}
示例#2
0
文件: FindBar.cpp 项目: plus7/DonutG
void CDonutFindBar::_OnEnterKeyDown(int flag)
{
	CString  str;
	str = MtlGetWindowText(m_cmbKeyword);

	if ( !str.IsEmpty() ) {
		SHORT sShift = ::GetKeyState(VK_SHIFT);
		if (sShift < 0)
			SendMessage(GetTopLevelParent(), WM_USER_FIND_KEYWORD, (WPARAM) str.GetBuffer(0), FALSE);
		else 
			SendMessage(GetTopLevelParent(), WM_USER_FIND_KEYWORD, (WPARAM) str.GetBuffer(0), TRUE );
	}
}
示例#3
0
LRESULT CALLBACK CReBar::LLMouseProc(int nCode, WPARAM wParam, LPARAM lParam)
{
	// Store information passed to the procedure

	static HHOOK hhk = NULL;
	if (nCode == -1 && wParam == -1)
	{
		hhk = (HHOOK)lParam;
		return 0;
	}

	static CReBar *pReBar = NULL;
	if (nCode == -2 && wParam == -2)
	{
		pReBar = (CReBar*)lParam;
		return 0;
	}

	// Handle mouse messages

	if (wParam == WM_LBUTTONDOWN)
	{
		POINT pt;
		GetCursorPos(&pt);
		//ScreenToClient(pCategoryBar->m_hWnd, &pt);
		//
		//if (PtInRect(&pCategoryBar->m_rcToolsBtn, pt))
		//{
		//	PostMessage(pCategoryBar->m_hWnd, WM_LBUTTONDOWN, -1, -1); // ignore next click
		//	PostMessage(GetTopLevelParent(pCategoryBar->m_hWnd), WM_CANCELMODE, 0, 0);
		//}

		RECT rc;
		GetWindowRect(pReBar->m_btnTools, &rc);
		if (PtInRect(&rc, pt))
		{
			PostMessage(pReBar->m_hWnd, WM_COMMAND, ID_TOOLS, -1); // ignore next click
			PostMessage(GetTopLevelParent(pReBar->m_hWnd), WM_CANCELMODE, 0, 0);
		}

		GetWindowRect(pReBar->m_btnSort, &rc);
		if (PtInRect(&rc, pt))
		{
			PostMessage(pReBar->m_hWnd, WM_COMMAND, ID_SORT, -1); // ignore next click
			PostMessage(GetTopLevelParent(pReBar->m_hWnd), WM_CANCELMODE, 0, 0);
		}
	}

	return CallNextHookEx(hhk, nCode, wParam, lParam);
}
void DX5_DInputReset(_THIS, int fullscreen)
{
	DWORD level;
	int i;
	HRESULT result;
	HWND topwnd;

	for ( i=0; i<MAX_INPUTS; ++i ) {
		if ( SDL_DIdev[i] != NULL ) {
			if ( fullscreen ) {
				level = inputs[i].raw_level;
			} else {
				level = inputs[i].win_level;
			}
			IDirectInputDevice2_Unacquire(SDL_DIdev[i]);
			topwnd = GetTopLevelParent(SDL_Window);
			result = IDirectInputDevice2_SetCooperativeLevel(
					SDL_DIdev[i], topwnd, level);
			IDirectInputDevice2_Acquire(SDL_DIdev[i]);
			if ( result != DI_OK ) {
				SetDIerror(
			"DirectInputDevice::SetCooperativeLevel", result);
			}
		}
	}
	mouse_lost = 1;

	
	DX5_CheckInput(this, 0, FALSE);
}
示例#5
0
BOOL CEnEdit::SetButtonWidthDLU(UINT nID, int nDLU)
{
	ASSERT (GetSafeHwnd());

	int nWidth = CDlgUnits(*GetTopLevelParent()).ToPixelsX(nDLU);
	return SetButtonWidth(nID, nWidth);
}
BOOL CXTPShortcutBarPopup::OnNcCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (!CWnd::OnNcCreate(lpCreateStruct))
		return FALSE;

	if (GetStyle() & MFS_SYNCACTIVE)
	{
		// syncronize activation state with top level parent
		CWnd* pParentWnd = GetTopLevelParent();
		ASSERT(pParentWnd != NULL);
		if (!pParentWnd)
			return FALSE;

		CWnd* pActiveWnd = GetForegroundWindow();
		BOOL bActive = (pParentWnd == pActiveWnd) ||
			(pParentWnd->GetLastActivePopup() == pActiveWnd &&
			pActiveWnd->SendMessage(WM_FLOATSTATUS, FS_SYNCACTIVE) != 0);

		// the WM_FLOATSTAzTUS does the actual work
		SendMessage(WM_FLOATSTATUS, bActive ? FS_ACTIVATE : FS_DEACTIVATE);
	}


	return TRUE;
}
示例#7
0
//-----------------------------------------------------------------------------
// Name: OnInitialUpdate()
// Desc: When the AppForm object is created, this function is called to
//       initialize it. Here we getting access ptrs to some of the controls,
//       and setting the initial state of some of them as well.
//-----------------------------------------------------------------------------
VOID CAppForm::OnInitialUpdate()
{
	// Update the UI
    CFormView::OnInitialUpdate();
	InitializeUIControls();

    // Save static reference to the render window
    m_hwndRenderWindow = GetDlgItem(IDC_RENDERVIEW)->GetSafeHwnd();

    // Register a class for a fullscreen window
    WNDCLASS wndClass = { CS_HREDRAW | CS_VREDRAW, FullScreenWndProc, 0, 0, NULL,
                          NULL, NULL, (HBRUSH)GetStockObject(WHITE_BRUSH), NULL,
                          _T("Fullscreen Window") };
    RegisterClass( &wndClass );

    // We create the fullscreen window (not visible) at startup, so it can
    // be the focus window.  The focus window can only be set at CreateDevice
    // time, not in a Reset, so ToggleFullscreen wouldn't work unless we have
    // already set up the fullscreen focus window.
    m_hwndRenderFullScreen = CreateWindow( _T("Fullscreen Window"), NULL,
                                           WS_POPUP, CW_USEDEFAULT,
                                           CW_USEDEFAULT, 100, 100,
                                           GetTopLevelParent()->GetSafeHwnd(), 0L, NULL, 0L );

    // Note that for the MFC samples, the device window and focus window
    // are not the same.
    CD3DApplication::m_hWnd = m_hwndRenderWindow;
    CD3DApplication::m_hWndFocus = m_hwndRenderFullScreen;
    CD3DApplication::Create( AfxGetInstanceHandle() );
}
示例#8
0
BOOL CTrayIcon::AddToTray()
{
	NOTIFYICONDATA_TI nid;

	nid.cbSize = sizeof(nid);
	nid.hWnd = GetSafeHwnd();
	nid.uID = GetDlgCtrlID();
	nid.uFlags = NIF_MESSAGE | NIF_ICON;
	nid.uCallbackMessage = WM_TINOTIFY;
	nid.hIcon = m_hIcon;

	if (!m_sTip.IsEmpty())
	{
		nid.uFlags |= NIF_TIP;
		//fabio_2005
#if _MSC_VER >= 1400
		_tcsncpy_s(nid.szTip, (LPTSTR)(LPCTSTR)m_sTip, sizeof(nid.szTip)/sizeof(TCHAR));
#else
		_tcsncpy(nid.szTip, (LPTSTR)(LPCTSTR)m_sTip, sizeof(nid.szTip)/sizeof(TCHAR));
#endif
		
		nid.szTip[sizeof(nid.szTip)/sizeof(TCHAR)-1] = (TCHAR)0;
	}

	// create top level parent hook first time around
	if (!ScIsHooked())
	{
		CWnd* pTLParent = GetTopLevelParent();

		if (pTLParent)
			ScHookWindow(pTLParent->GetSafeHwnd());
	}

	return Shell_NotifyIcon(NIM_ADD, (PNOTIFYICONDATA)&nid);
}
示例#9
0
void CFrameWnd::NotifyFloatingWindows( DWORD dwFlags )
/****************************************************/
{
    CWnd *pTopLevel = GetTopLevelParent();
    if( pTopLevel != this ) {
        if( dwFlags & FS_ACTIVATE ) {
            ASSERT( !(dwFlags & FS_DEACTIVATE) );
            pTopLevel->SendMessage( WM_NCACTIVATE, TRUE );
        }
        if( dwFlags & FS_DEACTIVATE ) {
            ASSERT( !(dwFlags & FS_ACTIVATE) );
            pTopLevel->SendMessage( WM_NCACTIVATE, FALSE );
        }
    }
    
    HWND hWndDesktop = ::GetDesktopWindow();
    HWND hWndChild = ::GetWindow( hWndDesktop, GW_CHILD );
    while( hWndChild != NULL ) {
        HWND hWndOwner = ::GetWindow( hWndChild, GW_OWNER );
        while( hWndOwner != NULL ) {
            if( hWndOwner == m_hWnd ) {
                ::SendMessage( hWndChild, WM_FLOATSTATUS, dwFlags, 0L );
                break;
            }
            hWndOwner = ::GetWindow( hWndOwner, GW_OWNER );
        }
        hWndChild = ::GetWindow( hWndChild, GW_HWNDNEXT );
    }
}
示例#10
0
LRESULT CQuickFilterDlg::OnEnChangeQfText(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
	if (!m_internalUpdatingUI)
	{
		UpdateQuickFilter();
		SendMessage(GetTopLevelParent(), WM_FILTER_CHANGE, 0, 0);
	}
	return 0;
}
void CExtStatusControlBar::OnPaint() 
{
	_SyncStatusBarColors();
CPaintDC dc( this );
	//Default();
	CStatusBar::UpdateAllPanes( FALSE, TRUE );
	CStatusBar::DefWindowProc(WM_PAINT,(WPARAM)dc.GetSafeHdc(),0);

CWnd * pWnd = GetTopLevelParent();
	if( pWnd != NULL )
	{
		WINDOWPLACEMENT _wp;
		::memset( (void*)&_wp, 0, sizeof(WINDOWPLACEMENT) );
		_wp.length = sizeof(WINDOWPLACEMENT);
		pWnd->GetWindowPlacement( &_wp );
		if( _wp.showCmd != SW_SHOWMAXIMIZED )
		{
			CRect rcGrip;
			GetClientRect( &rcGrip );
			rcGrip.left = rcGrip.right - ::GetSystemMetrics( SM_CXVSCROLL );
			dc.FillSolidRect(
				&rcGrip,
				g_PaintManager->GetColor(CExtPaintManager::CLR_3DFACE_OUT)
				);
			CFont * pOldFont =
				dc.SelectObject( &g_PaintManager->m_FontMarlett );
			ASSERT( pOldFont != NULL );
			COLORREF clrOld =
				dc.SetTextColor(
					g_PaintManager->GetColor( CExtPaintManager::CLR_TEXT_OUT )
					);
			INT nOldBkMode = dc.SetBkMode(TRANSPARENT);
			rcGrip.OffsetRect( -2, -2 );
			dc.DrawText(
				_T("o"), 1, rcGrip, DT_SINGLELINE|DT_RIGHT|DT_BOTTOM
				);
			dc.SetBkMode( nOldBkMode );
			dc.SetTextColor( clrOld );
			dc.SelectObject( pOldFont );
		} // if( _wp.showCmd != SW_SHOWMAXIMIZED )
	} // if( pWnd != NULL )

    dc.SelectStockObject( NULL_BRUSH );
INT nItem = m_bOuterRectInFirstBand ? 0 : 1;
	for( ; nItem < m_nCount; nItem++ )
	{
		CRect rc;
		GetItemRect( nItem, rc );
		CExtPaintManager::PAINTCONTROLBARBORDERSDATA _pcbbd(
			this,
			CExtPaintManager::__CB_INNER_STATUSBAR_ITEM,
			0,
			rc
			);
		g_PaintManager->PaintControlBarBorders( dc, _pcbbd );
	} // for( ; nItem < m_nCount; nItem++ )
}
示例#12
0
void CMainFrame::WinHelp(DWORD dwData, UINT nCmd)
{
	if (RDialog::m_pHintBox)
		RDialog::m_pHintBox->ShowWindow(false);
	CWinApp* pApp = AfxGetApp();
	ASSERT_VALID(pApp);
	ASSERT(pApp->m_pszHelpFilePath != NULL);

	CWaitCursor wait;
	if (IsFrameWnd())
	{
		// CFrameWnd windows should be allowed to exit help mode first
		CFrameWnd* pFrameWnd = (CFrameWnd*)this;
		pFrameWnd->ExitHelpMode();
	}

	// cancel any tracking modes
	SendMessage(WM_CANCELMODE);
	SendMessageToDescendants(WM_CANCELMODE, 0, 0, TRUE, TRUE);

	// need to use top level parent (for the case where m_hWnd is in DLL)
	CWnd* pWnd = GetTopLevelParent();
	pWnd->SendMessage(WM_CANCELMODE);
	pWnd->SendMessageToDescendants(WM_CANCELMODE, 0, 0, TRUE, TRUE);

	// attempt to cancel capture
	HWND hWndCapture = ::GetCapture();
	if (hWndCapture != NULL)
		::SendMessage(hWndCapture, WM_CANCELMODE, 0, 0);

	TRACE3("WinHelp: pszHelpFile = '%s', dwData: $%lx, fuCommand: %d.\n",
		pApp->m_pszHelpFilePath, dwData, nCmd);
/*x0r disable help
//Command equates are different between WinHelp and HTMLHelp. Why?
	switch (nCmd)
	{
	case	HELP_CONTEXT:
 //DeadCode RJS 03May100			nCmd=HH_DISPLAY_TOPIC;
			nCmd=HH_HELP_CONTEXT;
			break;
	}


	// finally, run the Windows Help engine
//DeadCode RJS 03May100 	if (!HtmlHelp(pWnd->m_hWnd, CString(pApp->m_pszHelpFilePath)+"::/asset.htm", nCmd, 0))
//DEADCODE DAW 15/05/00 	if (!HtmlHelp(NULL, pApp->m_pszHelpFilePath, nCmd, dwData&0xffff))
	if (!HtmlHelp(pWnd->m_hWnd, pApp->m_pszHelpFilePath, nCmd, dwData&0xffff))
	{
		dwData=IDD_RAFCOMMANDBRIEFING;
		if (!HtmlHelp(pWnd->m_hWnd, pApp->m_pszHelpFilePath, nCmd, dwData&0xffff))
			AfxMessageBox(AFX_IDP_FAILED_TO_LAUNCH_HELP);
	}
	*/
}
示例#13
0
LRESULT CQuickFilterDlg::OnBnClickedQfResetfilter(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
	quickfilter& qf = CConfig::Instance()->GetConfig().log_quickfilter;
	qf.tags.clear();
	qf.text.clear();
	qf.level = 0;
	UpdateUI();
	::PostMessage(GetTopLevelParent(), WM_FILTER_CHANGE, 0, 0);

	return 0;
}
示例#14
0
void CCoolBarCtrl::OnTimer(UINT nIDEvent) 
{
	if ( m_bRecalc )
	{
		CMDIFrameWnd* pOwner = (CMDIFrameWnd*)GetOwner();

		if ( pOwner != NULL && pOwner->IsKindOf( RUNTIME_CLASS(CMDIFrameWnd) ) )
		{
			if ( ! pOwner->IsIconic() )
			{
				pOwner->RecalcLayout();
				m_bRecalc = FALSE;
			}
		}
	}

	if ( nIDEvent == 1 && ( ! m_bMenuGray || m_pDown == NULL ) )
	{
		CRect rcWindow;
		CPoint point;

		GetCursorPos( &point );
		ScreenToClient( &point );
		GetClientRect( &rcWindow );

		if ( rcWindow.PtInRect( point ) && GetTopLevelParent()->IsWindowEnabled() )
		{
			CCoolBarItem* pItem = HitTest( point );

			if ( m_pDown && m_pDown != pItem ) pItem = NULL;

			if ( pItem != m_pHot )
			{
				m_pHot = pItem;
				Invalidate();
			}
		}
		else
		{
			KillTimer( nIDEvent );
			m_bTimer = FALSE;

			if ( m_pHot )
			{
				m_pHot = NULL;
				Invalidate();
			}
		}
	}

	CControlBar::OnTimer( nIDEvent );
}
示例#15
0
void CGuiToolButton::OnMouseMove(UINT nFlags, CPoint 
								 point)
{
	// TODO: Add your message handler code here and/or call default
	if (m_bMouserOver) return;
	if (!IsTopParentActive() || !GetTopLevelParent()->IsWindowEnabled())
		return;
	CRect rc;
	GetClientRect(rc);
	if (rc.PtInRect(point))
	{
		m_bMouserOver=TRUE;
		SetTimer(1,50,0);
		UPDATEWIN 		
	}
示例#16
0
void CDonutClipboardBar::OnUpdateClipboard()
{
	if (CMainOption::s_bIgnoreUpdateClipboard)
		return;

	clbTRACE( _T("OnUpdateClipboard\n") );
	CString 	strText = MtlGetClipboardText();
	if ( strText.IsEmpty() )
		return;

	CWebBrowser2	browser = DonutGetIWebBrowser2( GetTopLevelParent() );
	if ( !browser.IsBrowserNull() ) {
		CString strUrl = browser.GetLocationURL();

		if (strUrl == strText)
			return;
	}

	if ( _check_flag(CLPV_EX_FLUSH, m_dwExStyle) )
		m_box.ResetContent();

	CSimpleArray<CString>	arrExt;
	MtlBuildExtArray( arrExt, MtlGetWindowText(m_edit) );

	CSimpleArray<CString>	arrUrl;
	MtlBuildUrlArray(arrUrl, arrExt, strText);

	if (arrUrl.GetSize() == 0) {
		return;
	} else {
		if ( _check_flag(CLPV_EX_FLUSH, m_dwExStyle) )
			m_box.ResetContent();
	}

	for (int i = 0; i < arrUrl.GetSize(); ++i) {
		if (m_box.GetCount() == 0)
			m_box.AddString(arrUrl[i]);
		else
			m_box.InsertString(0, arrUrl[i]);
	}

	if ( _check_flag(CLPV_EX_DIRECT, m_dwExStyle) ) {
		for (int i = 0; i < arrUrl.GetSize(); ++i) {
			DonutOpenFile(m_hWnd, arrUrl[i], 0);
		}
	}
}
LRESULT CXTPSkinObjectFrame::OnSetText(WPARAM wParam, LPARAM lParam)
{
    if (((GetStyle() & WS_CAPTION) == WS_CAPTION) && (GetSkinManager()->GetApplyOptions() & xtpSkinApplyFrame))
    {
        LRESULT lRet = DefWindowProc(WM_SETTEXT, wParam, lParam);

        RedrawFrame();

        if ((GetExStyle() & WS_EX_MDICHILD) && (GetStyle() & (WS_MAXIMIZE | WS_CHILD)) == (WS_MAXIMIZE | WS_CHILD))
        {
            CWnd* pWnd = GetTopLevelParent();
            pWnd->SendMessage(WM_NCPAINT, 0, 0);
        }

        return lRet;
    }

    return Default();
}
示例#18
0
void CWnd::OnHelp()  // use context to derive help context
{
	// attempt to map current context to help topic
	CWnd* pWnd = GetTopLevelParent();
	HWND hWnd = ::GetLastActivePopup(pWnd->GetSafeHwnd());
	while (hWnd != NULL)
	{
		// attempt to process help
		if (::SendMessage(hWnd, WM_COMMANDHELP, 0, 0))
			break;

		// check next parent/owner in the parent/owner chain
		hWnd = AfxGetParentOwner(hWnd);
	}
	if (hWnd == NULL)
	{
		// No context available, bring up default.
		SendMessage(WM_COMMAND, ID_DEFAULT_HELP);
	}
}
示例#19
0
STDMETHODIMP CDonutView::Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
{
	m_spDropTargetHelper->Drop(pDataObj, (LPPOINT)&pt, *pdwEffect);

	if (m_bDragAccept && m_bUseCustomDropTarget) {
		CSimpleArray<CString>	arrFiles;
		if ( MtlGetDropFileName(pDataObj, arrFiles) ) {	// ファイルがDropされた
			unsigned  df   = DonutGetStdOpenFlag();
			unsigned  size = arrFiles.GetSize();
			//if (size == 1)
			//	df |= D_OPENFILE_NOCREATE;
			for (unsigned i = 0; i < size; ++i)
				DonutOpenFile(m_hWnd, arrFiles[i], df);
			*pdwEffect = DROPEFFECT_COPY;
		} else {
			CString strText;
			if (   MtlGetHGlobalText(pDataObj, strText)
				|| MtlGetHGlobalText(pDataObj, strText, CF_SHELLURLW) )
			{
				::SendMessage(GetTopLevelParent(), WM_COMMAND_DIRECT, m_nDDCommand, (LPARAM) (LPCTSTR) strText);
				*pdwEffect = DROPEFFECT_NONE;
			}
		}
	} else if (MTL::MtlIsDataAvailable(pDataObj, CF_SHELLURLW)) {	// タブなどから
		CString strURL;
		MtlGetHGlobalText(pDataObj, strURL, CF_SHELLURLW);
		if (strURL.IsEmpty() == FALSE) {
			MTL::ParseInternetShortcutFile(strURL);	// ファイルパス->URL
			Navigate2(strURL);
		}

	} else if (m_bExternalDrag) {	// 外部から
		CString strURL;
		MtlGetHGlobalText(pDataObj, strURL, ::RegisterClipboardFormat(CFSTR_FILENAME));
		if (strURL.IsEmpty() == FALSE) {
			MTL::ParseInternetShortcutFile(strURL);	// ファイルパス->URL
			Navigate2(strURL);
		}
	}
	return S_OK;
}
void CDockButton::OnMouseMove(UINT nFlags, CPoint point)
{
    // TODO: Add your message handler code here and/or call default
    if (m_bMouseOver) return;

    if (!IsTopParentActive() || !GetTopLevelParent()->IsWindowEnabled())
        return;
    CRect m_rect;
    GetClientRect(m_rect);
    if (m_rect.PtInRect(point))
    {

        CGuiControlBar* m_tb=GetBar(m_hWnd);
        if 	((m_tb->IsVisible() && m_tb->IsAutoHide()) )
        {

            m_tb->ScrollOff();
            GetParentFrame()->ShowControlBar(m_tb, FALSE, FALSE);
        }
        else
        {
            if 	(!m_tb->IsVisible())
            {
                CGuiControlBar* m_tb1=IsControlVisible(m_tb);
                if (m_tb1!= NULL)
                {
                    if (m_tb1 != m_tb)
                    {
                        GetParentFrame()->ShowControlBar(m_tb1, FALSE, TRUE);
                    }
                }
                m_tb->ScrollOn();
                m_bMouseOver=TRUE;  //numero de ventana a activar
                SetTimer(1,500,0);
            }
        }
    }


    CWnd::OnMouseMove(nFlags, point);
}
示例#21
0
文件: winfrmx.cpp 项目: Rupan/winscp
void CWnd::OnHelp()  // use context to derive help context
{
	// attempt to get help from whoever is tracking
	HWND hWnd = ::GetCapture();
	while (hWnd != NULL)
	{
		// attempt to process help
		if (::SendMessage(hWnd, WM_COMMANDHELP, 0, 0))
			return;

		// check next parent/owner in the parent/owner chain
		hWnd = AfxGetParentOwner(hWnd);
	}
	// attempt to get help from whoever has the focus
	hWnd = ::GetFocus();
	while (hWnd != NULL)
	{
		// attempt to process help
		if (::SendMessage(hWnd, WM_COMMANDHELP, 0, 0))
			return;

		// check next parent/owner in the parent/owner chain
		hWnd = AfxGetParentOwner(hWnd);
	}
	// attempt to get help from the active window
	CWnd* pWnd = GetTopLevelParent();
	hWnd = ::GetLastActivePopup(pWnd->GetSafeHwnd());
	while (hWnd != NULL)
	{
		// attempt to process help
		if (::SendMessage(hWnd, WM_COMMANDHELP, 0, 0))
			return;

		// check next parent/owner in the parent/owner chain
		hWnd = AfxGetParentOwner(hWnd);
	}
	// No context available, bring up default.
	SendMessage(WM_COMMAND, ID_DEFAULT_HELP);
}
示例#22
0
int CControlBar::HitTestToolTip(CPoint point, UINT* pHit)
{
	if (pHit != NULL)
		*pHit = (UINT)-1;   // assume it won't hit anything

	// make sure this app is active
	if (!IsTopParentActive())
		return HITTYPE_INACTIVE;

	// make sure the toolbar itself is active
	CWnd* pParent = GetTopLevelParent();
	if (!pParent->IsWindowEnabled())
		return HITTYPE_DISABLED;

	// check for this application tracking (capture set)
	CWnd* pCapture = GetCapture();
	CWnd* pCaptureParent = pCapture->GetTopLevelParent();
	if (pCaptureParent == pParent)
		return HITTYPE_TRACKING;

	// check for the bar having focus
	HWND hWnd = ::GetFocus();
	if (hWnd != NULL && (hWnd == m_hWnd || ::IsChild(m_hWnd, hWnd)))
		return HITTYPE_FOCUS;

	// see if the mouse point is actually in the control bar window
	hWnd = ::WindowFromPoint(point);
	if (hWnd == NULL || (hWnd != m_hWnd && !::IsChild(m_hWnd, hWnd)))
		return HITTYPE_OUTSIDE;

	// finally do the hit test on the items within the control bar
	ScreenToClient(&point);
	UINT nHit = OnCmdHitTest(point, NULL);
	if (pHit != NULL)
		*pHit = nHit;
	return nHit != (UINT)-1 ? HITTYPE_SUCCESS : HITTYPE_NOTHING;
}
示例#23
0
bool CIVStatusBar::IsOverURL(CPoint pt, CString & rstr )
{

	if ( ! IsWindowEnabled()  || !GetTopLevelParent()->IsWindowEnabled()   )
		return false;

	CStatusBarCtrl & sb = GetStatusBarCtrl();
	int iPart = -1;
	CRect rc;
	for (int i=0; i < sb.GetParts(0, NULL); i++ )
	{
		sb.GetRect (i, rc);
		if (rc.PtInRect(pt) && ( GetPaneStyle(i) & SBT_OWNERDRAW )  )
		{
			iPart = i;
			break;
		}
	}

	if (iPart == -1)
		return false;

	if ( ! (GetPaneStyle(iPart)  & SBPS_NOBORDERS) )
		rc.InflateRect(-GetSystemMetrics(SM_CYBORDER), -GetSystemMetrics(SM_CXBORDER));

	if (!rc.PtInRect(pt))
		return false;

	CString strText = GetPaneText(iPart);
	CDC * pDC = GetDC();

	CFont * pFont = GetFont();
	CFont fntURL;
	GetLinkFont(fntURL);
	
	CFont * pOldFont =  pDC->SelectObject (pFont);

	int x = CalcX (pDC, rc, strText);

	bool bFound = false;
	for (int i = 0; i < strText.GetLength();)
	{
		CSize szPos = FindURL (strText, i );
		if (szPos.cx != -1)
		{
			CString strStart = strText.Mid (i, szPos.cx-i);
			CRect rcURL;
			x += pDC->GetTextExtent (strStart).cx;
			rcURL.left = x;
	
			pFont = pDC->SelectObject (&fntURL);
		
			CString strURL = strText.Mid(szPos.cx, szPos.cy);
			
			CSize szURL =  pDC->GetTextExtent (strURL);
			x += szURL.cx;
			
			rcURL.right = x;
			rcURL.top = rc.top;
			rcURL.bottom = rc.top + szURL.cy;

			pDC->SelectObject (pFont);
			
			if (rcURL.PtInRect(pt))
			{
				rstr = strURL;
				bFound = true;
				break;
			}

			i = szPos.cx + szPos.cy;
		}
		else
			break;

	}

	pDC->SelectObject (pOldFont);


	return bFound;
}
示例#24
0
void CControlBar::OnTimer(UINT_PTR nIDEvent)
{
	if (GetKeyState(VK_LBUTTON) < 0)
		return;

	AFX_MODULE_THREAD_STATE* pModuleThreadState = AfxGetModuleThreadState();

	// get current mouse position for hit test
	CPoint point; GetCursorPos(&point);
	ScreenToClient(&point);
	INT_PTR nHit = OnToolHitTest(point, NULL);
	if (nHit >= 0)
	{
		CWnd *pParent=GetTopLevelParent();
		// determine if status bar help should go away
        if(!IsTopParentActive())
        {
            nHit=-1;
        }
        else
        {
			ENSURE(pParent);
		    if(!pParent->IsWindowEnabled())
            {
			    nHit = -1;
            }
        }

		// remove status help if capture is set
		HWND hWndTip = pModuleThreadState->m_pToolTip->GetSafeHwnd();
		CWnd* pCapture = GetCapture();
		if (pCapture != this && pCapture->GetSafeHwnd() != hWndTip &&
			pCapture->GetTopLevelParent() == pParent)
		{
			nHit = -1;
		}
	}
	else
	{
		pModuleThreadState->m_nLastStatus = static_cast<INT_PTR>(-1);
	}

	// make sure it isn't over some other app's window
	if (nHit >= 0)
	{
		ClientToScreen(&point);
		HWND hWnd = ::WindowFromPoint(point);
		if (hWnd == NULL || (hWnd != m_hWnd && !::IsChild(m_hWnd, hWnd) &&
			pModuleThreadState->m_pToolTip->GetSafeHwnd() != hWnd))
		{
			nHit = -1;
			pModuleThreadState->m_nLastStatus = static_cast<INT_PTR>(-1);
		}
	}

	// handle the result
	if (nHit < 0)
	{
		if (pModuleThreadState->m_nLastStatus == static_cast<INT_PTR>(-1))
			KillTimer(ID_TIMER_CHECK);
		SetStatusText(static_cast<INT_PTR>(-1));
	}

	// set status text after initial timeout
	if (nIDEvent == ID_TIMER_WAIT)
	{
		KillTimer(ID_TIMER_WAIT);
		if (nHit >= 0)
			SetStatusText(nHit);
	}
}
示例#25
0
文件: MyDlg.cpp 项目: bugou/test
void CMyDlg::setTop()
{
	GetTopLevelParent()->SetForegroundWindow();
	ShowWindow(SW_NORMAL);
}
示例#26
0
void CReBar::OnCommand(WORD id, WORD notifyCode, HWND hWndControl)
{
	switch (id)
	{
	case ID_TOOLS:
	{
		// If the button is clicked again while menu is shown, we shouldn't show it again

		static bool bIgnoreNext = false;
		if (hWndControl == (HWND)-1)
		{
			bIgnoreNext = true;
			return;
		}
		if (bIgnoreNext)
		{
			bIgnoreNext = false;
			return;
		}

		// Install a hook to capture mouse events when the menu is shown

		HHOOK hHook = SetWindowsHookEx(WH_MOUSE_LL, LLMouseProc, GetModuleHandle(NULL), 0);
		ASSERT(hHook);
		LLMouseProc(-1, -1, (LPARAM)hHook);
		LLMouseProc(-2, -2, (LPARAM)this);

		// Show menu, make sure commands get sent to the main window

		RECT rc;
		GetWindowRect(m_btnTools, &rc);

		VERIFY(TrackPopupMenu(m_hToolsMenu, TPM_RIGHTALIGN|TPM_TOPALIGN, rc.right, rc.bottom, 
				0, GetTopLevelParent(m_hWnd), NULL));

		UnhookWindowsHookEx(hHook);

		// Restore button state

		POINT pt;
		GetCursorPos(&pt);
		ScreenToClient(m_btnTools, &pt);

		PostMessage(m_btnTools, WM_LBUTTONUP, 0, MAKELPARAM(pt.x, pt.y));
	}
		break;
	case ID_TOOLS_STATUSBAR:
		CheckMenuItem(m_hToolsMenu, ID_TOOLS_STATUSBAR, 
				(GETPREFBOOL(_T("MainWnd"), _T("ShowStatusBar")) ? MF_CHECKED : MF_UNCHECKED));
		break;
	case ID_TOOLS_LOG:
		CheckMenuItem(m_hToolsMenu, ID_TOOLS_LOG, 
				(GETPREFBOOL(_T("MainWnd"), _T("ShowLog")) ? MF_CHECKED : MF_UNCHECKED));
		break;
	case ID_SEEN:
		m_btnSeen.SetCheck(!m_btnSeen.GetCheck());
		SETPREFBOOL(_T("ShowSeenMovies"), m_btnSeen.GetCheck());
		SendMessage(*GetDB(), WM_PREFCHANGED);
		GetDB()->Filter();
		break;
	case ID_VIEW:
		m_btnView.SetCheck(!m_btnView.GetCheck());
		SETPREFBOOL(_T("ViewType"), m_btnView.GetCheck());
		SendMessage(GetMainWnd(), WM_SWITCHVIEW);
		break;
	case ID_TOGGLEVIEWSTATUS:
		m_btnView.SetCheck(!m_btnView.GetCheck());
		break;
	case ID_SORT:
		{
		// If the button is clicked again while menu is shown, we shouldn't show it again

		static bool bIgnoreNext = false;
		if (hWndControl == (HWND)-1)
		{
			bIgnoreNext = true;
			return;
		}
		if (bIgnoreNext)
		{
			bIgnoreNext = false;
			return;
		}

		// Install a hook to capture mouse events when the menu is shown

		HHOOK hHook = SetWindowsHookEx(WH_MOUSE_LL, LLMouseProc, GetModuleHandle(NULL), 0);
		ASSERT(hHook);
		LLMouseProc(-1, -1, (LPARAM)hHook);
		LLMouseProc(-2, -2, (LPARAM)this);

		// Show menu, make sure commands get sent to THIS window

		RECT rc;
		GetWindowRect(m_btnSort, &rc);

		VERIFY(TrackPopupMenu(m_hSortMenu, TPM_RIGHTALIGN|TPM_TOPALIGN, rc.right, rc.bottom, 
				0, m_hWnd, NULL));

		UnhookWindowsHookEx(hHook);

		// Restore button state

		POINT pt;
		GetCursorPos(&pt);
		ScreenToClient(m_btnSort, &pt);

		PostMessage(m_btnSort, WM_LBUTTONUP, 0, MAKELPARAM(pt.x, pt.y));
		}
		break;
	case ID_SEARCH:
		if (notifyCode == EN_RETURN || (m_bInstantSearch && notifyCode == EN_CHANGE))
		{
			RString strText = m_eSearch.GetText();
			RObArray<RString> keywords;

			if (m_bLiteralSearch)
			{
				if (!strText.IsEmpty())
					keywords.Add(strText);
			}
			else
			{
				RRegEx re(_T("(?:\"([^\"]+)\")|([^ ]+)"));
				if (!strText.IsEmpty())
					keywords.Add(strText);
				while (re.Search(strText))
				{
					RString strMatch;
					for (INT_PTR i = 1; i < re.GetMatchCount() && strMatch.IsEmpty(); ++i)
						strMatch = re.GetMatch(i);
					strMatch.Replace(_T("\""), _T(""));
					keywords.Add(strMatch);
					strText.Replace(re.GetMatch(0), _T(""));
				}
			}
			GetDB()->FilterByKeywords(keywords);
		}
		break;
	case ID_SORT_TITLEASC:
	case ID_SORT_TITLEDES:
	case ID_SORT_YEARASC:
	case ID_SORT_YEARDES:
	case ID_SORT_RATINGASC:
	case ID_SORT_RATINGDES:
	case ID_SORT_FILETIMEASC:
	case ID_SORT_FILETIMEDES:
		SETPREFINT(_T("SortBy"), id - ID_SORT_TITLEASC);
		CheckMenuRadioItem(m_hSortMenu, ID_SORT_TITLEASC, ID_SORT_FILETIMEDES, id, MF_CHECKED);
		PostMessage(*GetDB(), WM_PREFCHANGED);
		PostMessage(m_hWnd, WM_COMMAND, MAKEWPARAM(ID_SEARCH, EN_RETURN), (LPARAM)(HWND)m_eSearch);
		break;
	default:
		ASSERT(false);
	}
}
示例#27
0
void MainWnd::OnInitMenuPopup(CMenu* pMenu, UINT nIndex, BOOL bSysMenu) 
{
  ASSERT(pMenu != NULL);
  
  CCmdUI state;
  state.m_pMenu = pMenu;
  ASSERT(state.m_pOther == NULL);
  ASSERT(state.m_pParentMenu == NULL);
  
  // determine if menu is popup in top-level menu and set m_pOther to
  //  it if so (m_pParentMenu == NULL indicates that it is secondary popup)
  HMENU hParentMenu;
  if (AfxGetThreadState()->m_hTrackingMenu == pMenu->m_hMenu)
    state.m_pParentMenu = pMenu;    // parent == child for tracking popup
  else if ((hParentMenu = ::GetMenu(m_hWnd)) != NULL) {
    CWnd* pParent = GetTopLevelParent();
    // child windows don't have menus -- need to go to the top!
    if (pParent != NULL &&
        (hParentMenu = ::GetMenu(pParent->m_hWnd)) != NULL) {
      int nIndexMax = ::GetMenuItemCount(hParentMenu);
      for (int nIndex = 0; nIndex < nIndexMax; nIndex++) {
        if (::GetSubMenu(hParentMenu, nIndex) == pMenu->m_hMenu) {
          // when popup is found, m_pParentMenu is containing menu
          state.m_pParentMenu = CMenu::FromHandle(hParentMenu);
          break;
        }
      }
    }
  }
  
  state.m_nIndexMax = pMenu->GetMenuItemCount();
  for (state.m_nIndex = 0; state.m_nIndex < state.m_nIndexMax;
       state.m_nIndex++) {
    state.m_nID = pMenu->GetMenuItemID(state.m_nIndex);
    if (state.m_nID == 0)
      continue; // menu separator or invalid cmd - ignore it
    
    ASSERT(state.m_pOther == NULL);
    ASSERT(state.m_pMenu != NULL);
    if (state.m_nID == (UINT)-1) {
      // possibly a popup menu, route to first item of that popup
      state.m_pSubMenu = pMenu->GetSubMenu(state.m_nIndex);
      if (state.m_pSubMenu == NULL ||
          (state.m_nID = state.m_pSubMenu->GetMenuItemID(0)) == 0 ||
          state.m_nID == (UINT)-1) {
        continue;       // first item of popup can't be routed to
      }
      state.DoUpdate(this, FALSE);    // popups are never auto disabled
    } else {
      // normal menu item
      // Auto enable/disable if frame window has 'm_bAutoMenuEnable'
      //    set and command is _not_ a system command.
      state.m_pSubMenu = NULL;
      state.DoUpdate(this, state.m_nID < 0xF000);
    }
    
    // adjust for menu deletions and additions
    UINT nCount = pMenu->GetMenuItemCount();
    if (nCount < state.m_nIndexMax) {
      state.m_nIndex -= (state.m_nIndexMax - nCount);
      while (state.m_nIndex < nCount &&
             pMenu->GetMenuItemID(state.m_nIndex) == state.m_nID) {
        state.m_nIndex++;
      }
    }
    state.m_nIndexMax = nCount;
  }
}
LRESULT CChildFrame::OnFileExtractData(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{ 
    HRESULT hr = E_FAIL; 

    TREE_ITEM_DATA * pTmp = (TREE_ITEM_DATA *)m_pData.GetData(); 

    if (NULL == pTmp) return 0; 

    TCHAR szText[MAX_PATH] = { 0 }; 
    m_pData.GetText(szText, _countof(szText)); 
    ATLTRACE(_T("---------%s\n"), szText); 

    if (STGTY_STREAM == pTmp->dwStgType) 
    { 
        TCHAR szFileName[MAX_PATH] = { 0 }; 

        if (NULL == _tcschr(szText, '.')) 
        { 
            _tcscat(szText, _T(".bin")); 
        } 

        AdjustFileName(szText); 

        TCHAR szFilter[MAX_PATH] = { 0 }; 
        { 
            // assembling filter string 
            TCHAR szAllFiles[MAX_PATH] = { 0 }; 
            AtlLoadString(IDS_ALL_FILES, szAllFiles, _countof(szAllFiles)); 

            wnsprintf(szFilter, _countof(szFilter), _T("%s(*.*)|*.*||"), szAllFiles); 
        } 

        CModifiedFileDialog fd ( FALSE, _T(""), szText, OFN_HIDEREADONLY, szFilter, m_hWnd ); 

        
        if ( IDOK != fd.DoModal(this->m_hWnd) ) 
            return 0; 
        
        lstrcpyn(szFileName, fd.m_szFileName, _countof(szFileName)); 

        if (PathFileExists(szFileName)) { 
            TCHAR szFmt[MAX_PATH] = { 0 }; 
            AtlLoadString(IDS_FILE_EXISTS, szFmt, _countof(szFmt)); 
            TCHAR szMsg[MAX_PATH*2] = { 0 }; 
            wnsprintf(szMsg, _countof(szMsg), szFmt, szFileName); 
            if ( IDYES != AtlMessageBox(m_hWnd, szMsg, IDS_WARNING, MB_YESNO|MB_ICONWARNING)) { 
                return 0; 
            } 
        } 

        CComPtr<IStream> spFile; 
        hr = pTmp->spStgOrStrm->QueryInterface(&spFile); 
        if (FAILED(hr)) return hr; 

        hr = WriteStreamToFile(szFileName, spFile); 
    } 

    else if (STGTY_STORAGE == pTmp->dwStgType) 
    { 
        CModifiedFolderDialog fd ( GetTopLevelParent(), IDS_SELECT_DIR, 
            BIF_RETURNONLYFSDIRS|BIF_NEWDIALOGSTYLE ); 

        TCHAR szCurrPath[MAX_PATH] = { 0 }; 
        GetCurrentDirectory(_countof(szCurrPath), szCurrPath); 

        fd.SetInitialDir( szCurrPath ); 

        if ( IDOK != fd.DoModal() ) 
            return 0; 

        lstrcpyn(szCurrPath, fd.GetFolderPath(), _countof(szCurrPath)); 
        PathAddBackslash(szCurrPath); 

        SHCreateDirectoryEx(*this, szCurrPath, NULL); 

        // recursion 
        _RecursionExtractData(szCurrPath, m_pData, &m_wndCatalog); 
    } 

    return 0; 
} 
示例#29
0
static int DX5_DInputInit(_THIS)
{
	int         i;
	LPDIRECTINPUTDEVICE device;
	HRESULT     result;
	DIPROPDWORD dipdw;
	HWND        topwnd;

	
	result = DInputCreate(SDL_Instance, DIRECTINPUT_VERSION,
							&dinput, NULL);
	if ( result != DI_OK ) {
		SetDIerror("DirectInputCreate", result);
		return(-1);
	}

	
	SDL_DIndev = 0;
	for ( i=0; inputs[i].name; ++i ) {
		
		result = IDirectInput_CreateDevice(dinput, inputs[i].guid,
								&device, NULL);
		if ( result != DI_OK ) {
			SetDIerror("DirectInput::CreateDevice", result);
			return(-1);
		}
		result = IDirectInputDevice_QueryInterface(device,
			&IID_IDirectInputDevice2, (LPVOID *)&SDL_DIdev[i]);
		IDirectInputDevice_Release(device);
		if ( result != DI_OK ) {
			SetDIerror("DirectInputDevice::QueryInterface", result);
			return(-1);
		}
		topwnd =  GetTopLevelParent(SDL_Window);
		result = IDirectInputDevice2_SetCooperativeLevel(SDL_DIdev[i],
					topwnd, inputs[i].win_level);
		if ( result != DI_OK ) {
			SetDIerror("DirectInputDevice::SetCooperativeLevel",
									result);
			return(-1);
		}
		result = IDirectInputDevice2_SetDataFormat(SDL_DIdev[i],
							inputs[i].format);
		if ( result != DI_OK ) {
			SetDIerror("DirectInputDevice::SetDataFormat", result);
			return(-1);
		}

		
		SDL_memset(&dipdw, 0, sizeof(dipdw));
		dipdw.diph.dwSize = sizeof(dipdw);
		dipdw.diph.dwHeaderSize = sizeof(dipdw.diph);
		dipdw.diph.dwObj = 0;
		dipdw.diph.dwHow = DIPH_DEVICE;
		dipdw.dwData = INPUT_QSIZE;
		result = IDirectInputDevice2_SetProperty(SDL_DIdev[i],
						DIPROP_BUFFERSIZE, &dipdw.diph);
		if ( result != DI_OK ) {
			SetDIerror("DirectInputDevice::SetProperty", result);
			return(-1);
		}

		
		SDL_DIevt[i] = CreateEvent(NULL, FALSE, FALSE, NULL);
		if ( SDL_DIevt[i] == NULL ) {
			SDL_SetError("Couldn't create DirectInput event");
			return(-1);
		}
		result = IDirectInputDevice2_SetEventNotification(SDL_DIdev[i],
								SDL_DIevt[i]);
		if ( result != DI_OK ) {
			SetDIerror("DirectInputDevice::SetEventNotification",
									result);
			return(-1);
		}
		SDL_DIfun[i] = inputs[i].fun;

		
		IDirectInputDevice2_Acquire(SDL_DIdev[i]);

		
		++SDL_DIndev;
	}
	mouse_pressed = 0;
	mouse_buttons_swapped = GetSystemMetrics(SM_SWAPBUTTON);

	
	return(0);
}
示例#30
0
void DecodeDlg::DecodeOutLaunch()
{
	LaunchDialog ld;

	int rmax = m_DecodeOut.GetItemCount();

	if (rmax == 0)
		return;					// Nothing to do

	int scount = m_DecodeOut.GetSelectedCount();	// Read number of selected items

	int *slist = (int *) _alloca(sizeof(int) * (scount + 1));	// Create the selection list
	int *eos = slist + scount;			// End

	m_DecodeOut.GetSelectedList(slist, scount);	// Read the selected items

	int *slp = slist;			// Point into the item list
	int *srchp;

	CFileName here, search, appname;

	CString here_ext, temp;
	CString unsafe(".lnk.exe.com.bat.pif.vbs");

	bool multi;					// Multiple

	int rc, flags;
	short row;

	CFileName tname;			// Will be used for temporary names

	decoder->UD.m_overwrite = TRUE;

	while (scount > 0)
	{
		while (*slp == -1)		// Already handled
			slp++;				// Skip

		here = m_DecodeOut.GetItemText(*slp, 0);	// Read a selected item's text

		here_ext = here.Ext();	// Read the extension
		here_ext.MakeLower();

		if (unsafe.Find(here_ext) >= 0)
		{
			if (ArgMessageBox("Decode & Launch", 
					MB_ICONINFORMATION | MB_OKCANCEL,
					"%s\r\nFor your protection, UUDeview won't\r\nLaunch executable files.",
					(const char *) here) == IDCANCEL)
				break;			// User decided to stop
			else
			{
				slp++;			// Move on to the next item
				scount--;
				continue;
			}
		}

		multi = false;			// Start with multi off

		for (srchp=slp+1; srchp < eos; srchp++)
			if (*srchp != -1)
			{
				search = m_DecodeOut.GetItemText(*srchp, 0);
				if (here_ext.CompareNoCase(search.Ext()) == 0)
				{
					multi = true;	// We've got more than one...
					break;
				}
			}

		row = (short) m_DecodeOut.GetItemData(*slp);	// Read row number

		flags = decoder->UD.GetDFileFlags(row);	// Store old flags

		rc = decoder->UD.DFileTo(row,		// Decode it
			tname.InTemp(m_DecodeOut.GetItemText(*slp, 0), tempFolder));	// To "real" name in temp directory

		decoder->UD.SetDFileFlags(row, flags);	// Restore old flags

		if (rc != CUud32acxCtrl::uudRetOK)
		{
			ArgMessageBox("Decode & Launch", MB_ICONEXCLAMATION | MB_OK,
				"Error decoding:\r\n%s", (const char *) tname);
			break;
		}

		CFileName::XFileAdd(tname);		// Delete it later

		if (options[OPT_LNOPROMPT])
		{
			rc = LDIAG_ALL;			// Always do all

			appname = tname.FindExec();	// Read the app from association
		}
		else
		{
			rc = ld.GetLFN(tname, multi, appname.GetStr(), 
				launchOutList, &launchOutDir, &options[OPT_LNOPROMPT]);

			GetTopLevelParent()->RedrawWindow();

			if (options[OPT_LNOPROMPT])
			{
				rc = LDIAG_ALL;
				OptionButtonSet();
			}
		}

		switch (rc)
		{
			case IDCANCEL:		// Jump out
				goto emex;

			case IDOK:
				multi = false;		// Only handle one
				break;

			case LDIAG_ALL:
				multi = true;		// Handle all
				break;
		}

		if ((rc = tname.Exec(appname)) != 0)		// Always do the first one if we get here
		{
			ArgMessageBox("Launch", MB_ICONEXCLAMATION | MB_OK,
				"Error %d executing:\r\n%s",
				rc, (const char *) tname);
			break;
		}

		m_DecodeOut.SetSel(*slp, FALSE);
		*slp++ = -1;		// This one's been done
		scount--;			// One less selected

		if (!multi)		// One only
			continue;

		for (srchp=slp; srchp < eos; srchp++)
			if (*srchp != -1)
			{
				search = m_DecodeOut.GetItemText(*srchp, 0);
				if (here_ext.CompareNoCase(search.Ext()) == 0)
				{
					if (decoder->UD.DFileTo((short) m_DecodeOut.GetItemData(*srchp), 
						tname.InTemp(m_DecodeOut.GetItemText(*srchp, 0), tempFolder)) != CUud32acxCtrl::uudRetOK)
					{
						ArgMessageBox("Decode & Launch", MB_ICONEXCLAMATION | MB_OK,
							"Error decoding:\r\n%s", (const char *) tname);
						break;
					}

					CFileName::XFileAdd(tname);		// Delete it later

					if ((rc = tname.Exec(appname)) != 0)
					{
						ArgMessageBox("Launch", MB_ICONEXCLAMATION | MB_OK,
							"Error %d executing:\r\n%s",
							rc, (const char *) tname);
						goto emex;
					}
					m_DecodeOut.SetSel(*srchp, FALSE);
					*srchp = -1;		// This one's been done
					scount--;			// One less selected
				}						// Ext match
			}							// Not already done

	}									// scount > 0

emex:

	if (ld.m_hWnd != NULL)
		ld.DestroyWindow();

	GetTopLevelOwner()->RedrawWindow();

}