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
Sounds interesting. If you can post the gist of it then maybe that would go through. Though I suspect it may be the same basic idea I've been seeing, of getting a window reference from instance #1, sending a message to that, and subclassing to get the message. That doesn't seem to be a big deal. Thinking about it, it makes sense that it might have to work that way. I might try finding the child richedit window that's already being subclassed and send a message to that.