I asked a variant of this question at
"A single hotkey doing wakeup and global duty"
and accepted the answer - that it was basically a matter of using a mutex to enforce a single instance and passing through an indication of which shortcut key was used via SendMessage.
However, I started thinking <g> and it seems to me that enforcing a single instance via a mutex is inefficient. My concern is that a second copy of the exe (MyMegaApp) is actually loaded into memory BEFORE it gets killed (after detecting the mutex).
How about this. The shortcut keys actually call a small "loader" app. It is that app which then "spawns" MyMegaApp but ONLY if needed (ie no mutex). Some sort of WinExecAndWait or is CreateProcess what I need?. We still use a SendMessage to send the arguments.. hmm, would it be better to use a more general interprocess communications approach (so I can send more stuff).
Anyone care to look at the previous answer and improve on it, given these ideas?