|
| |||||||||
| Tags: activex, imstscax, terminal services |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| How to make IMsTscAx control connect?
I want to write an application (in C++) that is able to connect to a terminal server using the IMsTscAx ActiveX Control. But all my endeavours to establish a connection using this control didn't give any result. After creation of the control, I call IMsTscAx::Connect() method, but it does nothing. It doesn't begin to connect. I found it out looking at the code in disassembler: actually this code checks the control's member field to be a window handle (by passing it to IsWindow API function), and after discovering that this member is not a window handle the Connect() method just returns. I tried to create a window by the same thread (using only Win32 API) and create an MFC GUI application, but no result. Does anybody have any ideas? Maybe there's another way to connect to TS? |
|
#2
| ||||
| ||||
| Re: How to make IMsTscAx control connect? |
|
#3
| |||
| |||
| Re: How to make IMsTscAx control connect?
Thank you for these references. Actually, they didn't help me. As it became clear yesterday, I had some problems with the mstscax.dll. Replacing this server with another one (from my friend's system) solved this problem. |
|
#4
| ||||
| ||||
| Re: How to make IMsTscAx control connect?
Great that you found out and solved the problem. Everythings well if theres an Happy Ending ![]() |
|
#5
| |||
| |||
| Re: How to make IMsTscAx control connect?
hi EgnartsMs ! I'm also developing a connect application using msrdp.ocx activeX control. it worked when i register it (using regsvr32.exe) and include this activeX control's source files in my work space (similarly the way activeX controls are added to work-space). But i want to use this activeX control without registering it (by making a COM client application and considering msrdp.ocx as COM server), but now after making the interface its showing different functions than those fucntions which were there in my previous work-space and create() function is also not there which initializes activeX control & attach it to our application(dialogs in case of mfc). So when i tried to call connect() method with create() method .. it didnt get connected ![]() and after that i initialize activeX control and attach it using createcontrol() function ... but now this function is throwing debug assertion in occsite.com line 901 void CRemoteDesktopDlg::ConnectRemoteDesktop() { HRESULT hr = CoInitialize(NULL); //MSTSCLib MSTSCLib::IMsRdpClient2* pInterface; //generic method CLSID clsid = __uuidof(MSTSCLib::MsRdpClient3); IID iid = __uuidof(MSTSCLib::IMsRdpClient3); HRESULT hrInterface = CoCreateInstance(clsid,NULL, CLSCTX_INPROC_SERVER,iid,(void**) &pInterface); if (SUCCEEDED(hrInterface)) { int iScreenWidth = GetSystemMetrics(SM_CXSCREEN); int iScreenHeight = GetSystemMetrics(SM_CYSCREEN); CRect lRect; // Get the display area available GetClientRect(lRect); lRect.NormalizeRect(); CWnd *pWnd = CWnd::FromHandle(this->m_hWnd); //CWnd *pWnd1 = GetParent(); CreateControl(clsid,"Test",WS_VISIBLE,CRect(lRect.top,lRect.left, lRect.Width(),lRect.Height()),pWnd,10); pInterface->PutServer("abc.com"); pInterface->AdvancedSettings2->put_RDPPort(4000); pInterface->PutFullScreen(true); pInterface->put_DesktopWidth(iScreenWidth); pInterface->put_DesktopHeight(iScreenHeight); HRESULT hrConnect = pInterface->Connect(); } else if(FAILED(hrInterface)) { MessageBox("Failed to create pInterface pointer"); } } in createcontrol() function, i'm getting assertion that i described above and if i don't use this function then pInterface->Connect() doesn't connects to the server listening on 4000 port. Last edited by Lokesh_dce : 19-01-2009 at 01:14 PM. |
|
#6
| ||||
| ||||
| Re: How to make IMsTscAx control connect?
Do not ignore this assertion, because if you do so an access violation error may occur. A supported hotfix is now available from Microsoft, but it is only intended to correct the problem. Only apply it to systems that are experiencing this specific problem. http://support.microsoft.com/kb/824647 Hope this will help you. |
|
#7
| |||
| |||
| Re: How to make IMsTscAx control connect?
Hi Xsi !! I'm using VC++ 6.0 (visual studio 6.0) cos i don't wanna use visual studio .Net 2003 or higher version as it requires .Net framework to be installed in the client's machine. The assertion(occsite.cpp line:901) says 'activeX control already attached' so i think i don't need to call above mentioned CreateControl() function in order to attach this msrdp.ocx activeX control to my application. I also tried getting connection flag after calling connect method : long lConnect = -1; HRESULT hrConnect = pInterface->Connect(); pInterface->get_StartConnected(&lConnect); hrConnect = 0 (means S_OK)and lConnect = 1 ... that means it has sent a connect request according to it but i'm not receiving any incoming request at server end ![]() Please help !!! |
|
#8
| |||
| |||
| Re: How to make IMsTscAx control connect?
Hi, I read this thread with interest because I'm trying to do something related. I'm trying to use the terminal services client component (implemented in mstscax.dll) in a C++ win32 native app that doesn't use MFC. I can get an instance of the component going but can't (easily) access any of its methods because I don't have, and can't find, the relevant header file. I'm new to COM/ActiveX and don't understand these things very well. I think that the information I need might be contained in an idl file and that this might be used to generate the relevant headers, but I don't know how to do this and don't know what the relevant idl file is. Any help would be much appreciated. Cheers, Ian. |
|
#9
| |||
| |||
Re: How to make IMsTscAx control connect?
@IanLyon: I'm not that good in COM/ActiveX but have you tried using QueryInterface()? @all: I've got serious issues with painting of the RDP contents. When the RDP session is opened and connected and a window is moved over the RDP ActiveX, the RDP screen is not correctly repainted. Every region the other window has been moved over, becomes gray (background color of the dialog). I'm using Visual Studio 2005 and created a new MFC project, where the RDP ActiveX has been added with "Insert ActiveX Control..." and choosing "Microsoft Terminal Service Client". Afterwards a variable has been added by right-clicking on the added ActiveX and selecting "Add Variable..." and naming it "m_rdpclient". Do I miss something? I've tried to call m_rdpclient.Invalidate() and m_rdpclient.UpdateWindow() inside OnPaint() and OnEraseBkgnd() but without success... ![]() Furthermore has anyone successfully called the RDP ActiveX function "SendKeys"? I appreciative any hints!! Best Regards Ting |
|
#10
| |||
| |||
| Re: How to make IMsTscAx control connect?
@IanLyon:By generating MFC classes for the mstscax.dll using the class wizard, the following line is added to the *.h class files: #import "C:\\WINDOWS\\system32\\Mstscax.dll" no_namespace Afterwards you can find two files (mstscax.tlh, mstscax.tli) inside the build directroy and the compiler seems to include them automatically so you can type __uuidof(IMsTscAx). Maybe this helps... |
|
#11
| |||
| |||
Re: How to make IMsTscAx control connect?
Hello, i got a Problem with the mstscax.dll as well. I hope you dont mind i am bringin back old posts I started with a simple MFC-dialogbased app. I followed what you did post here and did use: #import "C:\\WINDOWS\\system32\\Mstscax.dll" no_namespace Now i got 3 error for the same line of mstscax.tlh: 'UINT_PTR': new definition; different basetype Code: #if !defined(_WIN64) typedef __w64 unsigned long UINT_PTR; //<<--right here #else typedef unsigned __int64 UINT_PTR; #endif #if !defined(_WIN64) typedef __w64 long LONG_PTR; #else typedef __int64 LONG_PTR; #endif typedef enum __MIDL_IMsRdpClientNonScriptable4_0001 RedirectionWarningType; |
|
#12
| |||
| |||
| Re: How to make IMsTscAx control connect?
Try to change the following line: Code: #import "C:\\WINDOWS\\system32\\Mstscax.dll" no_namespace Code: #import "C:\\WINDOWS\\system32\\Mstscax.dll" /* no_namespace */ |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "How to make IMsTscAx control connect?" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to make the Plantronics 925 headset automatically connect with 2 Phones on power up? | DayaA | Hardware Peripherals | 2 | 13-10-2011 03:15 PM |
| Unable to make changes in parental Control configuration | HatRix | Windows Software | 3 | 23-12-2010 07:03 PM |
| How do I make SC5300LX control additional fans? | Lalitkishore5 | Motherboard Processor & RAM | 6 | 29-06-2010 12:36 PM |
| Make registry editor visible in Control Panel | Elieis | Operating Systems | 5 | 21-01-2010 03:54 AM |
| IMsTscAx ActiveX Control | big_student | Software Development | 2 | 28-05-2009 12:30 AM |