Herzlich Willkommen, lieber Gast!
  Sie befinden sich hier:

  Forum » VC++ / MFC » Context Menu ausblenden

Forum | Hilfe | Team | Links | Impressum | > Suche < | Mitglieder | Registrieren | Einloggen
  Quicklinks: MSDN-Online || STL || clib Reference Grundlagen || Literatur || E-Books || Zubehör || > F.A.Q. < || Downloads   

Autor Thread - Seiten: > 1 <
000
12.12.2003, 14:10 Uhr
~Richie
Gast


Hi,
wie kann ich ein so erstelltes ContextMenu wieder ausblenden ?

C++:

CMenu        *pContextMenu;
CMenu        menu;
CPoint pos;
GetCursorPos(&pos);

menu.LoadMenu(IDR_CONTEXTMENU);
    pContextMenu = menu.GetSubMenu(0);
    pContextMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON, pos.x,pos.y,AfxGetMainWnd());


Danke schonmal für einen Tipp !
 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
001
12.12.2003, 14:52 Uhr
~Richie
Gast


Ein weiteres Problem was ich habe ist, daß wenn man ein Zweitesmal auf das TrayIcon klickt das Programm abstürzt.

Hier zum besseren Verständnis die ganze Funktion:

C++:
LRESULT CSocketServerDlg::OnTrayNotification(WPARAM wp, LPARAM lp)
{    
    
    CPoint pos;
    GetCursorPos(&pos);

    switch (lp)
    {
    case WM_RBUTTONUP:
    menu.LoadMenu(IDR_CONTEXTMENU);
    pContextMenu = menu.GetSubMenu(0);
    pContextMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON, pos.x,pos.y,AfxGetMainWnd());
    
    }
    

return 0;
}

 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
002
12.12.2003, 16:12 Uhr
~Richie
Gast


Wen´s interessiert:

Um das Abstürzen beim 2. Klick auf das TrayIcon zu verhindern vorher menu.Detach() aufrufen:


C++:

LRESULT CSocketServerDlg::OnTrayNotification(WPARAM wp, LPARAM lp)
{    
    
    CPoint pos;
    GetCursorPos(&pos);

    switch (lp)
    {
    case WM_RBUTTONUP:
    menu.Detach();
    menu.LoadMenu(IDR_CONTEXTMENU);
    pContextMenu = menu.GetSubMenu(0);
    pContextMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON, pos.x,pos.y,AfxGetMainWnd());
    
    }
    

return 0;
}




Für das Ausblenden des Menus habe ich immer noch keine elegante Lösung.
 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
Seiten: > 1 <     [ VC++ / MFC ]  


ThWBoard 2.73 FloSoft-Edition
© by Paul Baecher & Felix Gonschorek (www.thwboard.de)

Anpassungen des Forums
© by Flo-Soft (www.flo-soft.de)

Sie sind Besucher: