Jump to content
Sign in to follow this  

Setactivewindow In Controlclick

Recommended Posts



I noticed what you did with AttachThreadInput() and SetActiveWindow() for ControlClick and some of the other control functions in your recent changes. I'm wondering if you have any evidence whether these changes actually help any particular types of controls.

The reason I ask is that AttachThreadInput() can hang (I believe) if the target window is hung. Thus I try to avoid using it unless it's clearly necessary such as in the case of ControlFocus and ControlGetFocus.

The MSDN states: "The SetActiveWindow function activates a window, but not if the application is in the background. The window will be brought into the foreground (top of Z-Order) if its application is in the foreground when the system activates the window."

The above implies that your use of SetActiveWindow() will almost always fail, because in 99% of the cases, the user is using the Control commands on a target window that is NOT the foreground window.



Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this