Ejemplo n.º 1
0
void CForceSyncDlg::OnEditCopy() 
{
	if (!m_List.GetCount())
		return;

    CString txt;
	CString filename;
	for(int i=-1; ++i < m_List.GetCount(); )
	{
		if(!m_List.GetSel(i))
			continue;
		m_List.GetText(i, filename);
		txt += filename + _T("\r\n");
	}

    CopyTextToClipboard(txt);
}
Ejemplo n.º 2
0
bool CLogger::CopyToClipboard(HWND hwnd)
{
	TVTest::String LogText;

	m_Lock.Lock();

	for (auto itr=m_LogList.begin();itr!=m_LogList.end();++itr) {
		TCHAR szText[MAX_LOG_TEXT_LENGTH];

		(*itr)->Format(szText,lengthof(szText));
		LogText+=szText;
		LogText+=TEXT("\r\n");
	}

	m_Lock.Unlock();

	return CopyTextToClipboard(hwnd,LogText.c_str());
}
Ejemplo n.º 3
0
void Explorerplusplus::OnTreeViewCopyItemPath(void)
{
	HTREEITEM		hItem;
	LPITEMIDLIST	pidl;
	TCHAR			szFullFileName[MAX_PATH];

	hItem = TreeView_GetSelection(m_hTreeView);

	if(hItem != NULL)
	{
		pidl = m_pMyTreeView->BuildPath(hItem);

		GetDisplayName(pidl,szFullFileName,SIZEOF_ARRAY(szFullFileName),SHGDN_FORPARSING);

		CopyTextToClipboard(szFullFileName);

		CoTaskMemFree(pidl);
	}
}
Ejemplo n.º 4
0
/* OnClick menu Copy Text */
void CNotificListbox::OnNotificwndCopytoclipboard()
{    
	
	CString omFullText = _T("");
	for (int i = 0; i < GetCount(); i++)
	{
		if (GetSel(i))
		{		
			CString omText = _T("");
			GetText(i, omText);
			if (!omText.IsEmpty())
			{
				//omText = omText + L"\r\n";				
				omText.Format(_T("%s\r\n"), omText);
				omFullText = omFullText + omText;				
			}
		}
	}
    CopyTextToClipboard(omFullText.GetBuffer(MAX_PATH), NULL);
}
Ejemplo n.º 5
0
/* -------------------------------------------------- */
void CopyListViewToClipboard (HWND hListV, int nbSubItems)
{
char *p, *pCur;
int NbMsg, Ark, Evan, NbChar, buf_len;
char buf[256];
     
   NbMsg = ListView_GetItemCount (hListV);
   // Nb chars in list box 
   for (NbChar=0, Ark=0 ;  Ark < NbMsg ;  Ark++)
       for (Evan=0 ; Evan<nbSubItems ; Evan++)
       {
           ListView_GetItemText (hListV, Ark, Evan, buf, sizeof buf);
           NbChar += lstrlen (buf);
       }

   // allocate enough space for char + tabs + end of lines + NULL
   NbChar += 2 * NbMsg + NbMsg * nbSubItems + 1;
   p = malloc (NbChar);
   if (p==NULL) { MessageBeep (-1); return; }

   for (pCur=p, Ark=0 ;  Ark < NbMsg ;  Ark++)
   {
       for (Evan=0 ; Evan<nbSubItems ; Evan++)
       {
           ListView_GetItemText (hListV, Ark, Evan, buf, sizeof buf);
           buf_len = lstrlen (buf);
            // verify that we do not overflow
            // since a thread may have put some text
           if (pCur + buf_len > p +NbChar) break;
           memcpy (pCur, buf, buf_len);
           pCur += buf_len;
           *pCur++ = '\t';
       }
      *pCur++ = '\r';
      *pCur++ = '\n';
   }
   *pCur = 0;
   CopyTextToClipboard (p);
   free (p);
} // CopyListViewToClipboard
Ejemplo n.º 6
0
VOID
MainWndOnCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
    WORD wCommand = LOWORD(wParam);

    if (lParam == (LPARAM)hSearchBar)
    {
        WCHAR szBuf[MAX_STR_LEN];

        switch (HIWORD(wParam))
        {
            case EN_SETFOCUS:
            {
                WCHAR szWndText[MAX_STR_LEN];

                LoadStringW(hInst, IDS_SEARCH_TEXT, szBuf, sizeof(szBuf) / sizeof(WCHAR));
                GetWindowTextW(hSearchBar, szWndText, MAX_STR_LEN);
                if (wcscmp(szBuf, szWndText) == 0) SetWindowTextW(hSearchBar, L"");
            }
            break;

            case EN_KILLFOCUS:
            {
                GetWindowTextW(hSearchBar, szBuf, MAX_STR_LEN);
                if (wcslen(szBuf) < 1)
                {
                    LoadStringW(hInst, IDS_SEARCH_TEXT, szBuf, sizeof(szBuf) / sizeof(WCHAR));
                    SetWindowTextW(hSearchBar, szBuf);
                }
            }
            break;

            case EN_CHANGE:
                /* TODO: Implement search */
                break;
        }

        return;
    }

    switch (wCommand)
    {
        case ID_OPEN_LINK:
            ShellExecuteW(hwnd, L"open", pLink, NULL, NULL, SW_SHOWNOACTIVATE);
            HeapFree(GetProcessHeap(), 0, pLink);
            break;

        case ID_COPY_LINK:
            CopyTextToClipboard(pLink);
            HeapFree(GetProcessHeap(), 0, pLink);
            break;

        case ID_SETTINGS:
            CreateSettingsDlg(hwnd);
            break;

        case ID_EXIT:
            PostMessageW(hwnd, WM_CLOSE, 0, 0);
            break;

        case ID_INSTALL:
            if (DownloadApplication(-1))
            /* TODO: Implement install dialog
             *   if (InstallApplication(-1))
             */
                UpdateApplicationsList(-1);
            break;

        case ID_UNINSTALL:
            if (UninstallApplication(-1, FALSE))
                UpdateApplicationsList(-1);
            break;

        case ID_MODIFY:
            if (UninstallApplication(-1, TRUE))
                UpdateApplicationsList(-1);
            break;

        case ID_REGREMOVE:
            RemoveAppFromRegistry(-1);
            break;

        case ID_REFRESH:
            UpdateApplicationsList(-1);
            break;

        case ID_RESETDB:
            UpdateAppsDB();
            UpdateApplicationsList(-1);
            break;

        case ID_HELP:
            MessageBoxW(hwnd, L"Help not implemented yet", NULL, MB_OK);
            break;

        case ID_ABOUT:
            ShowAboutDialog();
            break;
    }
}
Ejemplo n.º 7
0
bool MythUITextEdit::keyPressEvent(QKeyEvent *e)
{
    m_lastKeyPress.restart();

    QStringList actions;
    bool handled = false;

    handled = GetMythMainWindow()->TranslateKeyPress("Global", e, actions, false);

    if (!handled && InsertCharacter(e->text()))
        handled = true;

    for (int i = 0; i < actions.size() && !handled; i++)
    {

        QString action = actions[i];
        handled = true;

        if (action == "LEFT")
        {
            if (!MoveCursor(MoveLeft))
                handled = false;
        }
        else if (action == "RIGHT")
        {
            if (!MoveCursor(MoveRight))
                handled = false;
        }
        else if (action == "DELETE")
        {
            RemoveCharacter(m_Position+1);
        }
        else if (action == "BACKSPACE")
        {
            RemoveCharacter(m_Position);
        }
        else if (action == "SELECT" && e->key() != Qt::Key_Space
                 && GetMythDB()->GetNumSetting("UseVirtualKeyboard", 1) == 1)
        {
            MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
            MythUIVirtualKeyboard *kb =  new MythUIVirtualKeyboard(popupStack, this);

            if (kb->Create())
            {
                //connect(kb, SIGNAL(keyPress(QString)), SLOT(keyPress(QString)));
                popupStack->AddScreen(kb);
            }
            else
                delete kb;
        }
        else if (action == "CUT")
        {
            CutTextToClipboard();
        }
        else if (action == "COPY")
        {
            CopyTextToClipboard();
        }
        else if (action == "PASTE")
        {
            PasteTextFromClipboard();
        }
        else
            handled = false;
    }

    return handled;
}
Ejemplo n.º 8
0
void MythUITextEdit::CutTextToClipboard()
{
    CopyTextToClipboard();
    Reset();
}
Ejemplo n.º 9
0
	bool cWidgetTextBox::OnKeyPress(cGuiMessageData &aData)
	{
		if(mbCanEdit==false) return true;
		if(mlMarkerCharPos <0) return false;
		
		eKey key = aData.mKeyPress.mKey;
		int mod = aData.mKeyPress.mlModifier;

		if(mpGfxMarker)mpGfxMarker->SetAnimationTime(0);

		//////////////////////////////
		//Copy / Pase / Cut
		if((mod & eKeyModifier_CTRL))
		{
			int lStart = mlMarkerCharPos < mlSelectedTextEnd ? mlMarkerCharPos : mlSelectedTextEnd;
			int lEnd = mlMarkerCharPos > mlSelectedTextEnd ? mlMarkerCharPos : mlSelectedTextEnd;
			int lSelectSize = lEnd - lStart;
			
			/////////////////////////////
			// Select all
			if(key == eKey_a)
			{
				mlSelectedTextEnd = 0;
				mlMarkerCharPos = (int)msText.size()-1;
			}
			/////////////////////////////
			// Copy
			else if(key == eKey_c)
			{
				if(mlSelectedTextEnd >=0)
					CopyTextToClipboard(cString::SubW(msText,lStart, lSelectSize));
			}
			/////////////////////////////
			// Cut
			else if(key == eKey_x)
			{
				if(mlSelectedTextEnd >=0)
				{
					CopyTextToClipboard(cString::SubW(msText,lStart, lSelectSize));
					SetText(cString::SubW(msText,0,	lStart) + cString::SubW(msText,lEnd));
					mlSelectedTextEnd = -1;
				}
			}
			/////////////////////////////
			// Paste
			else if(key == eKey_v)
			{
				tWString sExtra = LoadTextFromClipboard();
				
				if(mlSelectedTextEnd <0)
				{
					if(	mlMaxCharacters ==-1 || 
						(int)msText.size() + (int)sExtra.size() <= mlMaxCharacters)
					{
						SetText(cString::SubW(msText,0,	mlMarkerCharPos)+ sExtra +
								cString::SubW(msText,mlMarkerCharPos) );

						SetMarkerPos(mlMarkerCharPos+(int)sExtra.size());
					}
				}
				else
				{
					if(	mlMaxCharacters < 0 ||
						(int)sExtra.size() <= lSelectSize ||
						(int)sExtra.size() + (int)msText.size() - lSelectSize <= mlMaxCharacters)
					{
						SetText(cString::SubW(msText,0,	lStart) + sExtra + 
								cString::SubW(msText,lEnd));

						mlSelectedTextEnd = -1;
						SetMarkerPos(lStart+(int)sExtra.size());
					}
				}
			}
		}
		//////////////////////////////
		//Arrow keys		
		else if(key == eKey_LEFT || key == eKey_RIGHT)
		{
			if(mod & eKeyModifier_SHIFT)
			{
				if(mlSelectedTextEnd==-1) 
					mlSelectedTextEnd = mlMarkerCharPos;

				if(key == eKey_LEFT)	SetMarkerPos(mlMarkerCharPos-1);
				else					SetMarkerPos(mlMarkerCharPos+1);
			}
			else
			{
				if(key == eKey_LEFT)	SetMarkerPos(mlMarkerCharPos-1);
				else					SetMarkerPos(mlMarkerCharPos+1);

				mlSelectedTextEnd = -1;
			}
		}
		//////////////////////////////
		//Delete and backspace
		else if(key == eKey_DELETE || key == eKey_BACKSPACE)
		{
            if(mlSelectedTextEnd >=0)
			{
				int lStart = mlMarkerCharPos < mlSelectedTextEnd ? mlMarkerCharPos : mlSelectedTextEnd;
				int lEnd = mlMarkerCharPos > mlSelectedTextEnd ? mlMarkerCharPos : mlSelectedTextEnd;

				SetText(cString::SubW(msText,0,	lStart) + cString::SubW(msText,lEnd));

				mlSelectedTextEnd = -1;
				SetMarkerPos(lStart);
			}
			else
			{
				if(key == eKey_DELETE)
				{
					SetText(cString::SubW(msText,0,	mlMarkerCharPos)+ 
							cString::SubW(msText,mlMarkerCharPos+1));
				}
				else
				{
					SetText(cString::SubW(msText,0,	mlMarkerCharPos-1)+ 
							cString::SubW(msText,mlMarkerCharPos));
					SetMarkerPos(mlMarkerCharPos-1);
				}
			}
		}
		//////////////////////////////
		//Home
		else if(key == eKey_HOME)
		{
			if(mod & eKeyModifier_SHIFT)
			{
				if(mlSelectedTextEnd==-1) mlSelectedTextEnd = mlMarkerCharPos;
			}
			else
			{
				mlSelectedTextEnd = -1;
			}
			SetMarkerPos(0);
		}
		//////////////////////////////
		//End
		else if(key == eKey_END)
		{
			if(mod & eKeyModifier_SHIFT)
			{
				if(mlSelectedTextEnd==-1) mlSelectedTextEnd = mlMarkerCharPos;
			}
			else
			{
				mlSelectedTextEnd = -1;
			}
			SetMarkerPos((int)msText.size());
		}
		//////////////////////////////////
		// Character
		else 
		{
			int lFirstFontChar = mpDefaultFontType->GetFirstChar();
			int lLastFontChar = mpDefaultFontType->GetLastChar();
			wchar_t unicode = aData.mKeyPress.mlUnicode;
	        
			//Check so press is valid
			if(	unicode >= lFirstFontChar && unicode <= lLastFontChar &&
				mpDefaultFontType->GetGlyph(unicode - lFirstFontChar))
			{
				if(	mlSelectedTextEnd <0)
				{
					if(mlMaxCharacters ==-1 || (int)msText.size() < mlMaxCharacters)
					{
						SetText(cString::SubW(msText,0,	mlMarkerCharPos)+ unicode +
								cString::SubW(msText,mlMarkerCharPos) );

						SetMarkerPos(mlMarkerCharPos+1);
					}
				}
				else
				{
					int lStart = mlMarkerCharPos < mlSelectedTextEnd ? mlMarkerCharPos : mlSelectedTextEnd;
					int lEnd = mlMarkerCharPos > mlSelectedTextEnd ? mlMarkerCharPos : mlSelectedTextEnd;
					
					SetText(cString::SubW(msText,0,	lStart) + unicode + 
							cString::SubW(msText,lEnd));

					mlSelectedTextEnd = -1;

					SetMarkerPos(lStart+1);
				}
			}
		}
		
		
		return true;
	}
Ejemplo n.º 10
0
bool MythUITextEdit::keyPressEvent(QKeyEvent *event)
{
    m_lastKeyPress.restart();

    QStringList actions;
    bool handled = false;

    handled = GetMythMainWindow()->TranslateKeyPress("Global", event, actions,
                                                     false);

    Qt::KeyboardModifiers modifiers = event->modifiers();
    int keynum = event->key();

    if (keynum >= Qt::Key_Shift && keynum <= Qt::Key_CapsLock)
        return false;

    QString character;
    // Compose key handling
    // Enter composition mode
    if ((modifiers & Qt::GroupSwitchModifier) &&
        (keynum >= Qt::Key_Dead_Grave) && (keynum <= Qt::Key_Dead_Horn))
    {
        m_composeKey = keynum;
        handled = true;
    }
    else if (m_composeKey > 0) // 'Compose' the key
    {
        if (gDeadKeyMap.isEmpty())
            LoadDeadKeys(gDeadKeyMap);

        LOG(VB_GUI, LOG_DEBUG, QString("Compose key: %1 Key: %2").arg(QString::number(m_composeKey, 16)).arg(QString::number(keynum, 16)));

        if (gDeadKeyMap.contains(keyCombo(m_composeKey, keynum)))
        {
            int keycode = gDeadKeyMap.value(keyCombo(m_composeKey, keynum));

            //QKeyEvent key(QEvent::KeyPress, keycode, modifiers);
            character = QChar(keycode);

            if (modifiers & Qt::ShiftModifier)
                character = character.toUpper();
            else
                character = character.toLower();
            LOG(VB_GUI, LOG_DEBUG, QString("Found match for dead-key combo - %1").arg(character));
        }
        m_composeKey = 0;
    }

    if (character.isEmpty())
        character = event->text();

    if (!handled && InsertCharacter(character))
        handled = true;

    for (int i = 0; i < actions.size() && !handled; i++)
    {

        QString action = actions[i];
        handled = true;

        if (action == "LEFT")
        {
            MoveCursor(MoveLeft);
        }
        else if (action == "RIGHT")
        {
            MoveCursor(MoveRight);
        }
        else if (action == "UP")
        {
            handled = MoveCursor(MoveUp);
        }
        else if (action == "DOWN")
        {
            handled = MoveCursor(MoveDown);
        }
        else if (action == "PAGEUP")
        {
            handled = MoveCursor(MovePageUp);
        }
        else if (action == "PAGEDOWN")
        {
            handled = MoveCursor(MovePageDown);
        }
        else if (action == "DELETE")
        {
            RemoveCharacter(m_Position + 1);
        }
        else if (action == "BACKSPACE")
        {
            RemoveCharacter(m_Position);
        }
        else if (action == "NEWLINE")
        {
            QString newmessage = m_Message;
            newmessage.insert(m_Position + 1, '\n');
            SetText(newmessage, false);
            MoveCursor(MoveRight);
        }
        else if (action == "SELECT" && keynum != Qt::Key_Space
                 && GetMythDB()->GetNumSetting("UseVirtualKeyboard", 1) == 1)
        {
            MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
            MythUIVirtualKeyboard *kb =  new MythUIVirtualKeyboard(popupStack, this);

            if (kb->Create())
            {
                //connect(kb, SIGNAL(keyPress(QString)), SLOT(keyPress(QString)));
                popupStack->AddScreen(kb);
            }
            else
                delete kb;
        }
        else if (action == "CUT")
        {
            CutTextToClipboard();
        }
        else if (action == "COPY")
        {
            CopyTextToClipboard();
        }
        else if (action == "PASTE")
        {
            PasteTextFromClipboard();
        }
        else
            handled = false;
    }

    return handled;
}
Ejemplo n.º 11
0
LRESULT CEventInfoPopup::OnMessage(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
	switch (uMsg) {
	case WM_CREATE:
		m_RichEditUtil.LoadRichEditLib();
		m_hwndEdit=::CreateWindowEx(0,m_RichEditUtil.GetWindowClassName(),TEXT(""),
			WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE | ES_READONLY | ES_AUTOVSCROLL | ES_NOHIDESEL,
			0,0,0,0,hwnd,(HMENU)1,m_hinst,NULL);
		SetWindowFont(m_hwndEdit,m_Font.GetHandle(),FALSE);
		::SendMessage(m_hwndEdit,EM_SETEVENTMASK,0,ENM_MOUSEEVENTS | ENM_LINK);
		::SendMessage(m_hwndEdit,EM_SETBKGNDCOLOR,0,m_BackColor);
		return 0;

	case WM_SIZE:
		CalcTitleHeight();
		::MoveWindow(m_hwndEdit,0,m_TitleHeight,
					 LOWORD(lParam),max(HIWORD(lParam)-m_TitleHeight,0),TRUE);
		return 0;

	case WM_PAINT:
		{
			PAINTSTRUCT ps;
			RECT rc;
			HFONT hfontOld;
			int OldBkMode;
			COLORREF OldTextColor;

			::BeginPaint(hwnd,&ps);
			::GetClientRect(hwnd,&rc);
			rc.bottom=m_TitleHeight;
			Theme::FillGradient(ps.hdc,&rc,&m_TitleBackGradient);
			hfontOld=DrawUtil::SelectObject(ps.hdc,m_TitleFont);
			OldBkMode=::SetBkMode(ps.hdc,TRANSPARENT);
			OldTextColor=::SetTextColor(ps.hdc,m_TitleTextColor);
			TCHAR szText[EpgUtil::MAX_EVENT_TIME_LENGTH];
			int Length=EpgUtil::FormatEventTime(&m_EventInfo,szText,lengthof(szText),
												EpgUtil::EVENT_TIME_DATE | EpgUtil::EVENT_TIME_YEAR);
			if (Length>0)
				::TextOut(ps.hdc,0,0,szText,Length);
			rc.top+=m_TitleLineHeight;
			rc.right-=m_ButtonSize+m_ButtonMargin*2;
			DrawUtil::DrawWrapText(ps.hdc,m_EventInfo.GetEventName(),&rc,m_TitleLineHeight);
			::SelectObject(ps.hdc,hfontOld);
			::SetBkMode(ps.hdc,OldBkMode);
			::SetTextColor(ps.hdc,OldTextColor);
			GetCloseButtonRect(&rc);
			::DrawFrameControl(ps.hdc,&rc,DFC_CAPTION,DFCS_CAPTIONCLOSE | DFCS_MONO);
			::EndPaint(hwnd,&ps);
		}
		return 0;

	case WM_ACTIVATE:
		if (LOWORD(wParam)==WA_INACTIVE) {
			Hide();
		}
		return 0;

	case WM_ACTIVATEAPP:
		if (wParam==0) {
			Hide();
		}
		return 0;

	case WM_NCHITTEST:
		{
			POINT pt;
			RECT rc;

			pt.x=GET_X_LPARAM(lParam);
			pt.y=GET_Y_LPARAM(lParam);
			::ScreenToClient(hwnd,&pt);
			GetCloseButtonRect(&rc);
			if (::PtInRect(&rc,pt))
				return HTCLOSE;
			::GetClientRect(hwnd,&rc);
			rc.bottom=m_TitleHeight;
			if (::PtInRect(&rc,pt))
				return HTCAPTION;
		}
		break;

	case WM_NCLBUTTONDOWN:
		if (wParam==HTCLOSE) {
			::SendMessage(hwnd,WM_CLOSE,0,0);
			return 0;
		}
		break;

	case WM_NCRBUTTONDOWN:
		if (wParam==HTCAPTION) {
			POINT pt={GET_X_LPARAM(lParam),GET_Y_LPARAM(lParam)};
			HMENU hmenu=::CreatePopupMenu();

			::AppendMenu(hmenu,MF_STRING | MF_ENABLED,1,TEXT("番組名をコピー(&C)"));
			int Command=::TrackPopupMenu(hmenu,TPM_RIGHTBUTTON | TPM_RETURNCMD,pt.x,pt.y,0,hwnd,NULL);
			::DestroyMenu(hmenu);
			switch (Command) {
			case 1:
				CopyTextToClipboard(hwnd,m_EventInfo.GetEventName());
				break;
			}
			return 0;
		}
		break;

	case WM_MOUSEWHEEL:
		return ::SendMessage(m_hwndEdit,uMsg,wParam,lParam);

	case WM_NCMOUSEMOVE:
		{
			TRACKMOUSEEVENT tme;

			tme.cbSize=sizeof(TRACKMOUSEEVENT);
			tme.dwFlags=TME_LEAVE | TME_NONCLIENT;
			tme.hwndTrack=hwnd;
			::TrackMouseEvent(&tme);
		}
		return 0;

	case WM_NCMOUSELEAVE:
		{
			POINT pt;
			RECT rc;

			::GetCursorPos(&pt);
			::GetWindowRect(hwnd,&rc);
			if (!::PtInRect(&rc,pt))
				Hide();
		}
		return 0;

	case WM_NOTIFY:
		switch (((LPNMHDR)lParam)->code) {
		case EN_MSGFILTER:
			if (reinterpret_cast<MSGFILTER*>(lParam)->msg==WM_RBUTTONDOWN) {
				HMENU hmenu=::CreatePopupMenu();

				::AppendMenu(hmenu,MF_STRING | MF_ENABLED,1,TEXT("コピー(&C)"));
				::AppendMenu(hmenu,MF_STRING | MF_ENABLED,2,TEXT("すべて選択(&A)"));
				::AppendMenu(hmenu,MF_STRING | MF_ENABLED,3,TEXT("番組名をコピー(&E)"));
				if (m_pEventHandler!=NULL)
					m_pEventHandler->OnMenuPopup(hmenu);
				POINT pt;
				::GetCursorPos(&pt);
				int Command=::TrackPopupMenu(hmenu,TPM_RIGHTBUTTON | TPM_RETURNCMD,pt.x,pt.y,0,hwnd,NULL);
				::DestroyMenu(hmenu);
				switch (Command) {
				case 1:
					if (::SendMessage(m_hwndEdit,EM_SELECTIONTYPE,0,0)==SEL_EMPTY) {
						CRichEditUtil::CopyAllText(m_hwndEdit);
					} else {
						::SendMessage(m_hwndEdit,WM_COPY,0,0);
					}
					break;
				case 2:
					CRichEditUtil::SelectAll(m_hwndEdit);
					break;
				case 3:
					CopyTextToClipboard(hwnd,m_EventInfo.GetEventName());
					break;
				default:
					if (Command>=CEventHandler::COMMAND_FIRST)
						m_pEventHandler->OnMenuSelected(Command);
					break;
				}
			}
			return 0;

		case EN_LINK:
			{
				ENLINK *penl=reinterpret_cast<ENLINK*>(lParam);

				if (penl->msg==WM_LBUTTONUP)
					CRichEditUtil::HandleLinkClick(penl);
			}
			return 0;
		}
		break;

	case WM_CLOSE:
		Hide();
		return 0;
	}

	return ::DefWindowProc(hwnd,uMsg,wParam,lParam);
}
Ejemplo n.º 12
0
bool CLimnStream::ExchangeDataFields()
  {
  switch (DX.Handle)
    {
    case idx_OreSolidsFlow      : DX.Double = GetResult(0)/(3.6);                 return true;
    case idx_PassingSize0       : DX.Double = GetResult(1)*0.001;                 return true;
    case idx_PassingSize1       : DX.Double = GetResult(2)*0.001;                 return true;
    case idx_PassingSize2       : DX.Double = GetResult(3)*0.001;                 return true;
    case idx_MeanSG             : DX.Double = GetResult(4)*1000;                  return true;
    case idx_MeanSize           : DX.Double = GetResult(5)*0.001;                 return true;
    case idx_WaterFlow          : DX.Double = GetResult(6)/(3.6);                 return true;
    case idx_SolidsFrac         : DX.Double = GetResult(7)*0.01;                  return true;
    case idx_PulpSG             : DX.Double = GetResult(8)*1000;                  return true;
    case idx_FeSiFlow           : DX.Double = GetResult(9)/(3.6);                 return true;
    case idx_DiamondFlow        : DX.Double = GetResult(10)/(5000.0*1000*3.6);    return true;
    case idx_DiamondAssay       : DX.Double = GetResult(11)*5000*1000*100;        return true;
    case idx_LiberatedFlow      : DX.Double = GetResult(12)/(5000.0*1000*3.6);    return true;
    case idx_RelativeDiamonds   : DX.Double = GetResult(13)/100;                  return true;
    case idx_LiberatedFraction  : DX.Double = GetResult(14)*0.01;                 return true;
    case idx_RelativeRevenue    : DX.Double = GetResult(15)/100;                  return true;
    case idx_Revenue            : DX.Double = GetResult(16)/3600.0;               return true;

    case idx_BaseTag:
      DX.String=sm_sBaseTag;
      return true;
    case idx_BaseMark:
      if (DX.HasReqdValue)
        {
        if (DX.Bool)
          sm_sBaseTag=Tag;
        else if (DX.ForView)
          sm_sBaseTag="";
        }
      DX.Bool=sm_sBaseTag.CompareNoCase(Tag)==0;
      return true;

    case idx_BaseDiamondFlow     : DX.Double = sm_BaseCarats/(5000.0*1000*3.6);    return true;
    case idx_BaseRevenue         : DX.Double = sm_BaseRevenue/3600.0;              return true;

    case idx_CopySummary        : 
      {
      if (DX.HasReqdValue && DX.Bool)
        {
        CString Buff, V;
        for (int i=0; i<17; i++)
          {
          V.Format("%.12f\r\n", GetResult(i));
          Buff+=V;
          }
        CopyTextToClipboard(Buff);
        }
      DX.Bool =  false;
      return true;
      }

    case idx_CopyFractional     : 
    case idx_CopyMass           : 
      {
      if (DX.HasReqdValue && DX.Bool)
        {
        if (DX.Handle==idx_CopyMass)
          ConvertToMassForm(Vector);
        CString Buff, V;
        for (int r=0; r<RowCount(); r++)
          {
          for (int c=0; c<ColCount(); c++)
            {
            V.Format(c>0?"\t%.12f":"%.12f", m_Data[c+ColCount()*r]);
            Buff+=V;
            }
          Buff+="\r\n";
          }
        CopyTextToClipboard(Buff);
        if (DX.Handle==idx_CopyMass)
          ConvertToFracForm(Vector);
        }
      DX.Bool =  false;
      return true;
      }
    case idx_Calculate      :
      if (DX.HasReqdValue)
        {
        m_bCalculate = DX.Bool;
        if (m_bCalculate && m_pFeed==NULL)
          {
          m_pFeed=new CFeed;
          ReadData();
          }
        }
      DX.Bool = m_bCalculate;
      return true;
    case idx_Source         : 
      if (DX.HasReqdValue)
        m_pFeed->m_iSource = DX.Long;
      DX.Long   = m_pFeed->m_iSource;  
      return true;
    case idx_SrcName        : 
      if (DX.HasReqdValue)
        {
        m_pFeed->m_sSrcName = DX.String;
        ReadData();
        }
      DX.String = m_pFeed->m_sSrcName; 
      return true;
    case idx_SrcLoad        : 
      if (DX.HasReqdValue && DX.Bool)
        ReadData();
      return true;
    }
  return false;
  };
Ejemplo n.º 13
0
int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord)
{
	HKL hklCurLay, hklToLay;

	LPTSTR ptszInText, ptszOutText, ptszMBox, ptszPopupText, ptszTemp;
	CHARRANGE crSelection, crTemp;
	DWORD dwStartWord, dwEndWord;
	int i, iRes;

	BYTE WindowType = WTYPE_Unknown;
	BOOL WindowIsReadOnly, TwoWay;

	if (hTextWnd == NULL)
		hTextWnd = GetFocus();

	if (hTextWnd == NULL)
		return 0;

	//--------------Определяем тип окна-----------------
	IEVIEWEVENT ieEvent = { 0 };
	ieEvent.cbSize = sizeof(IEVIEWEVENT);
	ieEvent.iType = IEE_GET_SELECTION;

	if (ServiceExists(MS_HPP_EG_EVENT)) {
		// То же самое для History++
		ieEvent.hwnd = hTextWnd;
		ptszInText = (TCHAR*)CallService(MS_HPP_EG_EVENT, 0, (LPARAM)&ieEvent);

		if (!IsBadStringPtr(ptszInText, MaxTextSize))
			WindowType = WTYPE_HistoryPP;
	}

	if ((WindowType == WTYPE_Unknown) && (ServiceExists(MS_IEVIEW_EVENT))) {
		// Извращенное определение хэндла IEView
		ieEvent.hwnd = GetParent(GetParent(hTextWnd));

		ptszInText = (TCHAR*)CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&ieEvent);
		if (!IsBadStringPtr(ptszInText, MaxTextSize))
			WindowType = WTYPE_IEView;
	}

	if (WindowType == WTYPE_Unknown) {
		ptszTemp = (LPTSTR)mir_alloc(255 * sizeof(TCHAR));
		i = GetClassName(hTextWnd, ptszTemp, 255);
		ptszTemp[i] = 0;

		if (_tcsstr(CharUpper(ptszTemp), _T("RICHEDIT")) != NULL) {
			WindowType = WTYPE_RichEdit;
			SendMessage(hTextWnd, EM_EXGETSEL, 0, (LPARAM)&crSelection);
		}
		mir_free(ptszTemp);
	}

	if (WindowType == WTYPE_Unknown) {
		SendMessage(hTextWnd, EM_GETSEL, (WPARAM)&crSelection.cpMin, (LPARAM)&crSelection.cpMax);
		if ((SendMessage(hTextWnd, WM_GETDLGCODE, 0, 0)&(DLGC_HASSETSEL)) && (crSelection.cpMin >= 0))
			WindowType = WTYPE_Edit;
	}

	// Получим текст из Рича или обычного Едита
	if (WindowType == WTYPE_RichEdit || WindowType == WTYPE_Edit) {
		dwStartWord = dwEndWord = -1;
		SendMessage(hTextWnd, WM_SETREDRAW, FALSE, 0);

		// Бэкап выделения
		crTemp = crSelection;

		// Если имеется выделенный текст, то получим его
		if (crSelection.cpMin != crSelection.cpMax) {
			if (WindowType == WTYPE_RichEdit) {
				EditStreamData esdData;
				EDITSTREAM esStream = { 0 };
				esStream.dwCookie = (DWORD)&esdData;
				esStream.pfnCallback = EditStreamOutRtf;
				if (SendMessage(hTextWnd, EM_STREAMOUT, SF_TEXT | SF_UNICODE | SFF_SELECTION, (LPARAM)&esStream) > 0)
					ptszInText = GeTStringFromStreamData(&esdData);
				else {
					SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection);
					SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0);
					InvalidateRect(hTextWnd, NULL, FALSE);
					return 1;
				}
			}
			if (WindowType == WTYPE_Edit) {
				ptszTemp = (LPTSTR)mir_alloc(MaxTextSize*sizeof(TCHAR));
				ptszInText = (LPTSTR)mir_alloc(MaxTextSize*sizeof(TCHAR));
				iRes = SendMessage(hTextWnd, WM_GETTEXT, (WPARAM)MaxTextSize, (LPARAM)ptszTemp);
				if (!IsBadStringPtr(ptszInText, MaxTextSize) && (iRes > 0)) {
					_tcsncpy(ptszInText, &ptszTemp[crSelection.cpMin], crSelection.cpMax - crSelection.cpMin);
					ptszInText[crSelection.cpMax - crSelection.cpMin] = 0;
					mir_free(ptszTemp);
				}
				else {
					SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection);
					SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0);
					InvalidateRect(hTextWnd, NULL, FALSE);
					return 1;
				}
			}
		}
		// Если выделения нет, то получим нужный текст
		else {
			// Получаем весь текст в поле
			if (WindowType == WTYPE_RichEdit) {
				crTemp.cpMin = 0;
				crTemp.cpMax = -1;
				SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crTemp);

				EditStreamData esdData;
				EDITSTREAM esStream = { 0 };
				esStream.dwCookie = (DWORD)&esdData;
				esStream.pfnCallback = EditStreamOutRtf;
				if (SendMessage(hTextWnd, EM_STREAMOUT, SF_TEXT | SF_UNICODE | SFF_SELECTION, (LPARAM)&esStream) != 0)
					ptszInText = GeTStringFromStreamData(&esdData);
				else {
					SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection);
					SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0);
					InvalidateRect(hTextWnd, NULL, FALSE);
					return 1;
				}
			}
			if (WindowType == WTYPE_Edit) {
				ptszInText = (LPTSTR)mir_alloc(MaxTextSize*sizeof(TCHAR));
				iRes = SendMessage(hTextWnd, WM_GETTEXT, (WPARAM)MaxTextSize, (LPARAM)ptszInText);

				if (!IsBadStringPtr(ptszInText, MaxTextSize) && (iRes > 0)) {
					crTemp.cpMin = 0;
					crTemp.cpMax = (int)_tcslen(ptszInText);
				}
				else {
					SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection);
					SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0);
					InvalidateRect(hTextWnd, NULL, FALSE);
					return 1;
				}
			}
			// Получаем текущее слово
			if (CurrentWord) {
				for (dwStartWord = crSelection.cpMin; (dwStartWord > 0) && (_tcschr(ptszSeparators, ptszInText[dwStartWord - 1]) == NULL); dwStartWord--);
				for (dwEndWord = crSelection.cpMin; (dwEndWord < (_tcslen(ptszInText))) && (_tcschr(ptszSeparators, ptszInText[dwEndWord]) == NULL); dwEndWord++);

				crTemp.cpMin = dwStartWord;
				crTemp.cpMax = dwEndWord;

				if (WindowType == WTYPE_RichEdit) {
					SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crTemp);

					EditStreamData esdData;
					EDITSTREAM esStream = { 0 };
					esStream.dwCookie = (DWORD)&esdData;
					esStream.pfnCallback = EditStreamOutRtf;
					if (SendMessage(hTextWnd, EM_STREAMOUT, SF_TEXT | SF_UNICODE | SFF_SELECTION, (LPARAM)&esStream) != 0)
						ptszInText = GeTStringFromStreamData(&esdData);
					else {
						SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection);
						SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0);
						InvalidateRect(hTextWnd, NULL, FALSE);
						return 1;
					}
				}

				if (WindowType == WTYPE_Edit) {
					ptszTemp = (LPTSTR)mir_alloc(MaxTextSize*sizeof(TCHAR));
					_tcsncpy(ptszTemp, &ptszInText[crTemp.cpMin], crTemp.cpMax - crTemp.cpMin);
					ptszTemp[crTemp.cpMax - crTemp.cpMin] = 0;
					_tcscpy(ptszInText, ptszTemp);
					mir_free(ptszTemp);
					if (_tcslen(ptszInText) == 0) {
						mir_free(ptszInText);
						SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection);
						SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0);
						InvalidateRect(hTextWnd, NULL, FALSE);
						return 1;
					}
				}
			}
		}
	}

	//---------------Выдаем результаты--------------------
	WindowIsReadOnly = FALSE;
	if (WindowType == WTYPE_IEView || WindowType == WTYPE_HistoryPP)
		WindowIsReadOnly = TRUE;

	// if ((SendMessage(hTextWnd, EM_GETOPTIONS, 0, 0)&ECO_READONLY))
	if (WindowType == WTYPE_RichEdit || WindowType == WTYPE_Edit)
	if (GetWindowLongPtr(hTextWnd, GWL_STYLE) & ES_READONLY)
		WindowIsReadOnly = TRUE;

	// Лог Иевью и ХисториПП в режиме эмуляции Иевью  и поля только для чтения.
	if (WindowType != WTYPE_Unknown && !IsBadStringPtr(ptszInText, MaxTextSize))
	if (WindowIsReadOnly) {
		ptszMBox = (LPTSTR)mir_alloc(MaxTextSize*sizeof(TCHAR));
		ptszMBox[0] = 0;

		if (TextOperation == TOT_Layout) {
			hklCurLay = GetLayoutOfText(ptszInText);
			hklToLay = GetNextLayout(hklCurLay);
			TwoWay = (moOptions.TwoWay) && (bLayNum == 2);

			if (bLayNum == 2) {
				ptszMBox = ChangeTextLayout(ptszInText, hklCurLay, hklToLay, TwoWay);
			}
			else {
				for (i = 0; i < bLayNum; i++)
				if (hklLayouts[i] != hklCurLay) {
					if (_tcslen(ptszMBox) != 0)
						_tcscat(ptszMBox, _T("\n\n"));
					ptszTemp = GetShortNameOfLayout(hklLayouts[i]);
					_tcscat(ptszMBox, ptszTemp);
					_tcscat(ptszMBox, _T(":\n"));
					ptszOutText = ChangeTextLayout(ptszInText, hklCurLay, hklLayouts[i], FALSE);
					_tcscat(ptszMBox, ptszOutText);
					mir_free(ptszTemp);
					mir_free(ptszOutText);
				}
			}
		}
		else if (TextOperation == TOT_Case) {
			ptszMBox = ChangeTextCase(ptszInText);
		}

		mir_free(ptszInText);

		if ((WindowType == WTYPE_Edit) || (WindowType == WTYPE_RichEdit)) {
			SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection);
			SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0);
			InvalidateRect(hTextWnd, NULL, FALSE);
		}

		if (TextOperation == TOT_Layout)
			SkinPlaySound(SND_ChangeLayout);
		else if (TextOperation == TOT_Case)
			SkinPlaySound(SND_ChangeCase);

		if (moOptions.CopyToClipboard)
			CopyTextToClipboard(ptszMBox);
		//-------------------------------Покажем попапы------------------------------------------ 			
		if (moOptions.ShowPopup) {
			ptszPopupText = (LPTSTR)mir_alloc(MaxTextSize*sizeof(TCHAR));
			_tcscpy(ptszPopupText, ptszMBox);

			POPUPDATAT_V2 pdtData = { 0 };
			pdtData.cbSize = sizeof(pdtData);
			_tcsncpy(pdtData.lptzContactName, TranslateT(ModuleName), MAX_CONTACTNAME);
			_tcsncpy(pdtData.lptzText, ptszPopupText, MAX_SECONDLINE);

			switch (poOptions.bColourType) {
			case PPC_POPUP:
				pdtData.colorBack = pdtData.colorText = 0;
				break;
			case PPC_WINDOWS:
				pdtData.colorBack = GetSysColor(COLOR_BTNFACE);
				pdtData.colorText = GetSysColor(COLOR_WINDOWTEXT);
				break;
			case PPC_CUSTOM:
				pdtData.colorBack = poOptions.crBackColour;
				pdtData.colorText = poOptions.crTextColour;
				break;
			}

			switch (poOptions.bTimeoutType) {
			case PPT_POPUP:
				pdtData.iSeconds = 0;
				break;
			case PPT_PERMANENT:
				pdtData.iSeconds = -1;
				break;
			case PPC_CUSTOM:
				pdtData.iSeconds = poOptions.bTimeout;
				break;
			}
			pdtData.PluginData = ptszPopupText;
			pdtData.PluginWindowProc = (WNDPROC)CKLPopupDlgProc;

			pdtData.lchIcon = hPopupIcon;
			poOptions.paActions[0].lchIcon = hCopyIcon;
			pdtData.lpActions = poOptions.paActions;
			pdtData.actionCount = 1;

			if (CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&pdtData, APF_NEWDATA) < 0) {
				mir_free(ptszPopupText);
				MessageBox(NULL, ptszMBox, TranslateT(ModuleName), MB_ICONINFORMATION);
			}
		}
		mir_free(ptszMBox);
	}
	//------------------Редактируемые поля ----------------------------
	else {
		if (TextOperation == TOT_Layout) {
			hklCurLay = GetLayoutOfText(ptszInText);
			hklToLay = GetNextLayout(hklCurLay);
			TwoWay = (moOptions.TwoWay) && (bLayNum == 2);
			ptszOutText = ChangeTextLayout(ptszInText, hklCurLay, hklToLay, TwoWay);
		}
		else if (TextOperation == TOT_Case) {
			ptszOutText = ChangeTextCase(ptszInText);
		}

		if (WindowType == WTYPE_RichEdit) {
			SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crTemp);
			SendMessage(hTextWnd, EM_REPLACESEL, FALSE, (LPARAM)ptszOutText);
			SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crSelection);
		}
		else {
			ptszTemp = (LPTSTR)mir_alloc(MaxTextSize*sizeof(TCHAR));
			SendMessage(hTextWnd, WM_GETTEXT, (WPARAM)MaxTextSize, (LPARAM)ptszTemp);
			for (i = crTemp.cpMin; i < crTemp.cpMax; i++)
				ptszTemp[i] = ptszOutText[i - crTemp.cpMin];
			SendMessage(hTextWnd, WM_SETTEXT, 0, (LPARAM)ptszTemp);
			SendMessage(hTextWnd, EM_SETSEL, crSelection.cpMin, crSelection.cpMax);
			mir_free(ptszTemp);
		}

		// Переключим раскладку или изменим состояние Caps Lock
		if (TextOperation == TOT_Layout && hklToLay != NULL && moOptions.ChangeSystemLayout)
			ActivateKeyboardLayout(hklToLay, KLF_SETFORPROCESS);
		else if (TextOperation == TOT_Case) {
			// Если нужно инвертнуть
			if (moOptions.bCaseOperations == 0) {
				keybd_event(VK_CAPITAL, 0x45, 0, 0);
				keybd_event(VK_CAPITAL, 0x45, KEYEVENTF_KEYUP, 0);
			}
			// Если нужно отключить
			else if (moOptions.bCaseOperations == 1) {
				if (GetKeyState(VK_CAPITAL) & 0x0001) {
					keybd_event(VK_CAPITAL, 0x45, 0, 0);
					keybd_event(VK_CAPITAL, 0x45, KEYEVENTF_KEYUP, 0);
				}
			}
		}

		SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0);
		InvalidateRect(hTextWnd, NULL, FALSE);

		if (TextOperation == TOT_Layout)
			SkinPlaySound(SND_ChangeLayout);
		else if (TextOperation == TOT_Case)
			SkinPlaySound(SND_ChangeCase);

		mir_free(ptszInText);
		mir_free(ptszOutText);
	}

	return 0;
}
Ejemplo n.º 14
0
	BOOL CopyTextToClipboard(HWND hwnd, const char *text) {
		std::wstring wtext = ConvertUTF8ToWString(text);
		return CopyTextToClipboard(hwnd, wtext);
	}
Ejemplo n.º 15
0
    VOID OnCommand(WPARAM wParam, LPARAM lParam)
    {
        WORD wCommand = LOWORD(wParam);

        if (lParam == (LPARAM) m_SearchBar->m_hWnd)
        {
            WCHAR szBuf[MAX_STR_LEN];

            switch (HIWORD(wParam))
            {
            case EN_SETFOCUS:
            {
                WCHAR szWndText[MAX_STR_LEN];

                LoadStringW(hInst, IDS_SEARCH_TEXT, szBuf, _countof(szBuf));
                m_SearchBar->GetWindowTextW(szWndText, MAX_STR_LEN);
                if (wcscmp(szBuf, szWndText) == 0)
                {
                    SearchEnabled = FALSE;
                    m_SearchBar->SetWindowTextW(L"");
                }
            }
            break;

            case EN_KILLFOCUS:
            {
                m_SearchBar->GetWindowTextW(szBuf, MAX_STR_LEN);
                if (wcslen(szBuf) < 1)
                {
                    LoadStringW(hInst, IDS_SEARCH_TEXT, szBuf, _countof(szBuf));
                    SearchEnabled = FALSE;
                    m_SearchBar->SetWindowTextW(szBuf);
                }
            }
            break;

            case EN_CHANGE:
            {
                WCHAR szWndText[MAX_STR_LEN];

                if (!SearchEnabled)
                {
                    SearchEnabled = TRUE;
                    break;
                }

                LoadStringW(hInst, IDS_SEARCH_TEXT, szBuf, _countof(szBuf));
                m_SearchBar->GetWindowTextW(szWndText, MAX_STR_LEN);
                if (wcscmp(szBuf, szWndText) != 0)
                {
                    StringCbCopy(szSearchPattern, sizeof(szSearchPattern),
                        szWndText);
                }
                else
                {
                    szSearchPattern[0] = UNICODE_NULL;
                }

                DWORD dwDelay;
                SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &dwDelay, 0);
                SetTimer(SEARCH_TIMER_ID, dwDelay);
            }
            break;
            }

            return;
        }

        switch (wCommand)
        {
        case ID_OPEN_LINK:
            ShellExecuteW(m_hWnd, L"open", pLink, NULL, NULL, SW_SHOWNOACTIVATE);
            HeapFree(GetProcessHeap(), 0, pLink);
            break;

        case ID_COPY_LINK:
            CopyTextToClipboard(pLink);
            HeapFree(GetProcessHeap(), 0, pLink);
            break;

        case ID_SETTINGS:
            CreateSettingsDlg(m_hWnd);
            break;

        case ID_EXIT:
            PostMessageW(WM_CLOSE, 0, 0);
            break;

        case ID_INSTALL:
            if (DownloadApplication(-1))
                /* TODO: Implement install dialog
                *   if (InstallApplication(-1))
                */
                UpdateApplicationsList(-1);
            break;

        case ID_UNINSTALL:
            if (UninstallApplication(-1, FALSE))
                UpdateApplicationsList(-1);
            break;

        case ID_MODIFY:
            if (UninstallApplication(-1, TRUE))
                UpdateApplicationsList(-1);
            break;

        case ID_REGREMOVE:
            RemoveAppFromRegistry(-1);
            break;

        case ID_REFRESH:
            UpdateApplicationsList(-1);
            break;

        case ID_RESETDB:
            UpdateAppsDB();
            UpdateApplicationsList(-1);
            break;

        case ID_HELP:
            MessageBoxW(L"Help not implemented yet", NULL, MB_OK);
            break;

        case ID_ABOUT:
            ShowAboutDialog();
            break;
        }
    }