C# equivalent of VB6's GetObject

前端 未结 3 943
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-04 08:57

The following VB6 code connects to some third party software and forces a login with the admin username and password:

Set obj = GetObject(, \"workspace.appli         


        
相关标签:
3条回答
  • 2021-01-04 09:14

    GetObject returns a COM control. You'd have to work with COM Interop to do this in C#. (This isn't trivial.)

    0 讨论(0)
  • 2021-01-04 09:18

    Even if you're working with c#, you can use all classes and methods provided by Vb.Net, including GetObject.

    Just add a reference to the .NET Component "Microsoft.VisualBasic".

    Once you have added the reference, you are able to call Microsoft.VisualBasic.Interaction.CreateObject() or Microsoft.VisualBasic.Interaction.GetObject()

    0 讨论(0)
  • 2021-01-04 09:27

    Marshal.GetActiveObject Method

    0 讨论(0)
提交回复
热议问题