Sign in to follow this  
Followers 0
AgentSmithers

ControlClick SW_HiDE GUI with VB.net

2 posts in this topic

#1 ·  Posted (edited)

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.6.1
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
Opt("WinDetectHiddenText", 1)   ;0=don't detect, 1=do detect
MsgBox(0,"Loading","Running POC")
Run("VBAutoitPOC.exe")
WinWaitActive("Autoit Test")
$hWnd = WinGetHandle("Autoit Test")
;ControlClick($hWnd, "", "WindowsForms10.BUTTON.app.0.2bf8098_r19_ad13")
;exit
$button1 = ControlGetHandle ( $hWnd, "", "WindowsForms10.BUTTON.app.0.2bf8098_r19_ad13" )
$button2 = ControlGetHandle ( $hWnd, "", "WindowsForms10.BUTTON.app.0.2bf8098_r19_ad12" )
$button3 = ControlGetHandle ( $hWnd, "", "WindowsForms10.BUTTON.app.0.2bf8098_r19_ad11" )
MsgBox(0,"","VBAutoitPOC.exe Detected, Clicking Button 1")
ControlClick($hWnd, "",$button1)
MsgBox(0,"","VBAutoitPOC.exe Detected, Clicking Button 2")
ControlClick($hWnd, "",$button2)
MsgBox(0,"","VBAutoitPOC.exe Detected, Clicking Button 3")
ControlClick($hWnd, "",$button3)
MsgBox(0,"","Telling VBAutoitPOC.exe to HIDE now. then Button1.")
WinSetState($hWnd,"",@SW_HIDE)
MsgBox(0,"","VBAutoitPOC.exe Detected, Clicking Button 1")
;ControlClick($hWnd, "",$button1)

;ControlClick($hWnd, "", "WindowsForms10.BUTTON.app.0.2bf8098_r19_ad13")
ControlClick($hWnd, "", $button1)
;ControlSend("Button 3 Pushed", "", "", "!B")
MsgBox(0,"","VBAutoitPOC.exe Showing Window again.")
WinSetState($hWnd,"",@SW_SHOW)

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.Text = ("Button 1 Pushed")
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Me.Text = ("Button 2 Pushed")
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Me.Text = ("Button 3 Pushed")
    End Sub
End Class

It seems to work all the way up to SW_HIDE and when the form appears it does not seem to click Button1 at all, Im messed with the code for Hours and I dont have a clue on why it wont click button one while the form is hidden, I've also tried sending the Hotkey but that too does not seem to work. Any idea's?

-Agent

Edited by AgentSmithers

Share this post


Link to post
Share on other sites



Anyone have any Enlightment on this?

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