Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.



This topic is 5821 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m working on an MDI-based editing program that will be the default program for several types of files. If a file is opened, I can easily obtain this file information in the arguments passed to my program. Then the program simply opens the file (yeah yeah, we all know this).. My problem is, if I try and open another file, it will spawn a new instance of the program, and the file will be opened in the new instance. How can I have the original program accept all new files that try to be opened? Since it''s an MDI window, I of course want the file to be opened within it, not a whole new instance of the program. Any help on this is appreciated.

Share this post

Link to post
Share on other sites
first, you need to use a named mutex so that second instance can detect first.

then, you need to use interprocess communication to pass the filename from second to first instance. WM_COPYDATA is an easy way to accomplish this.

beware of paths. if second instance is launched with relative filename, and its working directory is different from working directory of first instance, open will likely fail. convert filenames to absolute (aka fully qualified) ones before passing them across processes. GetFullPathName does that.

damn search feature isn''t working, now i can''t find the thread with discussion of mutexes for detecting second instance. anyone got a link?

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!