473,385 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Failure to add msrdp.ocx control to C#.NET or VB.NET form.

Need: Auto-logon to a terminal server, start a program, and, when the user
is quits the program, auto-logoff.

Problem: When msrdp.ocx is added to the Toolbox, attempting to draw the
control on the form gives the following "Microsoft Development Environment"
message:

"Compiler errors occured when generating a Windows Forms wrapper for ActiveX
control 'AxMSTSCLib'. Source code saved in '...AxInterop.MSTSCLib.cs'.
c:Documents and Settings\struvew\Local
Settings\Temp\8rzmsoz_.0.cs(493,24):error CS0037: Cannot convert null to
'MSTSCLib.AutoReconnectContinueState' because it is a value type
c:Documents and Settings\struvew\Local
Settings\Temp\8rzmsoz_.0.cs(1282,24):error CS0037: Cannot convert null to
'MSTSCLib.AutoReconnectContinueState' because it is a value type"

Note that I can find no files like "c:Documents and Settings\struvew\Local
Settings\Temp\8rzmsoz" either before, during, or after the above error
message.

There is a similar message from either VC.NET or VB.NET, and the control
never appears on the form.

My workaround has been to use VB6, since the control can be drawn on a VB6
form with no problem. The following code is then used to satify the "Need"
above:

Private Sub Form_Load()
MsRdpClient.DesktopHeight = Screen.Height / Screen.TwipsPerPixelY
MsRdpClient.DesktopWidth = Screen.Width / Screen.TwipsPerPixelX
MsRdpClient.FullScreen = True
UsersForm.Height = (MsRdpClient.DesktopHeight + 30) *
Screen.TwipsPerPixelY
UsersForm.Width = MsRdpClient.DesktopWidth * Screen.TwipsPerPixelX
MsRdpClient.Height = MsRdpClient.DesktopHeight * Screen.TwipsPerPixelY
MsRdpClient.Width = MsRdpClient.DesktopWidth * Screen.TwipsPerPixelX
MsRdpClient.Server = "PC07405"
MsRdpClient.UserName = "******"
MsRdpClient.Domain = "PC07405"
MsRdpClient.AdvancedSettings2.ClearTextPassword = "******"
MsRdpClient.SecuredSettings.StartProgram = _
"D:\\Projects\\RMOnlineQuotes\\bin\\RunApplication .exe
RMAdministrativeTools.exe"
MsRdpClient.FullScreen = True
MsRdpClient.Connect
End Sub

Note that I changed the user name and password to ***** after pasting into
this.

After making the VB6 executable, I call it from C#. Although this works OK,
it is UGLYto have to write part in C# and part in VB6.

Is there anyting I can do so the auto-generated "Windows Forms wrapper" will
complete without error?
Nov 17 '05 #1
2 10018
I wrote my own C# RDP client based on the ocx.

I only added the ActiveX component in code rather than graphically, but that
worked out nicely. There's just one thing.. I don't get any events thrown
from the control for some wicked reason.. I have the listeners properly set
up, but if the user logs off, the control just turns white and the window
never closes (the listener for the disconnect event would close the window,
but since it's never fired).

I don't have access to the code right now, but if you're interested, I can
post the relevant lines for you later on.

Regards
Stephan
Nov 17 '05 #2
Hi Bill,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that when you have drag and drop a Terminal
Services Control on a windows form, a compiler error was generated. If
there is any misunderstanding, please feel free to let me know.

Based on my research, this is a known issue. The wrapper generater fails to
generate correct method for returning an enum value. Here is a workaround.

1. md c:\temp
2. cd c:\temp
3. %<SDK bin directory>%\aximp.exe %windir%\system32\mstscax.dll
This will generate MSTSCLib.dll and AxMSTSCLib.dll.
Make sure Interop.MSTSCLib.dll and AxInterop.MSTSCLib.dll have been deleted
in the obj and bin\Debug directories.
4. Copy the generated files (without renaming) - MSTSCLib.dll and
AxMSTSCLib.dll into the project's obj directory.
5. In the project's references, add MSTSCLib.dll and AxMSTSCLib.dll from
the obj directories.
6. Now, instead of drag-drop'ing the control from the toolbox, write code
to add the control:
Goto Form.cs code view
Declare: private AxMSTSCLib.AxMsTscAx axMsTscAx1;
In InitializeComponent:
this.axMsTscAx1 = new AxMSTSCLib.AxMsTscAx();
((System.ComponentModel.ISupportInitialize)(this.a xMsTscAx1)).BeginInit();

//
// axMsTscAx1
//
this.axMsTscAx1.Enabled = true;
this.axMsTscAx1.Location = new System.Drawing.Point(58, 17);
this.axMsTscAx1.Name = "axMsTscAx1"
this.axMsTscAx1.OcxState =
((System.Windows.Forms.AxHost.State)(resources.Get Object("axMsTscAx1.OcxStat
e")));
this.axMsTscAx1.Size = new System.Drawing.Size(192, 192);
this.axMsTscAx1.TabIndex = 1;
....

this.Controls.Add(this.axMsTscAx1);
((System.ComponentModel.ISupportInitialize)(this.a xMsTscAx1)).EndInit();

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: miqbal | last post by:
IM getting this error when i try to run Teecharts ActiveX control in asp.net environment can some one help me in it Regards Moid Iqbal Catastrophic failure Description: An unhandled...
0
by: David Hodges | last post by:
After installing the service packs from Framework 1.0 and 1.1 on my W2k web server I get the above error on all applications. I am at my wits end and finding nothing on Google that helps. Here...
1
by: Shawn Eary | last post by:
Hello Everyone: I used VB.NET 2003 Standard to create a User Control which I named PersonControl and then overrode its OnLoad routine to use SQL commands to populate its sub-controls. When I...
2
by: sakthisakthi | last post by:
Hai I had developed one web application in dotnet with VB.net as code behind. I had included one addtional Acitvex control (FpLibX.ocx) in toolbar by selecting Cutomize tool bar. Then in...
4
by: - | last post by:
I had added a new field to a form, and try insert the data to the new created table field. But when i try to assign the a control source for that form field, in the control source drop down list it...
0
by: Kristian Reukauff | last post by:
Hi I have a problem with the .Net-Securty-Functions. I've got a client and a server. When I try to register a channel at the server with this line: ChannelServices.RegisterChannel(chan, false);...
0
AnuSumesh
by: AnuSumesh | last post by:
Hi All, I want to call RDP on Page load and it is working fine.My code is in C#. But I am unable to perform following functions 1. when i disconnected from RDP, i want to go back to...
1
by: PJ6 | last post by:
Setting e.Cancel = true on the ChangingPassword event, fired from a ChangePassword control, does not show its failure message. Do I have to use a MembershipProvider, or is there a way to simply...
0
by: aboutjav.com | last post by:
Hi, I need some help. I am getting this error after I complete the asp.net register control and click on the continue button. It crashed when it tries to get it calls this Profile property ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.