@t57042 Hi
That code is specially for "Calc.exe" and Win 7
You got to know how to get the
Handle of the requested object
It could be by ClassName ,Window Text,Window ID ......
Here we will get the handle by using Window Text, in this case "1"
Code: Select all
Global gWnd
Procedure Enum(hwnd, lparam)
wn$ = Space(#MAX_PATH)
GetWindowText_(hwnd, @wn$, #MAX_PATH)
If wn$ = "1"
gWnd = hwnd
EndIf
ProcedureReturn #True
EndProcedure
Procedure SendVisibleClick(button)
SendMessage_(button, #WM_LBUTTONDOWN, 0,0)
Delay(300)
SendMessage_(button, #WM_LBUTTONUP, 0,0)
EndProcedure
RunProgram("recmes2.exe")
Delay(300)
hWnd = FindWindow_(0,"test")
EnumChildWindows_(hWnd, @Enum(), 0)
SetActiveWindow_(hWnd)
Delay(500)
SendVisibleClick(gWnd)
Compile the next as "recmes2.exe"
Then run the first snippet
Code: Select all
If OpenWindow(0, 0, 0, 230, 90, "test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget (1, 10, 10, 200, 20, "1")
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
Select EventGadget()
Case 1 : MessageRequester("Note :","Button 1 clicked!",#MB_ICONWARNING)
EndSelect
EndSelect
Until Event = #PB_Event_CloseWindow
EndIf