Code: Select all
hhkLLMouse = SetWindowsHookEx_(#WH_MOUSE_LL,@HookProc(),GetModuleHandle_(0),0)
Code: Select all
hhkLLMouse = SetWindowsHookEx_(#WH_MOUSE_LL,@HookProc(),GetModuleHandle_(0),0)
Code: Select all
Import "Gadget.lib"
PB_Gadget_SendGadgetCommand(hWnd, EventType)
EndImport
If OpenWindow(0, 0, 0, 230, 120, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ListIconGadget(1, 10, 10, 150, 100, "ListIcon", 140, #PB_ListIcon_GridLines)
For a = 1 To 4
AddGadgetItem(1, -1, "Line "+Str(a))
Next
PB_Gadget_SendGadgetCommand(GadgetID(1), #PB_EventType_LeftClick)
Repeat
eventID = WaitWindowEvent()
Select eventID
Case #PB_Event_Gadget
If EventType() = #PB_EventType_LeftClick
Debug "Left clicked gadget " + Str(EventGadget())
EndIf
EndSelect
Until eventID = #PB_Event_CloseWindow
EndIf
Code: Select all
#MyMessage = #WM_APP + 1
Procedure MyWindowCallback(hWnd, uMsg, wParam, lParam)
result = #PB_ProcessPureBasicEvents
Select uMsg
Case #MyMessage
Debug "#MyMessage received!"
EndSelect
ProcedureReturn result
EndProcedure
If OpenWindow(0, 0, 0, 230, 120, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ListIconGadget(1, 10, 10, 150, 100, "ListIcon", 140, #PB_ListIcon_GridLines)
For a = 1 To 4
AddGadgetItem(1, -1, "Line "+Str(a))
Next
SetWindowCallback(@MyWindowCallback())
SendMessage_(WindowID(0), #MyMessage, 0, 0)
Repeat
eventID = WaitWindowEvent()
Until eventID = #PB_Event_CloseWindow
EndIf
Code: Select all
#MyMessage = #WM_APP + 1
If OpenWindow(0, 0, 0, 230, 120, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
SendMessage_(WindowID(0), #MyMessage, 0, 0)
Repeat
EventID = WaitWindowEvent()
If EventID = #MyMessage: Debug "Work?": EndIf
Until EventID = #PB_Event_CloseWindow
EndIf
Code: Select all
#MyMessage = #WM_APP + 1
If OpenWindow(0, 0, 0, 230, 120, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
PostMessage_(WindowID(0), #MyMessage, 0, 0)
Repeat
EventID = WaitWindowEvent()
If EventID = #MyMessage: Debug "Work?": EndIf
Until EventID = #PB_Event_CloseWindow
EndIf
Yes! it work! thanx guys!netmaestro wrote: PostMessage is asynchronous. Use it from threads etc. SendMessage is usually OK from the PB loop.
Code: Select all
Import "Gadget.lib"
PB_Gadget_SendGadgetCommand(hWnd, EventType)
EndImport
Procedure t(Null)
PB_Gadget_SendGadgetCommand(GadgetID(1), #PB_EventType_LeftClick)
EndProcedure
If OpenWindow(0, 0, 0, 230, 120, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ListIconGadget(1, 10, 10, 150, 100, "ListIcon", 140, #PB_ListIcon_GridLines)
For a = 1 To 4
AddGadgetItem(1, -1, "Line "+Str(a))
Next
CreateThread(@t(), Null)
Repeat
eventID = WaitWindowEvent()
Select eventID
Case #PB_Event_Gadget
If EventType() = #PB_EventType_LeftClick
Debug "Left clicked gadget " + Str(EventGadget())
EndIf
EndSelect
Until eventID = #PB_Event_CloseWindow
EndIf
I'd like to do it in a multiplatform way. We have threads, multiple windows, but the command to send messages between them needs a little hack or api, or ugly code. I think this command has to be implemented.idle wrote:have you tried to use a #WM_USER message and PostMessage_ ?
I think I've done that in the past but can't remember if it came through the pb event loop or a call back