Jump to content

MsRdpClient


Recommended Posts

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
Link to comment
Share on other sites

  • 7 months later...

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?

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 6 years later...

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
Link to comment
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
 Share

  • Recently Browsing   0 members

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