If a user already has my frontend opened on their pc, I want a message
to appear when they open it a second time. How can I check for this?
A Mutex Question! These are always fun!
"Mutex" stands for "Mutually Exclusive". In the WIN32 API SDK, a Mutex is a
system-level resource that can only be held by one process. To accomplish
what you want, you can have your startup code create a mutex with a specific
hard-coded name, and hold the Mutex's handle in a public global variable.
Then your shutdown code passes that handle back to windows to release it.
Then, when a user starts a second instance of your application, the new call
to CreateMutex() fails, and you can MsgBox the user and quit. The only
catch is that if you're in the VBA debugger and "reset" your code, you lose
the mutex handle and will be unable to release it. Lookup these two
functions in MSDN:
CreateMutex()
ReleaseMutex()