StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Opening an AppMain instance from a VB6...Expand / Collapse
Author
Message
Posted 07/06/2006 11:24:36 AM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: Today @ 3:40:41 PM
Posts: 328, Visits: 479
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.
Post #1737
Posted 07/06/2006 11:51:42 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 2:14:29 PM
Posts: 4,901, Visits: 4,886
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.

Post #1738
Posted 07/06/2006 3:21:40 PM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: Today @ 3:40:41 PM
Posts: 328, Visits: 479
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...
Post #1744
Posted 07/06/2006 3:25:42 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 12/09/2008 3:36:08 PM
Posts: 2,686, Visits: 1,891
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.


www.bungie.net
Post #1746
Posted 07/06/2006 3:54:40 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 2:14:29 PM
Posts: 4,901, Visits: 4,886
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.

Post #1752
Posted 07/06/2006 4:17:01 PM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: Today @ 3:40:41 PM
Posts: 328, Visits: 479
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.
Post #1759
Posted 07/06/2006 4:21:45 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 2:14:29 PM
Posts: 4,901, Visits: 4,886
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

Post #1760
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 5:19pm

Powered by InstantForum.NET v4.1.4 © 2009
Execution: 0.125. 9 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.