Jump to content
Sign in to follow this  


Recommended Posts


#Region --- Function ActivateWindow()
; Function Name : ActivateWindow()
; Description  : Activate the windows of $s_Name
; Syntax   : ActivateWindow($s_Name, $f_maximize = 1)
; Parameter(s) : $s_Name
;      $f_maximize
; Requirement(s) : None
; Return Value(s) : On Success - Returns a True 
;              On Failure - Returns an False and sets @Error
;                    @Error = 1 Window could not be activated
;     @Error = 2 Window could not be found
;  Author      : Terarin Kerowyn
; Modification: : None
;  Note(s)       : 
;  Link         : 
Func ActivateWindow($s_Name, $f_maximize = 1)
    $s_handle = WinGetHandle("[Title:" & $s_Name & "]") 
 If Not @error Then
  If WinWait($s_handle, "", 15000) Then
   If ($f_maximize) Then
    WinSetState($s_handle, "", @SW_MAXIMIZE)
   Return True
   MsgBox(0, "Not Found", "Window (" & $s_Name & ") could not be activate")
   Return False
  MsgBox(0, "Not Found", "Window (" & $s_Name & ") could not be found")
  Return False
#EndRegion --- Function ActivateWindow()

I am getting the wrong way this is setup in my code but it always seems to fail at the SetError(2) Return False step at this location.

While ActivateWindow("Testing - Windows Internet Explorer")
 Msgbox(0, "", "Found")
 $oIE = _IECreate("c:/Testing.html")

Can anyone figure way this always seems to be incorrect. I also tried it backwards by trying Not in front of the functions name and got it to loading but the it had no chance to escape out

Contact via MSN: [email=terarink_msn@hotmail.com]terarink_msn@hotmail.com[/email], yahoo: terarink_yah

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.