Page 1 of 1
menu in taskbar
Posted: Tue Feb 10, 2004 1:59 am
by coma
is it possible to add menu items in the taskbar menu ? (the little menu, opened with a right click over the program button).
I searched the forum, but without success..
thanks.
Posted: Tue Feb 10, 2004 9:54 am
by Kale
Posted: Tue Feb 10, 2004 12:02 pm
by coma
thanks kale. But I don't want to add options in explorer context menu.
I just talking about this menu :
<img border="1" src="
http://coma.coma.free.fr/pureforum/menu.gif">
Posted: Tue Feb 10, 2004 2:28 pm
by Nico
Hi Coma,
You can use API for modify completely the system menu:
AppendMenu, ModifyMenu, InsertMenu
An example here:
Code: Select all
Global id.l
Procedure MyWindowCallback(WindowID,Message,wParam,lParam)
result=#PB_ProcessPureBasicEvents
Select Message
Case #WM_SYSCOMMAND
Select wParam
Case id
MessageRequester("About", "Cool Menu example 1", 0)
Case id+1
MessageRequester("About", "Cool Menu example 2", 0)
EndSelect
EndSelect
ProcedureReturn result
EndProcedure
Hwnd_window0=OpenWindow(0,200,200,200,200,#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget,"Menu System")
id.l=15
hwnd_systeme=GetSystemMenu_(Hwnd_window0,#False)
AppendMenu_(hwnd_systeme,#Mft_String,id,"Mon Menu 1")
AppendMenu_(hwnd_systeme,#Mft_String,id+1,"Mon Menu 2")
SetWindowCallback(@MyWindowCallback())
Repeat
Select WindowEvent()
Case #PB_Event_CloseWindow
Quit=1
;------------------------------------
; The rest of your code here
;------------------------------------
EndSelect
Until Quit = 1
End
Posted: Tue Feb 10, 2004 3:14 pm
by coma
oh, great, perfect.
I just added AppendMenu_(hwnd_systeme, #Mft_Separator, 0, 0)
(I use 0,0, I don't know if it's very good, but seems that it works...)
Merci beaucoup

Posted: Tue Feb 10, 2004 10:22 pm
by Kale
FYI: From the WinAPI Help:
The AppendMenu function has been superseded by the InsertMenuItem function. You can still use AppendMenu, however, if you do not need any of the extended features of InsertMenuItem.
Posted: Sun Jun 05, 2005 7:51 am
by Intrigued
How about doing this sort of activity with regards to a Systray icon for a non-PB based application (.exe)?
Posted: Fri Jun 10, 2005 5:20 am
by Intrigued
{[
Bump]}
Intrigued wrote:How about doing this sort of activity with regards to a Systray icon ?
Posted: Fri Jun 10, 2005 5:37 pm
by Killswitch
Create a window then hide it.
Create a popup menu using the internal PB commands, for example:
Code: Select all
If CreatePopupMenu(#Menu_1)
OpenSubMenu("Add...")
MenuItem(#Menu_AddSong,"Song")
MenuItem(#Menu_AddFolder,"Folder")
CloseSubMenu()
OpenSubMenu("Remove...")
MenuItem(#Menu_RemoveSong,"Song")
MenuItem(#Menu_RemoveFolder,"Folder")
CloseSubMenu()
MenuBar()
OpenSubMenu("Tracks")
For t=0 To CountGadgetItems(0)-1
MenuItem(#Last_Item+t+1,Str(t+1)+". "+GetFilePart(GetGadgetItemText(0,t,0)))
Next t
CloseSubMenu()
MenuBar()
MenuItem(#Menu_Play,"Play")
MenuItem(#Menu_Pause,"Pause")
MenuItem(#Menu_Stop,"Stop")
MenuItem(#Menu_Skip,"Skip")
MenuItem(#Menu_Back,"Back")
MenuBar()
OpenSubMenu("Play Mode")
MenuItem(#Menu_Shuffle,"Shuffle")
MenuItem(#Menu_RepeatSingle,"Repeat current")
MenuItem(#Menu_RepeatAll,"Repeat all")
CloseSubMenu()
MenuBar()
OpenSubMenu("Volume")
MenuItem(#Menu_VolumeUp,"Volume Up")
MenuItem(#Menu_VolumeDown,"Volume Down")
MenuItem(#Menu_Mute,"Mute")
MenuItem(#Menu_Volume,"Volume: "+Str(Volume))
DisableMenuItem(#Menu_Volume,1)
CloseSubMenu()
MenuBar()
MenuItem(#Menu_About,"About")
MenuBar()
MenuItem(#Menu_ExitSys,"Exit")
ProcedureReturn 1
Else
ProcedureReturn 0
EndIf
Then use this in a loop to detect right clicks:
Code: Select all
Select WindowEvent()
Case #PB_Event_Systray
Select EventType()
Case #PB_EventType_RightClick
DisplayPopupMenu(#Menu_1,WindowID(#Main_Window))
EndSelect
EndSelect
This code won't work directly, I've just mdified some code from a project I've done before, but it works pretty well!
Posted: Sat Jun 11, 2005 4:45 am
by Intrigued
Killswitch, thanks for sharing! I'm very much the youngling when it comes to PB. But, I seem to be picking it up pretty quick.
Again, thanks!