Sign in to follow this  
Followers 0
TerarinKerowyn

WindowActivate()

1 post in this topic

#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
   WinActivate($s_handle)
   
   If ($f_maximize) Then
    WinSetState($s_handle, "", @SW_MAXIMIZE)
   EndIf
    
   Return True
  Else
   MsgBox(0, "Not Found", "Window (" & $s_Name & ") could not be activate")
   SetError(1)
   Return False
  EndIf  
 Else
  MsgBox(0, "Not Found", "Window (" & $s_Name & ") could not be found")
  SetError(2)
  Return False
 EndIf
EndFunc
#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")
 _IELoadWait($oIE)
WEnd

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  
Followers 0