I use PostMessage_ at the moment:
Code: Select all
PostMessage_(WindowID(#Main),#PB_Event_Menu,-1,GetMenuItemID_(MenuID(#Menu_Main_Dummy),#Menu_Jobs_Dummy))
Any ideas on how to get the right item id's? Thanks.
Code: Select all
PostMessage_(WindowID(#Main),#PB_Event_Menu,-1,GetMenuItemID_(MenuID(#Menu_Main_Dummy),#Menu_Jobs_Dummy))
Code: Select all
Macro WindowEventMenuSimulate(WindowNr, MenuItemID)
PostMessage_(WindowID(WindowNr), #WM_COMMAND, MenuItemID | (1 << 16), 0)
EndMacro
; For the sake of completeness, simulating Gadget events:
Macro WindowEventGadgetSimulate(WindowNr, GadgetNr, EventType)
PostMessage_(WindowID(WindowNr), #WM_COMMAND, GadgetNr | (EventType << 16), GadgetID(GadgetNr))
EndMacro
; There is also an internal PB function for this, but you never know if it will change so I'm always using the previous one:
Import ""
PB_Gadget_SendGadgetCommand(hWnd, EventType)
EndImport
PB_Gadget_SendGadgetCommand(GadgetID(GadgetNr), EventType)
djes reported here http://www.purebasic.fr/english/viewtop ... 78#p357378 that PB_Gadget_SendGadgetCommand does not work when using the threadsafe option, so as you say safer to stick with PostMessage_().c4s wrote:Code: Select all
; There is also an internal PB function for this, but you never know if it will change so I'm always using the previous one: Import "" PB_Gadget_SendGadgetCommand(hWnd, EventType) EndImport