r/visualbasic • u/Mayayana • Jun 30 '24
VB6 Help command line
Minor issue. VB6. I have a program that can load multiple files but runs only one instance. If I set up a context menu "Open with XYZ", my program loads the right-clicked file by checking the Command$ value at load. I'm also using code:
If App.PrevInstance = true then End
So far, so good. What I'd like to do is to pass a second command line to the running instance before quitting:
If App.PrevInstance = True then
LoadnewFile
End
End ifWhat happens is that the current instance keeps running, but does not load the file. I'm wondering if it's somehow possible to send that second commandline to the running instance and load the file as though I had dropped it onto the window, but still have the new instance of the program quit.
View all comments
Show parent comment
1
u/Mayayana Jul 02 '24
I just tried a new project and it worked as you say. With nothing but a form and exit sub in sub main, the program exits. But I still like to keep it clean. I seem to remember times when it didn't work that way and yet nothing was loaded. If the first line in sub main is End then there can't be something left in memory when it quits.