Results 1 to 9 of 9

Thread: how i connect my progs?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2000
    Posts
    16

    Question

    if i have a program that hide her window...
    now the user run another copy of her.
    i don't want the other copy to run(thats i know how to do)
    but i want that the hide window will know that the user try
    to run another copy of her and respond...

    somebody have and idea how i do it???


    Tal Zur!

  2. #2
    Addicted Member
    Join Date
    May 2000
    Location
    Grand Rapids, MI
    Posts
    231
    If I correctly understand your post, you want only a single instance of the program to run at a time, no other copies running on the computer, check this vb-world tips section, I am positive there is something there about only one instance of your program.
    -Karl Blessing aka kb244{fastHACK}
    [email protected]

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jun 2000
    Posts
    16

    Red face

    no ...
    i mean that i want that the hide program to know when the user try to run another copy (how to prevent the other copy to run , this i know!).

    but thanks anyway...
    Tal Zur!

  4. #4
    Addicted Member
    Join Date
    May 2000
    Location
    Grand Rapids, MI
    Posts
    231
    I see, with the normal only run one thing, the copy thats new knows it's a second copy then closes, but the original copy will not know another has been opened. hmm, maybe a timmer checking the the classname, or a DDE session to tell the original copy before closing the new.
    -Karl Blessing aka kb244{fastHACK}
    [email protected]

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    If "the other app" is yours, you may put a code that does it instead by itself:
    Code:
    if app.previnstance then unload me
    Also it's preferable to put this in a sub main so you wont even need to load any forms
    Code:
    if app.previsntance then exit sub
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  6. #6
    Addicted Member
    Join Date
    May 2000
    Location
    Grand Rapids, MI
    Posts
    231
    but he wants his currently opened program to detect the attempt to run a second copy.
    -Karl Blessing aka kb244{fastHACK}
    [email protected]

  7. #7
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Sorry i missunderstood, well you can check for the running window classname, using findwindow api, also if you don't have a window in that app you could enumerate the the processes
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Jun 2000
    Posts
    16
    i have a question...

    i think i can do it like this:
    when the prog start she write a file with her DC, when you run antoer copy it checks the app.previnstance and if it's True then he get the DC (from the file) of the run copy and just show it (if it hide...) or send it any other message and kill it self.

    i try it...
    Tal Zur!

  9. #9
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    I would suggest using the window handle (HWND) rather than the device context, as VB has a habit of reorganising those.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

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