C# slow form COMInterop VBScript

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Drwtsn32

    #1

    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
  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: C# slow form COMInterop VBScript

    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]
    - mvp@spam.guard. caspershouse.co m

    "Drwtsn32" <Drwtsn32@discu ssions.microsof t.com> wrote in message
    news:3FD7B011-DB75-4BBF-AFD1-CC7EC554138F@mi crosoft.com...[color=blue]
    > 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[/color]


    Comment

    • Drwtsn32

      #3
      Re: C# slow form COMInterop VBScript

      Nicoulas, thanks for the quick reply!

      C# Code:

      [ComVisible(true )]
      [ProgId("SYSteam .LogonBox")]
      [ClassInterface( ClassInterfaceT ype.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.Environm ent.GetEnvironm entVariable("US ERNAME");
      userDomain =
      System.Environm ent.GetEnvironm entVariable("US ERDOMAIN");
      logonServer =
      System.Environm ent.GetEnvironm entVariable("LO GONSERVER");
      serverName =
      System.Environm ent.GetEnvironm entVariable("CO MPUTERNAME");

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


      logonBox.Show() ;
      }

      VBScript Code:

      Dim objLogonBox

      Set objLogonBox = CreateObject("S YSteam.LogonBox ")

      objLogonBox.Sho w()

      objLogonBox.add line("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:
      [color=blue]
      > 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]
      > - mvp@spam.guard. caspershouse.co m
      >
      > "Drwtsn32" <Drwtsn32@discu ssions.microsof t.com> wrote in message
      > news:3FD7B011-DB75-4BBF-AFD1-CC7EC554138F@mi crosoft.com...[color=green]
      > > 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[/color]
      >
      >
      >[/color]

      Comment

      • Drwtsn32

        #4
        Re: C# slow form COMInterop VBScript

        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:
        [color=blue]
        > Nicoulas, thanks for the quick reply!
        >
        > C# Code:
        >
        > [ComVisible(true )]
        > [ProgId("SYSteam .LogonBox")]
        > [ClassInterface( ClassInterfaceT ype.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.Environm ent.GetEnvironm entVariable("US ERNAME");
        > userDomain =
        > System.Environm ent.GetEnvironm entVariable("US ERDOMAIN");
        > logonServer =
        > System.Environm ent.GetEnvironm entVariable("LO GONSERVER");
        > serverName =
        > System.Environm ent.GetEnvironm entVariable("CO MPUTERNAME");
        >
        > logonBox.SetInf o(serverName, logonServer, userDomain + @"\" +
        > userName);
        >
        >
        > logonBox.Show() ;
        > }
        >
        > VBScript Code:
        >
        > Dim objLogonBox
        >
        > Set objLogonBox = CreateObject("S YSteam.LogonBox ")
        >
        > objLogonBox.Sho w()
        >
        > objLogonBox.add line("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:
        >[color=green]
        > > 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]
        > > - mvp@spam.guard. caspershouse.co m
        > >
        > > "Drwtsn32" <Drwtsn32@discu ssions.microsof t.com> wrote in message
        > > news:3FD7B011-DB75-4BBF-AFD1-CC7EC554138F@mi crosoft.com...[color=darkred]
        > > > 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[/color]
        > >
        > >
        > >[/color][/color]

        Comment

        Working...