Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / January 2004

Tip: Looking for answers? Try searching our database.

COM Automation - Simple port from VB failing

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mike Miller - 29 Dec 2003 23:47 GMT
The following code starts an application for automation in
VB:
   Dim IMFAObj As Object
   Set IMFAObj = CreateObject("Famas2000.Application")

The VB.NET code is as follows:
   Dim IMFAObj As Object
   IMFAObj = CreateObject("Famas2000.Application")

The VB.NET code starts the application for a brief second,
then the application is shutdown (without any errors from
what I can tell when I attach the the native debugger to
the process).  Any ideas of what could be different
between .NET and VB that would be causing this problem?  
Any help would be appreciated.
Thanks,
Mike
Paul Clement - 30 Dec 2003 13:37 GMT
¤ The following code starts an application for automation in
¤ VB:
¤     Dim IMFAObj As Object
¤     Set IMFAObj = CreateObject("Famas2000.Application")
¤
¤ The VB.NET code is as follows:
¤     Dim IMFAObj As Object
¤     IMFAObj = CreateObject("Famas2000.Application")
¤
¤ The VB.NET code starts the application for a brief second,
¤ then the application is shutdown (without any errors from
¤ what I can tell when I attach the the native debugger to
¤ the process).  Any ideas of what could be different
¤ between .NET and VB that would be causing this problem?  
¤ Any help would be appreciated.
¤ Thanks,
¤ Mike

Can you add the component reference to your project (generating the interop library) and use early
binding instead of late binding?

Dim IMFAObj As Famas2000.Application

IMFAObj = New Famas2000.Application

Paul ~~~ pclement@ameritech.net
Microsoft MVP (Visual Basic)
Mike Miller - 31 Dec 2003 18:29 GMT
Paul,
I tried that as well, but it didn't make a difference.  
The same problem was still occurring.
Thanks,
Mike

>-----Original Message-----
>
[quoted text clipped - 26 lines]
>Microsoft MVP (Visual Basic)
>.
Paul Clement - 02 Jan 2004 13:51 GMT
¤ Paul,
¤ I tried that as well, but it didn't make a difference.  
¤ The same problem was still occurring.
¤ Thanks,
¤ Mike
¤

Could this be a scope issue? Is your object variable going out of scope which causes the automation
server to terminate?

Maybe you could verify when it terminates by setting a debug breakpoint in code and then stepping
through until the automation server shuts down.

Paul ~~~ pclement@ameritech.net
Microsoft MVP (Visual Basic)
Mike Miller - 05 Jan 2004 19:51 GMT
Paul,
I tried what you suggested with the debugger and the
automation application terminates immediately even if the
debugger is stopped at a break point on the next line.
For example I added the following code directly after the
application is started:

Thread.Sleep(10000);

When the debugger hits this line the app has already
shutdown, but the variable is still in scope (as I can see
it in the watch & locals window).
Mike

>-----Original Message-----
>
[quoted text clipped - 14 lines]
>Microsoft MVP (Visual Basic)
>.
Paul Clement - 06 Jan 2004 14:00 GMT
¤ Paul,
¤ I tried what you suggested with the debugger and the
¤ automation application terminates immediately even if the
¤ debugger is stopped at a break point on the next line.
¤ For example I added the following code directly after the
¤ application is started:
¤
¤ Thread.Sleep(10000);
¤
¤ When the debugger hits this line the app has already
¤ shutdown, but the variable is still in scope (as I can see
¤ it in the watch & locals window).
¤ Mike

Well this is new to me. Typically the problem is that the automation server won't shut down. ;-)

I have one other idea you may want to try. Can you use Process.Start to launch your automation
server and then use GetObject to set a variable instance to that object for automation?

I don't know much about your automation server (custom? third-party?) but I'm wondering whether it's
looking for something that's being provided by Visual Basic or your Visual Basic application and not
by VB.NET.

Paul ~~~ pclement@ameritech.net
Microsoft MVP (Visual Basic)

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.