Particle Posted March 23, 2009 Share Posted March 23, 2009 How would I write this in Autoit, cause what I tried doesn't seem to work.Vb CodeSub MsRdpClient.OnLoginComplete() Msgbox("Login has completed") End subhttp://msdn.microsoft.com/en-us/library/aa382686(VS.85).aspxTried 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 More sharing options...
Authenticity Posted March 24, 2009 Share Posted March 24, 2009 Maybe this way: $Gui = GUICreate("Gui", 586, 434, 228, 317) $oRDP = ObjCreate("MsTscAx.MsTscAx") ... ObjEvent($oRDP,"Run_") . . . Func Run_OnLoginComplete() ... EndFunc Link to comment Share on other sites More sharing options...
Particle Posted March 24, 2009 Author Share Posted March 24, 2009 Thanks Link to comment Share on other sites More sharing options...
univeda Posted October 26, 2009 Share Posted October 26, 2009 Hello AutoIt-Community! I'm quite new to AutoIt and i want to open a rdp-connection via mstscax (Microsoft RDP-Client ActiveX-Control): expandcollapse popup#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 More sharing options...
spudw2k Posted October 26, 2009 Share Posted October 26, 2009 modify this line. ObjEvent($oRdpClient, "Run_") ObjEvent($oRdpClient, "Run_OnLoginComplete") Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Authenticity Posted October 26, 2009 Share Posted October 26, 2009 Nope, it'll call this function with the event name. Link to comment Share on other sites More sharing options...
univeda Posted October 26, 2009 Share Posted October 26, 2009 modify this line. ObjEvent($oRdpClient, "Run_") ObjEvent($oRdpClient, "Run_OnLoginComplete") Thanks for your reply, but this does not work either: expandcollapse popup#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 More sharing options...
univeda Posted October 26, 2009 Share Posted October 26, 2009 Nope, it'll call this function with the event name.Can you please explain what you mean? Link to comment Share on other sites More sharing options...
Authenticity Posted October 26, 2009 Share Posted October 26, 2009 Try OnConnected() instead. Like: ObjEvent($oRdpClient, "Run_") ;... Func Run_OnConnected() MsgBox(0x40, "Title", "Text") EndFunc Link to comment Share on other sites More sharing options...
univeda Posted October 26, 2009 Share Posted October 26, 2009 (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 October 26, 2009 by univeda Link to comment Share on other sites More sharing options...
Authenticity Posted October 26, 2009 Share Posted October 26, 2009 Sorry, I have no computer to RDP upon lol but I do get notified about other events such as OnDisconnect or OnConnecting. Link to comment Share on other sites More sharing options...
univeda Posted October 27, 2009 Share Posted October 27, 2009 hmm... i've tried every single method from this site, but i'm not getting a single notification.Any ideas what could be wrong? Link to comment Share on other sites More sharing options...
Authenticity Posted October 27, 2009 Share Posted October 27, 2009 What AutoIt version are you using? OS? etc.. If you don't mind. Link to comment Share on other sites More sharing options...
univeda Posted October 27, 2009 Share Posted October 27, 2009 What AutoIt version are you using? OS? etc.. If you don't mind.AutoIt 3.3.0.0mstscax.dll 6.0.6002.18045OS:WIN_VISTA/Service Pack 2 CPU:X64 OS:X86 Link to comment Share on other sites More sharing options...
univeda Posted October 27, 2009 Share Posted October 27, 2009 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" Link to comment Share on other sites More sharing options...
garbb Posted November 8, 2015 Share Posted November 8, 2015 (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 June 7, 2020 by garbb slight code fix Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now