CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2000
    Location
    America
    Posts
    130

    My Applications Already Open...

    My program will pop up when an Audio CD is put in the CD-Rom, and load and play the cd. If i already have an instance of my application open, i want the new one (the one that opened to play the cd that was just entered) to not open (or open and close in the backround if nessecary), tell my other instance to load the new cd, and then close the second instance of my application. is this possible?


  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: My Applications Already Open...

    The first problem is easy, just add these lines of code in your statup-object of your program (like sub main()):

    public sub main()

    if app.previnstance then

    ' this will end the progam if another instance is already running
    end

    end if

    end sub



    The second problem, telling it that the is a new cd, is harder to do. You might just set a timer wich checks ever X seconds for a new cd, and when found, plays it. Or.. you can try and use DDE, but i'm not familiar with this. Maybe somebody else...?

    Tom Cannaerts
    [email protected]

    The best way to escape a problem, is to solve it.
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured