Menu in Tray Icon... (patch included)

Archived discussion about features (predating the use of Bugzilla as a bug and feature tracker)

Moderator: Moderators

Locked
Orkbluttt
Posts: 5
Joined: 2003-10-30 07:43
Location: France
Contact:

Menu in Tray Icon... (patch included)

Post by Orkbluttt » 2003-10-30 08:10

a little menu in tray icon (when dc++ minimized and tray icon is checked in settings)
You must create a MENU resource like that:

Code: Select all

     ID_MENU_SYSTRAY_DC++          ->      DC++
     ID_MENU_SYSTRAY_SHOW     ->         Show
     ID_MENU_SYSTRAY_QUIT       ->         Quit
     ID_MENU_SYSTRAY_ABOUT    ->         About
     .....
you must now add these lines into MainFrm.h and .cpp

in MainFrm.h:
---------------

Code: Select all

...
COMMAND_ID_HANDLER(ID_MENU_SYSTRAY_SHOW, onShow)
COMMAND_ID_HANDLER(ID_MENU_SYSTRAY_QUIT, onQuitter)
COMMAND_ID_HANDLER(ID_MENU_SYSTRAY_ABOUT,OnAppAbout)
...
LRESULT onQuitter(WORD , WORD , HWND , BOOL& ){
   UINT uMsg;
   BOOL x=TRUE;
   WPARAM wParam;
   LPARAM lParam;
   BOOL& bHandled=x;
   OnClose(uMsg, wParam, lParam, bHandled);
   return 0;
}

LRESULT MainFrame::onShow(WORD , WORD , HWND , BOOL&){
   ShowWindow(SW_SHOW);
   ShowWindow(maximized ? SW_MAXIMIZE : SW_RESTORE);
   return 0;
}
...
in MainFrm.cpp:
------------------

Code: Select all

...
LRESULT MainFrame::onTrayIcon(UINT, WPARAM , LPARAM lParam, BOOL& ){
   if (lParam == WM_LBUTTONUP) {
               ......
	.....
   } else if(lParam == WM_MOUSEMOVE... ) {
	.....
                .....               
   }else if(lParam == WM_RBUTTONDOWN || lParam == WM_CONTEXTMENU){ 		
                CPoint pt;	
                CMenu mnuTrayMenu;
                mnuTrayMenu.LoadMenu(IDR_MENU_TRAY);
                GetCursorPos(&pt);
                SetForegroundWindow(m_hWnd); 
                mnuTrayMenu.GetSubMenu(0).TrackPopupMenu(TPM_BOTTOMALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON,pt.x,pt.y,m_hWnd);
                PostMessage(WM_NULL, 0, 0);
                mnuTrayMenu.GetSubMenu(0).SetMenuDefaultItem(0,TRUE);
    }
    return 0;
}
:D

sorry for the not formatting text... all tab are deleted when i submit this post ... :roll:

(Edit:

Code: Select all

 tags - GargoyleMT)[/i]

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2003-10-30 21:00

If you'd like this added to DC++, please make a unified diff and send it to Arne - his email address is at the top of each h/cpp file.

Oh, and read the Submitting patches portion of compile.txt

If you have questions let me know.

Orkbluttt
Posts: 5
Joined: 2003-10-30 07:43
Location: France
Contact:

Post by Orkbluttt » 2003-10-30 21:05

yes, it's done...i've post this code just to see if people haven't ideas to add options in systray menu.
thanks
RSA576 will be afraid....
http://www.rsattack576.com

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2003-10-30 21:12

Oh, in that case:

http://dcplusplus.sourceforge.net/forum ... php?t=2160

There might be more, you can try searching just for "tray" in the Features forum.

Orkbluttt
Posts: 5
Joined: 2003-10-30 07:43
Location: France
Contact:

Post by Orkbluttt » 2003-10-30 21:15

:lol:
thx...i'll see that tomorrow
going to sleep now!!!
it's already 3h15 AM here :?
RSA576 will be afraid....
http://www.rsattack576.com

deesee++
Posts: 9
Joined: 2003-11-01 06:17

Post by deesee++ » 2003-11-08 21:45

Ork, did you make the .diff for Arne?
If so would you post it please?
I'm having touble adding this feature... my cpp sux ;)



Thanx.

Orkbluttt
Posts: 5
Joined: 2003-10-30 07:43
Location: France
Contact:

Post by Orkbluttt » 2003-11-08 21:49

Jacek have already make the change
see the source in CVS ... :D
RSA576 will be afraid....
http://www.rsattack576.com

Twink
Posts: 436
Joined: 2003-03-31 23:31
Location: New Zealand

Post by Twink » 2003-11-08 21:51

there is a tray icon menu in the next version (0.302), it only has show and exit.

Orkbluttt
Posts: 5
Joined: 2003-10-30 07:43
Location: France
Contact:

Post by Orkbluttt » 2003-11-08 21:53

yep
have add in my own build :
Settings
About
Refresh
RSA576 will be afraid....
http://www.rsattack576.com

Locked