Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: PowerBuilder
Expertise: Beginner
Jul 24, 1997

Monitoring for an open window off a timer event

Question:
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?

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

For example:

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

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

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date