Click to See Complete Forum and Search --> : Writing to active window titlebar


recursion
May 22nd, 2006, 04:10 PM
I am having difficulty finding references for how to start with this one:

I use a KVM for a single monitor supporting multiple servers. I would like to add a TSR to always show the network name in the titlebar of the active window.

Text to display should be set on install and be edited by the administrator as required.

Only the administrator should be able to terminate the app. Users should be able to shut down or restart the machine and the TSR will restart on boot.

Suggestions on where to start looking? Any bored persons out there willing to whip this one up?

recursion

JamesSchumacher
May 22nd, 2006, 06:06 PM
Once you get the window handle of active window....

Use:

HDC hWindowDC = ::GetWindowDC(hwndOfTargetWindow);
// do custom drawing
::ReleaseDC(hWindowDC);


GetWindowDC can cause headaches though when you draw in it and notice that the window becomes invalidated and then redraws itself again. You'll have to validate the window after drawing in the window because of this.

(Note: If you use GetWindowDC in WM_PAINT in your own window and don't validate the window - >.> 99% processor used up. Another solution is to call it AFTER BeginPaint() to get client DC)

philkr
May 23rd, 2006, 09:17 AM
You can change the titlebar text using SetWindowText() function.