only one instance

Started by
15 comments, last by bladesnet 20 years, 1 month ago
Private Sub Form_Load()  If App.PrevInstance Then    MsgBox "Previous instance detected. Aborting..."    End  End IfEnd Sub 


Pretty brain-dead simple

daerid | Legends | Garage Games | Spirit | Hapy | Boost | Python | Google
"Doomed to crumble, unless we grow, and strengthen our communication" - Maynard James Keenan, Tool
daerid@gmail.com
Advertisement
And if you find that PrevInstance is true, you can use FindWindow and SendMessage to add the file to the previous instance. See this thread for more info (and maybe run a search on PrevInstance in that forum for even more info).

shmoove
thankx
that was a simple one(now that's workin')

well i'm still having problems with the sending of the data to the existing window :
m_hwnd=FindWindow(vbnullstring,"myPLayer")
{"myPLayer" being the name of my form}
returns 0 and i don't know why?
my gues is that this the reson why the setforegroundwindow or setactivewindow does not work
any ideas?

thankx everyone


[edited by - bladesnet on March 15, 2004 12:42:40 PM]
Never the why, Allways the how
I know nothing of vb but...
is the ''L'' really capital in ''myPLayer''??
yes it''s a capital "L" in myPLayer, but even if it wouldn''t be it still does not work
Never the why, Allways the how
so the problem is that the app is running fine but now you can't add files to the playlist while it's running? it seems that you are loading your playlist with a seperate program, is that correct? this sounds like bad design or a broken app to me. why not just modify your app so that there is an "add to playlist" button that you "click", like in winamp or any other mp3 player?

-me

[edited by - Palidine on March 17, 2004 1:11:14 PM]
maybe sending the data wouldn''t be a problem if i could find the preveous instance of my program.
all it does is detect that another instance is running and shuts it self down...i would need the
FindWindow(vbnullstring,"myPLayer") to return the adress of my previous instance so i would know where to send the data...



Never the why, Allways the how

This topic is closed to new replies.

Advertisement