Jump to content

Recommended Posts

Posted

How would I write this in Autoit, cause what I tried doesn't seem to work.

Vb Code

Sub MsRdpClient.OnLoginComplete()
    Msgbox("Login has completed")
End sub

http://msdn.microsoft.com/en-us/library/aa382686(VS.85).aspx

Tried example:

$Gui = GUICreate("Gui", 586, 434, 228, 317)
$oRDP = ObjCreate("MsTscAx.MsTscAx")
$Obj1_ctrl = GUICtrlCreateObj($oRDP, 0, 0, 584, 432)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
ObjEvent($oRDP,"_Run","OnLoginComplete")
GUISetState(@SW_SHOW)
$oRDP.Server = ""
$oRDP.UserName = ""
$oRDP.AdvancedSettings2.ClearTextPassword = ""
$oRDP.Connect()
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
Func _Run()
    MsgBox(0,"Login","Login has Completed!")
EndFunc
  • 7 months later...
Posted

Hello AutoIt-Community!

I'm quite new to AutoIt and i want to open a rdp-connection via mstscax (Microsoft RDP-Client ActiveX-Control):

#include <WindowsConstants.au3>
#include <GUIConstants.au3>

#NoTrayIcon

$width = 800
$height = 600

GUICreate("Extended Terminal Services Client", $width + 20, $height + 20, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$oRdpClient = ObjCreate("MsTscAx.MsTscAx")
$GUIActiveX = GUICtrlCreateObj($oRdpClient, 10, 10, $width, $height)
ObjEvent($oRdpClient, "Run_")
GUISetIcon("extsc.ico")
GUICtrlSetStyle($GUIActiveX, $WS_VISIBLE)
GUICtrlSetResizing ($GUIActiveX, $GUI_DOCKAUTO)
GUISetState()

$oRdpClient.Server = "myServer"
$oRdpClient.Domain = "myDomain"
$oRdpClient.UserName = "myUsername"
$oRdpClient.AdvancedSettings2.ClearTextPassword = "myPassword"
;$oRdpClient.DesktopWidth = 800
;$oRdpClient.DesktopHeight = 600
;$oRdpClient.ColorDepth = 16
;$oRdpClient.Fullscreen = True
;$oRdpClient.AdvancedSettings3.SmartSizing = True
$oRdpClient.ConnectingText = "Verbindung wird aufgebaut. Bitte warten..."
$oRdpClient.DisconnectedText = "Verbindung wurde getrennt."

$oRdpClient.Connect()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd

Func Run_OnLoginComplete()
    MsgBox(0, "Achtung", "Login Complete!")
EndFunc

GUIDelete()

Exit

Connection works fine (besides some graphical issues when resizing...) but i did not get a LoginComplete-Message. Can anybody give me an advice how to get the events from my activeX-Control?

Posted

modify this line.

ObjEvent($oRdpClient, "Run_")

ObjEvent($oRdpClient, "Run_OnLoginComplete")

Thanks for your reply, but this does not work either:

#include <WindowsConstants.au3>
#include <GUIConstants.au3>

#NoTrayIcon

$width = 800
$height = 600

GUICreate("Extended Terminal Services Client", $width + 20, $height + 20, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$oRdpClient = ObjCreate("MsTscAx.MsTscAx")
$GUIActiveX = GUICtrlCreateObj($oRdpClient, 10, 10, $width, $height)
ObjEvent($oRdpClient, "Run_OnLoginComplete")
GUISetIcon("extsc.ico")
GUICtrlSetStyle($GUIActiveX, $WS_VISIBLE)
GUICtrlSetResizing ($GUIActiveX, $GUI_DOCKAUTO)
GUISetState()

$oRdpClient.Server = "myServer"
$oRdpClient.Domain = "myDomain"
$oRdpClient.UserName = "myUsername"
$oRdpClient.AdvancedSettings2.ClearTextPassword = "myPassword"
;$oRdpClient.DesktopWidth = 800
;$oRdpClient.DesktopHeight = 600
;$oRdpClient.ColorDepth = 16
;$oRdpClient.Fullscreen = True
;$oRdpClient.AdvancedSettings3.SmartSizing = True
$oRdpClient.ConnectingText = "Verbindung wird aufgebaut. Bitte warten..."
$oRdpClient.DisconnectedText = "Verbindung wurde getrennt."

$oRdpClient.Connect()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd

Func Run_OnLoginComplete()
    MsgBox(0, "Achtung", "Login Complete!")
EndFunc

GUIDelete()

Exit
Posted (edited)

Try OnConnected() instead. Like:

ObjEvent($oRdpClient, "Run_")
;...

Func Run_OnConnected()
   MsgBox(0x40, "Title", "Text")
EndFunc

Sorry, tried this - did not work. No MsgBox after connecting. Does this example works for you? Edited by univeda
Posted

What AutoIt version are you using? OS? etc.. If you don't mind.

AutoIt 3.3.0.0

mstscax.dll 6.0.6002.18045

OS:WIN_VISTA/Service Pack 2 CPU:X64 OS:X86

Posted

AutoIt 3.3.0.0

mstscax.dll 6.0.6002.18045

OS:WIN_VISTA/Service Pack 2 CPU:X64 OS:X86

Tested this now with newest Beta, but still no events:

Running:(3.3.1.4):C:\Entwicklung\AutoIt3\beta\autoit3.exe "H:\Entwicklung\AU\extsc\extsc.au3"
  • 6 years later...
Posted (edited)

I know this is a really old thread but I thought I would post how I got the OnLoginComplete event to work in case anyone finds this from google.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$oRDP = ObjCreate("MsTscAx.MsTscAx")
GUICreate("Embedded RDP control Test", 640, 480, -1 , -1, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
$GUIActiveX = GUICtrlCreateObj($oRDP, 10, 10, 620, 460)
GUISetState()

ObjEvent($oRDP, 'rdpevent_')

func rdpevent_OnLoginComplete()
    ConsoleWrite('login event' &@CRLF)
EndFunc

$oRDP.Server = "SERVER.ADDRESS"
$oRDP.AdvancedSettings.RDPPort = 3389

$oRDP.Connect()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd

GUIDelete()
Edited by garbb
slight code fix

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...