How can I launch a VB.NET 2005 exe from a vb6 exe?

Is there a way for me to launch a VB.NET 2005 exe from a vb6 exe?

I created a stand-alone vb.net 2005 app.  I built it.  I installed it using ClickOnce.
It created all the subdirectories and burried it somewhere deep within my system.
It also created an "Application Reference" in the Start - Programs menu.
I cannot figure out how to accss this application from code in vb6.

I tried

dim NetApp as long
NetApp = Shell("C:\Documents and Settings\MyComp\Start Menu\Programs\NetApp\NetApp", vbMaximizedFocus")
but that doesnt work.  it says the file cannot be found.

I cannot hard code the exe's location in the vb6 app because it installs to a different folder on everyone's PC.

Does anyone know how to do this? Is it possible?  
I dont need to use any variables or any data from the .NET app in the vb6 exe, i just need to launch it.
fesitAsked:
Who is Participating?
 
VBRocksCommented:
fesit:

Instead of using this:
    "\\Server\SharedFolder\AppFolder\NetApp.application",

Try using this:
    "\\Server\SharedFolder\AppFolder\setup.exe"


Providing there is a setup.exe there (there was for me).

0
 
VBRocksCommented:
Is NetApp the name of the app?  It should have a ".exe" or something after it.

0
 
hongjunCommented:
You can use this

System.Diagnostics.Process.Start("C:\Documents and Settings\MyComp\Start Menu\Programs\NetApp\NetApp\yourprogram.exe")

hongjun
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
hatem72Commented:
0
 
hongjunCommented:
To make it maximized, try this

I assume you have import the below namespace

Imports System.Diagnostics
'''''
'''''

Dim startInfo As New ProcessStartInfo()
startInfo.FileName = "C:\Documents and Settings\MyComp\Start Menu\Programs\NetApp\NetApp\yourprogram.exe"
startInfo.WindowStyle = ProcessWindowStyle.Maximized
Process.Start(startInfo)


hongjun
0
 
fesitAuthor Commented:
Thank you both for the quick replies...but.....

System.Diagnostics.... didnt work.
I am trying launch it from vb6.  
I get method or data member not found, talking about the .Diagnostics part

"NetApp" is the name of the application.
But in the Start Menu - the .exe is not there.
Only an "Application Reference"
There is no extension after it.
It's weird.  I had a Shortcut renamed to "NetApp" in my C: drive.  I created the shortcut from the burried folder that contains the acutal NetApp.exe.
Then I copied the Application Reference from the start menu, also named "NetApp" (same as shortcut) - and pasted it into the C: drive.  It did not give me a naming conflict.  I was able to paste it there.  Both files existed with the same name - NetApp the shortcut, and NetApp the Application Reference.

So bottom line, I still cant launch the .NET app from vb6.
.....need.............more............................help......


0
 
hongjunCommented:
VBRocks has pointed out.
There's no file extension.

hongjun
0
 
hongjunCommented:
try this

NetApp = Shell("C:\Documents and Settings\MyComp\Start Menu\Programs\NetApp\NetApp.exe", vbMaximizedFocus)

I notice you have an extra " at the very end.

hongjun
0
 
VBRocksCommented:
For one thing, you don't want to use the following, because it is the path to the Shortcut, not the actual
exectuable itself:
    "C:\Documents and Settings\MyComp\Start Menu\Programs\NetApp\NetApp"

Open explorer and navigate to the "NetApp.exe" file, then copy the full path to the file.  So it should be
something like:
    "C:\C:\Program Files\NetApp\NetApp.exe"


You can also just right-click on the Shortcut and go to Properties, then look at the Target path, and that's
what you'll want to use.

0
 
fesitAuthor Commented:
I have to look more into that Inerop article.
Not sure if that can help me.

There is no file extension because the Application Reference does not have a file extension.
If i reference the shortcut, it works.  If i reference the actual exe, it works.
The problem with that is that the exe installs itself into a different directory on every PC it's installed on.
So I'd either have to hard code every exe specifically to everyone's own PC, which obviously cannot happen - or go around to everyones pc and manually create a shortcut in a directory that will be static for every user so i can at least hardcode that in vb6 - but that is not efficient either.

In case nobody knows the type of directory the actual exe gets installed in, the fully qualified path looks like this:
C:\Documents and Settings\MyComp\Local Settings\Apps\2.0\3004N2YP.8N0\5QX730G9.KLO\enti..tion_29d115623927c249_0001.0000_3afb06197d05839c\NetApp.exe

after the ....\2.0\ folder, the rest of that changes on every PC its installed on

the shell command is not working - (the extra quote was just a typo when posting on here because i wrote it out instead of copying and pasting) - the application reference does not have an .exe extension.  it says the file cannot be found
0
 
hongjunCommented:
It looks more like a click once application.

hongjun
0
 
fesitAuthor Commented:
It is a ClickOnce application - I had posted that in my original question.

How does that help/hurt the situation?  This is the first time i deployed anything in .NET.  
0
 
VBRocksCommented:
You're right, that's exactly what ClickOnce deployment does.  

Is there a set location where the ClickOnce application is being launched from that you can reference,
or does that location change as well?

0
 
fesitAuthor Commented:
What do you mean when you say where it is being "launched" from - the install directory?
the install/update directory is always the same.
but when the user installs it on their own pc, the directory of where the actual .exe is getting installed is in different folders.
like in this example
C:\Documents and Settings\MyComp\Local Settings\Apps\2.0\3004N2YP.8N0\5QX730G9.KLO\enti..tion_29d115623927c249_0001.0000_3afb06197d05839c\NetApp.exe
....after the ....\Apps\2.0\ - that changes.  i dont know how those folders are created...im guessing its got something to do with the registry....
0
 
fesitAuthor Commented:
point value is slowly going up.....
0
 
VBRocksCommented:
Well, yes.  My point is, in ClickOnce deployment, there is no actual shortcut or executable that the user
ever uses.  All they do is launch the program from the install directory, then ClickOnce deployment
installs the program to a unique isolated directory and runs the program for the user.

Since you are using the Shell command to essentially launch the program, it doesn't really matter where
the application is actually installed to and run from by ClickOnce deployment.  Therefore, why not just
use the path to the installation program? (Install directory)

0
 
fesitAuthor Commented:
VBRocks,

That sounded like a really good idea.
You are talking about the Install Directory from the server side, correct?


I tried changing the path in the Shell command to "\\Server\SharedFolder\AppFolder\NetApp.application"
and i get "Invalid procedure call or agrument"
If i change it to .exe, i get File Not Found (because there is no .exe in there)
When using ClickOnce, does it just run the .application file on the server every time the user clicks on the icon in their Start Menu?  That re-installs the latest version of the app?

I also have not tested it, but I didnt know if there would be a user conflict if multiple employees launched the file from the server (that is the install directory) from the vb6 app.  I havent tested that, because I do not see an actual exe file in the Install Directory.
0
 
wsh2Commented:
Nice article (though not definitive) on ClickOnce here:
http://www.15seconds.com/issue/041229.htm

In it the artice the author illustrates the final ClickOnce install directory by adding a button to the application with the following in it:
   MessageBox.Show(System.Reflection.Assembly.GetExecutingAssembly().Location);
This shows the directory that the program is installed in after installation. In a worse case scenario you may want to use reflection to build your own shortcut link.

One other interesting point I noted in the article is the need to select "Yes, this application is available offline or online" when you go to publish. I'm comfortable that you probably did that, however, it doesn;t hurt to mention it.
0
 
wsh2Commented:
Further adding to my comment of above.. "worst case scenario"..

Upon initial startup of the ClickOnce application, using reflection, grab the program location and store it in the registry. When you want to Shell to the program from VB6, read the registry to get the proper executable location. This has the added benefit that if the ClickOnce application version is changed or re-installed in another location, the first execution of the program (which clickonce normally does) will update the registry so that no VB6 program changes will need to be made.
0
 
fesitAuthor Commented:
VBRocks -

Almost.  It works if i use the setup.exe in the shell command, only problem is, out of the 5 times i tested pressing the button to call the shell object, it prompted me to Install the app 3 times.
It's not the end of the world if that happens, but it's kind of annoying to the user to keep having to install the application right after they just installed it the last time they clicked on the button.
so far, this is the closest thing though....

anybody have any thoughts??

thanks
jae
0
 
VBRocksCommented:
Not sure why.  It doesn't do that for me.  It only installs the first time, then launches successfully every
time thereafter...

0
 
VBRocksCommented:
Are you uninstalling it between launches?
0
 
fesitAuthor Commented:
nope. not uninstalling.
its random.  happens every once in a while.  not every time.  but id say maybe every 3 out of 10 times.
0
 
VBRocksCommented:
Definitely annoying.  Sorry I don't have an answer for you on that one.
0
 
fesitAuthor Commented:
VBRocks - sorry it took me so long to reward points.
I got sidetracked on another project

Im still having that problem where every once in a while, it re-installs the application - but its the closest thing ive got for right now.

Thanks to everyone for their input.

Take care...
Jason
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.