471,605 Members | 1,473 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

C# slow form COMInterop VBScript

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
Jan 10 '06 #1
3 2852
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]
- mv*@spam.guard.caspershouse.com

"Drwtsn32" <Dr******@discussions.microsoft.com> wrote in message
news:3F**********************************@microsof t.com...
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

Jan 10 '06 #2
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("USERNAM E");
userDomain =
System.Environment.GetEnvironmentVariable("USERDOM AIN");
logonServer =
System.Environment.GetEnvironmentVariable("LOGONSE RVER");
serverName =
System.Environment.GetEnvironmentVariable("COMPUTE RNAME");

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 [.NET/C# MVP]" wrote:
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]
- mv*@spam.guard.caspershouse.com

"Drwtsn32" <Dr******@discussions.microsoft.com> wrote in message
news:3F**********************************@microsof t.com...
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


Jan 10 '06 #3
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" wrote:
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("USERNAM E");
userDomain =
System.Environment.GetEnvironmentVariable("USERDOM AIN");
logonServer =
System.Environment.GetEnvironmentVariable("LOGONSE RVER");
serverName =
System.Environment.GetEnvironmentVariable("COMPUTE RNAME");

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 [.NET/C# MVP]" wrote:
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]
- mv*@spam.guard.caspershouse.com

"Drwtsn32" <Dr******@discussions.microsoft.com> wrote in message
news:3F**********************************@microsof t.com...
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


Jan 10 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by me | last post: by
3 posts views Thread by Abby Lee | last post: by
reply views Thread by Mário Sobral | last post: by
4 posts views Thread by Ariel Gimenez | last post: by
3 posts views Thread by catweezle2010 | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by MichaelMortimer | last post: by
reply views Thread by CCCYYYY | last post: by

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.