ACC: How to Determine If a Specific Windows Program Is Running (88167)
The information in this article applies to:
- Microsoft Access 2.0
- Microsoft Access for Windows 95 7.0
- Microsoft Access 97
This article was previously published under Q88167 Advanced: Requires expert coding, interoperability, and multiuser skills.
SUMMARY
There may be times when you want only one instance of an application to
run under Microsoft Windows. For example, if you add a command button to a
form that starts the Windows Calculator (Calc.exe) program, the user can
start many instances of Calculator. This is an inefficient use of memory
and system resources. Through the use of a Windows application programming
interface (API) function, Microsoft Access can determine if Calculator is
already running.
The API function used to determine if a specific program is running is
called FindWindow(). FindWindow() returns the handle of the window whose
class is given by the lpClassName parameter and whose window name (or
caption) is given by the lpCaption parameter. If the returned value is
zero, the application is not running.
This article assumes that you are familiar with Visual Basic for
Applications and with creating Microsoft Access applications using the
programming tools provided with Microsoft Access. For more information
about Visual Basic for Applications, please refer to your version of the
"Building Applications with Microsoft Access" manual.
NOTE: Visual Basic for Applications is called Access Basic in Microsoft
Access version 2.0. For more information about Access Basic, please refer
to the "Building Applications" manual.
REFERENCES
For more information about the Class Names for the Office 97 Applications,
please see the following article in the Microsoft Knowledge Base:
169240
Window Class Names for the Office 97 Applications
"Programming Windows: the Microsoft Guide to Writing Applications for
Windows 3," by Charles Petzold, Microsoft Press, 1990
"Microsoft Windows 3.1 Programmer's Reference," Volume 2
"Microsoft Win32 Software Development Kit"
Modification Type: | Minor | Last Reviewed: | 10/11/2006 |
---|
Keywords: | kbhowto kbProgramming KB88167 |
---|
|