Multiple Application Instances

Occasionally, developers have written applications with the expectation that multiple instances of the program would be executed simultaneously or that one instance of the application might call other instances. When this occurred under Windows 3.x, you could use the hPrevInstance argument to determine if there was a previous instance of the application already executing.

Beginning with Windows NT, when each instance of an application was given a separate memory space for execution, the hPrevInstance argument became obsolete. Since each instance was operating in a separate, independent memory space, the hPrevInstance argument was always NULL. regardless of how many copies of the application were executing.

NOTE

For one alternative approach, see the DDEML demo, which is on the CD accompanying this book and discussed in Chapter 35. In this demo, the first instance of the application launches four additional instances, but equally important, these later instances do not launch additional copies.

© 1998 SYBEX Inc. All rights reserved.