views:

179

answers:

7

I'm writing a DLL that is automatically injected on load in a specific application. Because I'd like to run the program while working on it, and my users might want to load the program without it in specific cases (e.g. bug hunting), I sometimes want to prevent loading the DLL. Currently I do this by checking GetKeyState for VK_LCONTROL, VK_LSHIFT , and VK_LMENU on load, and if all are down, I silently unload myself. However, it can take quite a few seconds for the program to load and to see if the DLL was loaded or not, so I want to inform the users when we're unloading. I've considered a MessageBox, but that's too disruptive. I've tried MessageBeep, but that didn't seem to do anything on my setup. Currently I'm using a simple dual beep (Beep, Sleep, Beep) to indicate unloading, but that will probably become rather annoying to my co workers. I've also considered a system-tray icon, but that would introduce a lot of code and bug potential, while I'm aiming for a minimal notification as to not introduce any subtle bugs.

Would anyone else know a subtle way (preferably visual) to inform the user that their input has been succesfully received?

+2  A: 

If your app has a status bar at the bottom, you could place some message text there...

ISW
A: 

You could open a window with a short message and close it automatically again after 0.5 seconds or so. It doesn't need user interaction so I don't think it's very disruptive.

sth
+1  A: 

Have you considered a timed messagebox that closes itself?

http://www.codeguru.com/cpp/misc/misc/messageboxhandling/article.php/c203

John T
A: 

Change the window title, then change it back afterwards. Then you can see the change even if the user has Alt-Tabbed over to some other program in the meanwhile, without stealing the focus from the user.

Kev
+4  A: 

Given the limited scope of your goal, this might actually be an appropriate use of a taskbar notification balloon tip.

Edit: Added link the Joe posted in his concurring answer. Thanks, Joe! :)

Greg D
A: 

Two ideas:

  1. Turn it around. Have a visual indication when the DLL is loaded, and have the absence of the indicator let you know that the DLL has been unloaded. Perhaps a suffix in the title bar. That way, you can tell at any time, not just during startup.

  2. FlashWindowEx.

Adrian McCarthy