Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 09-12-2008
Member
 
Join Date: Dec 2008
Posts: 2
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?
Reply With Quote
  #2  
Old 10-12-2008
Member
 
Join Date: May 2008
Posts: 979
Re: How to make IMsTscAx control connect?

http://msdn.microsoft.com/en-us/libr...85(VS.85).aspx
http://www.dabcc.com/win2k/docs/scri...l_services.htm

Hope this will help you.
Reply With Quote
  #3  
Old 15-12-2008
Member
 
Join Date: Dec 2008
Posts: 2
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.
Reply With Quote
  #4  
Old 16-12-2008
Member
 
Join Date: May 2008
Posts: 979
Re: How to make IMsTscAx control connect?

Great that you found out and solved the problem. Everythings well if theres an Happy Ending
Reply With Quote
  #5  
Old 19-01-2009
Member
 
Join Date: Jan 2009
Posts: 2
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.
Reply With Quote
  #6  
Old 19-01-2009
XSI XSI is offline
Member
 
Join Date: May 2008
Posts: 271
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.
Reply With Quote
  #7  
Old 22-01-2009
Member
 
Join Date: Jan 2009
Posts: 2
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 !!!
Reply With Quote
  #8  
Old 22-02-2009
Member
 
Join Date: Feb 2009
Posts: 1
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.
Reply With Quote
  #9  
Old 27-02-2009
Member
 
Join Date: Feb 2009
Posts: 3
question 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
Reply With Quote
  #10  
Old 27-02-2009
Member
 
Join Date: Feb 2009
Posts: 3
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...
Reply With Quote
  #11  
Old 09-04-2009
Member
 
Join Date: Apr 2009
Posts: 1
question 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;
Reply With Quote
  #12  
Old 23-04-2009
Member
 
Join Date: Feb 2009
Posts: 3
Re: How to make IMsTscAx control connect?

Try to change the following line:

Code:
#import "C:\\WINDOWS\\system32\\Mstscax.dll" no_namespace
to:

Code:
#import "C:\\WINDOWS\\system32\\Mstscax.dll" /* no_namespace */
Does somebody have any RDP repaint issues using the RDP ActiveX and MFC?
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


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 02: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 11:36 AM
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 27-05-2009 11:30 PM


All times are GMT +5.5. The time now is 06:25 PM.