By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,241 Members | 799 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,241 IT Pros & Developers. It's quick & easy.

C# slow form COMInterop VBScript

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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.