Monitoring for an open window off a timer event

Monitoring for an open window off a timer event

Using Win 95 and 32-bit PB v5.0, I want to, off a timer event, monitor for an open window. When I detect it, searching once every five minutes, I want to trigger its OK button.

So far, I can find the window, and even bring it to the top ? or make it active. But how do I trigger its OK button?

The closest I can find is SendMessageA, which requires the handle of the button object. How can I get its handle?

There are two ways to resolve this problem. You can just stop atthe window level, which you already have working, and trigger an event onthe window to close it. You can do this using the Send function; thepbm_customXX events start at 1052 plus the number on the right hand sideof the pbm_customXX event.

For example:

would equate to:
Send( hWnd, 1053, 0, 0 )
Or you could use the FindWindow API call to search for the commandbutton inside the window. This works because in the Windows operatingsystem, every control is a window, even a command button! You can searchfor the command button by the text on it or by classname. Then just usethe standard windows command to press it.

The preferred method would be for the command button to trigger a customevent in the window to handle your close processing, and to use Send totrigger the same event.

See also  How IoT Tech Will Transform Logistics

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist