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

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!pipex!warwick!nott-cs!vulcan.xtel.co.uk!mak
  3. From: mak@vulcan.xtel.co.uk (Martijn Koster)
  4. Subject: Bringing Application Windows to the top
  5. Message-ID: <1992Dec17.122321.20939@cs.nott.ac.uk>
  6. Sender: news@cs.nott.ac.uk
  7. Organization: X-Tel Services Ltd.
  8. Date: Thu, 17 Dec 92 12:23:21 GMT
  9. Lines: 20
  10.  
  11.  
  12. Hi,
  13. I`ve got fairly simple question:
  14.  
  15.     Given a HWND, how can I bring an Application window to the top?
  16.  
  17. I want only one instance of my application to run, and like in the
  18. File Manager I'd like the current instance of my program to come
  19. to the front when the user selects my program-item from the 
  20. Program Manager.
  21. To do this I check for a previous instance on startup, and if there
  22. is one I use EnumWindows to step through the windows looking for
  23. the one belonging to the previous instance. This works fine, I
  24. can set the title of that window. But now I want to bring that 
  25. application to the top. I tried SetWindowPos(hwnd, HWND_TOPMOST,
  26. 0, 0, 0, 0, WPS_NOSIZE | WPS_NOMOVE), but nothing happens.
  27.  
  28. Any suggestions greatly appreciated.
  29.  
  30. -- Martijn
  31.