home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / os / mswindo / programm / misc / 4190 < prev    next >
Encoding:
Text File  |  1992-12-13  |  1.5 KB  |  50 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!gatech!ncar!csn!boulder!ucsu!rintintin.Colorado.EDU!tylerd
  3. From: tylerd@rintintin.Colorado.EDU (TYLER DAVID CHARLES)
  4. Subject: Novice programmer question
  5. Message-ID: <1992Dec13.204238.8073@ucsu.Colorado.EDU>
  6. Sender: news@ucsu.Colorado.EDU (USENET News System)
  7. Nntp-Posting-Host: rintintin.colorado.edu
  8. Organization: University of Colorado, Boulder
  9. Distribution: usa
  10. Date: Sun, 13 Dec 1992 20:42:38 GMT
  11. Lines: 37
  12.  
  13. I'll make this brief:
  14. Why doesn't the following work?
  15.  
  16.   if (!hPrevInstance)
  17.   {
  18.     [normal stuff]
  19.   }
  20.   else
  21.   //
  22.   // If an instance is already running, just display it.
  23.   //
  24.   {
  25.     if (IsIconic (hPrevInstance))
  26.     {
  27.       OpenIcon (hPrevInstance);
  28.     }
  29.     BringWindowToTop (hPrevInstance);
  30.     return TRUE;                      // Or should this be FALSE?
  31.   }
  32.  
  33. All I'm trying to do is keep only one instance running at a time.
  34. If the user tries to open a new instance, bring the already-
  35. running program to the top, as a window (Like File Manager does).
  36. Using the above code, nothing happens.  No new instance, but
  37. also no effect on the previous iconized (or windowed) instance.
  38.  
  39. These functions ARE in windows.h, aren't they?
  40. I am using Turbo C++ for Windows, if that makes a difference.
  41.  
  42. Thanks in advance for any help.  I realize there must be a simple
  43. explanation, but I sure don't know what it is!
  44.  
  45. Please e-mail replies, since I don't normally read this newsgroup.
  46.  
  47. Dave
  48.  
  49. tylerd@rintintin.Colorado.edu
  50.