CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 19

Threaded View

  1. #16
    Join Date
    Jul 2000
    Milano, Italy

    Mutex...Really nice solution

    Originally posted by hspc
    anyway this is my solution for this prolem :

    How does it work ?
    it creates a mutex (shared object that hace a uniqe name)..
    if you try to recreate it you get the error :
    this is the whole idea...
    I like your solution.

    Another way (not this good, however)
    is to have a check in sub main for a particular form
    (FindWindow api will find it even if it is not visible)
    you load and do not show. If you find it, program is
    already running, if not, it is first instance
    ie attached code

    But your solution is better...
    Attached Files Attached Files
    ...at present time, using mainly Net 4.0, Vs 2010

    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.