Particle

MsRdpClient

16 posts in this topic

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

Share this post


Link to post
Share on other sites



Maybe this way:

$Gui = GUICreate("Gui", 586, 434, 228, 317)
$oRDP = ObjCreate("MsTscAx.MsTscAx")
...
ObjEvent($oRDP,"Run_")
.
.
.
Func Run_OnLoginComplete()
      ...
EndFunc

Share this post


Link to post
Share on other sites

Thanks :D

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

Nope, it'll call this function with the event name.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Nope, it'll call this function with the event name.

Can you please explain what you mean?

Share this post


Link to post
Share on other sites

Try OnConnected() instead. Like:

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

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

Share this post


Link to post
Share on other sites

#10 ·  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

Share this post


Link to post
Share on other sites

Sorry, I have no computer to RDP upon lol but I do get notified about other events such as OnDisconnect or OnConnecting.

Share this post


Link to post
Share on other sites

hmm... i've tried every single method from this site, but i'm not getting a single notification.

Any ideas what could be wrong?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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"

Share this post


Link to post
Share on other sites

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.

$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.Connect()

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

 

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