Opening an AppMain instance from a VB6 application


Author
Message
Andria Jensen
Andria Jensen
Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)
Group: Forum Members
Posts: 336, Visits: 497
We are currently in the process of converting from VB6 to VB.NET.  We are eventually converting all of our program over to use StrataFrame and .NET, but for now we only have part of it done.  We have taken out the administrative functions and created a StrataFrame app with a separate MDI.  We want to open up this AppMain instance or something similar when we select the appropriate menu option in the VB6 app.  What is the best way to go about doing this?  I've done something like this before with an ActiveX EXE, but that no longer exists in .NET....not sure what the equivalent would be or how any of this would affect the functionality of AppMain in a StrataFrame app.  Please offer suggestions.
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Andria,

To make sure that I understand, you need to call your VB6 code from within the new .NET application, correct?  If this is the case, then you will need to turn you VB6 application into a COM DLL or COM EXE.  This is the same approach we take on our VFP applications.  .NET allows you to import, as a reference, the COM DLL.  It will automatically create an Interop for you.  You can then instantiate forms from your VB6 app within the new .NET environment.

We wrote some additional code to make the VFP forms reside within the main window of the .NET app, and depending on your needs you may have to tweak things a bit.  But I think this is the direction you are probably wanting to go.

Andria Jensen
Andria Jensen
Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)
Group: Forum Members
Posts: 336, Visits: 497
Actually, it's the other way around.  I'm trying to open a StrataFrame MDI (AppMain) from within a VB6 MDI main app.  As of right now I am using a shell execution and opening it that way.  This works okay, except I'm having to resort to a lot of API calls to manipulate the MDI window.  It would be nice if there were an easier way.  I used to do this with ActiveX EXE's, but that's gone in .NET...
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
You can make your .NET application COM-Visible (in the project properties, go to the Application tab, and click the Assembly Information button... "Make assembly COM-Visible" is at the bottom).  You should then be able to call methods directly on the application through some sort of interop in your VB6 application.
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Andria,

To make this .NET COM assembly work, you will need to call the regasm.exe file from the command line to create your type library (TLB) and your registry entries.  When you get to deployment you will have to manually enter the registry classes and entries sinfce regsvr32.exe does not work on .NET COM assemblies.

If you need me to explain further here I can.  Your machine should work fine when you compile your assembly.  It is other machines that becomes more work when deploying your assembly.

Andria Jensen
Andria Jensen
Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)
Group: Forum Members
Posts: 336, Visits: 497
I did the register for COM and I already have the classes showing in my VB6 application.  I can create an AppMain object, but it doesn't recognize any properties or methods inside of it.  That's where I got stuck.  I've done this before with other .NET objects, but I wasn't sure if there was something different about a StrataFrame app that I was overlooking.
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
You have to specify each class that you want to make visible within the COM as COM Visible.  This will allow you to access the internal class when you create a reference of the .NET assembly.

It is an attribute that you assign to the class, like this:

<Microsoft.VisualBasic.ComClass()> _
Public Class MyTestClass

End Class

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search