C# slow form COMInterop VBScript

G

Guest

Hi Guys,

I'm ripping off all of my hair soon ;-)

I'm trying to do a very simple C# form accessible from COM client like
VBScript.

I would like to display the form and update the form during the
intepretation of the vbscript. Does anyone know of any good example that
could point me to the right direction.

I've already trying to achive this and the vbscript display the form but the
performance of displaying the form is terrible. On first display it creates
control by control and it takes seconds to display a simple form with 6
labels and a listcontrol.

The code is compiled to a windows class library containing the forms.

Any info is greatly appriciated!

BR,
Jonas
 
N

Nicholas Paldino [.NET/C# MVP]

Jonas,

Can you post an example of the script and the code you used to compile
the assembly? Part of it could be to start up the CLR in the process (you
are doing COM interop after all).
 
G

Guest

Nicoulas, thanks for the quick reply!

C# Code:

[ComVisible(true)]
[ProgId("SYSteam.LogonBox")]
[ClassInterface(ClassInterfaceType.AutoDual)]
public class MainClass
{

LogonBox logonBox;

public MainClass()
{
logonBox = null;
}

public void Show()
{
string userName;
string userDomain;
string logonServer;
string serverName;

logonBox = new LogonBox();

userName = System.Environment.GetEnvironmentVariable("USERNAME");
userDomain =
System.Environment.GetEnvironmentVariable("USERDOMAIN");
logonServer =
System.Environment.GetEnvironmentVariable("LOGONSERVER");
serverName =
System.Environment.GetEnvironmentVariable("COMPUTERNAME");

logonBox.SetInfo(serverName, logonServer, userDomain + @"\" +
userName);


logonBox.Show();
}

VBScript Code:

Dim objLogonBox

Set objLogonBox = CreateObject("SYSteam.LogonBox")

objLogonBox.Show()

objLogonBox.addline("Welcome to the domain...")


It's really sucha simple app and I can't understand the performance issue in
this.
The form is displayed and you'll see each control on the form beeing drawn.

Thanks in advance.

BR,
Jonas


Nicholas Paldino said:
Jonas,

Can you post an example of the script and the code you used to compile
the assembly? Part of it could be to start up the CLR in the process (you
are doing COM interop after all).


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Drwtsn32 said:
Hi Guys,

I'm ripping off all of my hair soon ;-)

I'm trying to do a very simple C# form accessible from COM client like
VBScript.

I would like to display the form and update the form during the
intepretation of the vbscript. Does anyone know of any good example that
could point me to the right direction.

I've already trying to achive this and the vbscript display the form but
the
performance of displaying the form is terrible. On first display it
creates
control by control and it takes seconds to display a simple form with 6
labels and a listcontrol.

The code is compiled to a windows class library containing the forms.

Any info is greatly appriciated!

BR,
Jonas
 
G

Guest

Well I don't think it has to do with the CLR, since when I'm using
..showdialog it show the form as fast as it should be. Thou that is not an
optio in this case since I would like to update the form controls and
properties from VBScript.

//Jonas

Drwtsn32 said:
Nicoulas, thanks for the quick reply!

C# Code:

[ComVisible(true)]
[ProgId("SYSteam.LogonBox")]
[ClassInterface(ClassInterfaceType.AutoDual)]
public class MainClass
{

LogonBox logonBox;

public MainClass()
{
logonBox = null;
}

public void Show()
{
string userName;
string userDomain;
string logonServer;
string serverName;

logonBox = new LogonBox();

userName = System.Environment.GetEnvironmentVariable("USERNAME");
userDomain =
System.Environment.GetEnvironmentVariable("USERDOMAIN");
logonServer =
System.Environment.GetEnvironmentVariable("LOGONSERVER");
serverName =
System.Environment.GetEnvironmentVariable("COMPUTERNAME");

logonBox.SetInfo(serverName, logonServer, userDomain + @"\" +
userName);


logonBox.Show();
}

VBScript Code:

Dim objLogonBox

Set objLogonBox = CreateObject("SYSteam.LogonBox")

objLogonBox.Show()

objLogonBox.addline("Welcome to the domain...")


It's really sucha simple app and I can't understand the performance issue in
this.
The form is displayed and you'll see each control on the form beeing drawn.

Thanks in advance.

BR,
Jonas


Nicholas Paldino said:
Jonas,

Can you post an example of the script and the code you used to compile
the assembly? Part of it could be to start up the CLR in the process (you
are doing COM interop after all).


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Drwtsn32 said:
Hi Guys,

I'm ripping off all of my hair soon ;-)

I'm trying to do a very simple C# form accessible from COM client like
VBScript.

I would like to display the form and update the form during the
intepretation of the vbscript. Does anyone know of any good example that
could point me to the right direction.

I've already trying to achive this and the vbscript display the form but
the
performance of displaying the form is terrible. On first display it
creates
control by control and it takes seconds to display a simple form with 6
labels and a listcontrol.

The code is compiled to a windows class library containing the forms.

Any info is greatly appriciated!

BR,
Jonas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top