home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.ms-windows.programmer.misc
- Path: sparky!uunet!think.com!rpi!newsserver.pixel.kodak.com!ekcolor!dj
- From: dj@ekcolor.ssd.kodak.com (Dave Jones)
- Subject: Re: Sending message for multiple program instances
- Message-ID: <1992Dec29.213656.29352@pixel.kodak.com>
- Sender: news@pixel.kodak.com
- Organization: Vonnegut Tent Rentals, Inc.
- X-Newsreader: TIN [version 1.1 PL7]
- References: <9212291505.PN05751@LL.MIT.EDU>
- Distribution: comp
- Date: Tue, 29 Dec 92 21:36:56 GMT
- Lines: 27
-
- Sarir Khamsi (khamsi@ll.mit.edu) wrote:
- > Yo,
- >
- > Does somebody have a code segment that will display a message window
- > (with OK button) stating that the program is currently running? I am
- > using the condition :
- >
- > if( hPrevInstance)
- > return FALSE;
- >
- > in my WinMain() to check currently, but it tells the user nothing.
- > Thanks in advance.
- >
- You ought to be able to use: MessageBox(NULL, "Program is already running!",
- "Oops!", MB_OK);
- You don't need an application window to use MessageBox. This in fact is the
- answer to those smartalecs who gloat that you can't write a 1-line "Hello
- World" program in Windows. You can, and I have.
-
- If you want something a little less rough and ready, you can query
- hPrevInstance for its main window, then send that a message of your own
- devising (WM_USER or somesuch). You will add code to the Window procedure
- so that the original instance notifies the user.
-
- --
- ||------------------------------------------------------------------------
- ||Dave Jones (dj@ekcolor.ssd.kodak.com)|Eastman Kodak Co. Rochester, NY |
-