Beispiel #1
0
LRESULT CMainFrame::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
    BOOL oldMin = m_isMinimum;
    //printf("CMainFrame::WindowProc() Msg: %x, WPARAM: %x, LPARAM: %x\n", message, wParam, lParam);
	switch(message)
	{
    case WM_CLOSE:
        printf("received WM_CLOSE!");
        break;
    case WM_SIZE:
        switch ( wParam ) {
        case SIZE_MINIMIZED:
            m_isMinimum = TRUE;
            break;
        case SIZE_MAXIMIZED:
        case SIZE_RESTORED:
            m_isMinimum = FALSE;
            break;
        }
        break;
    case ID_OBTAIN_TGT_WITH_LPARAM:
        GetActiveView()->SendMessage(ID_OBTAIN_TGT_WITH_LPARAM, wParam,
                                     lParam);
        break;
	}

    if ( oldMin != m_isMinimum ) {
        if ( m_isMinimum ) {
            ShowTaskBarButton(FALSE);
            ShowWindow(SW_HIDE);
        }
    }
    return CLeashFrame::WindowProc(message, wParam, lParam);
}
Beispiel #2
0
afx_msg LRESULT CMainFrame::OnIconCallback(WPARAM wParam, LPARAM lParam)
{
	if ((lParam == WM_LBUTTONUP) || (lParam == WM_RBUTTONUP))
	{
		this->ShowWindow(SW_RESTORE);
		Shell_NotifyIcon(NIM_DELETE,iconData);
		ShowTaskBarButton(true);
	}
	return 0;
}
Beispiel #3
0
void CMainFrame::OnSize(UINT nType, int cx, int cy)
{
	if (nType & SIZE_MINIMIZED)
	{
		if (!iconData)
		{
			iconData = new NOTIFYICONDATA;
			iconData->cbSize = NOTIFYICONDATA_V1_SIZE;
			iconData->hWnd = GetSafeHwnd();
			iconData->uID = 0;
			iconData->uFlags = NIF_ICON | NIF_MESSAGE;
			iconData->uCallbackMessage = ID_ICON_CALLBACK;
			iconData->hIcon = (HICON)theApp.LoadIcon(IDR_MAINFRAME);
		}
		Shell_NotifyIcon(NIM_ADD,iconData);
		ShowTaskBarButton(false);
	}
	CFrameWnd::OnSize(nType, cx, cy);
	// TODO: Add your message handler code here
	
}