VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

SwitchToThisWindow

Simon Morgan  (1 Submission)   Windows System Services   Visual Basic 5.0   Intermediate   Wed 3rd February 2021

Another way of changing the focus to a particular window, using an un-documented API called SwitchToThisWindow.This API works on Windows 3x, Windows 9x/ME and Windows 2000. I have found it much more reliable than Setfocus/SetFocusAPI or SetForegroundWindow

Inputs
Window caption

Assumes
I have defined a public function ( GetMessageWindow ) in order to show how the SwitchToThisWindow API works in conjunction with the FindWindow API. The GetMessageWindow function can of course be improved to accept parameters and make it more flexible. For this example I just use it to switch to a standard message box.

Returns
Long - Window handle on success, zero on failure

API Declarations
See code window

Rate SwitchToThisWindow (4(4 Vote))
SwitchToThisWindow.bas

SwitchToThisWindow Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters