How do i change the font or color of my caption in a window ? I really can't figure it out. plz help me !!! just send a mail:
Posted on 2001-02-16 01:30:00 by Typhoon
How to Draw a Custom Window Caption
Last reviewed: November 2, 1995
Article ID: Q99046  
The information in this article applies to: 
Microsoft Windows Software Development Kit (SDK) versions 3.1 
Microsoft Win32 Application Programming Interface (API) included with: 

    - Microsoft Windows NT versions 3.5 and 3.51
    - Microsoft Windows 95 version 4.0

Microsoft Windows draws captions in the caption bar (or title bar) for all eligible windows in the system. Applications need to specify only the WS_CAPTION style to take advantage of this facility. The current version of Microsoft Windows, however, imposes three significant restrictions on the captions. An application that does not want to be tied by any of these restrictions may want to draw its own caption. This article lists the restrictions and the steps required to draw a window caption. 

These restrictions also apply to Windows NT, but there are a few differences for Windows 95. 

It is important to note that an application should not draw its own caption unless it has very good reasons to do so. A window caption is a user interface object, and rendering it in ways different from other windows in the system may obstruct the user's conceptual grasp of the Microsoft Windows user interface. 


Windows and Windows NT
The three important restrictions imposed by Microsoft Windows version 3.1 and Microsoft Windows NT on the caption for a window are: 

- It consists of text only; graphics are not allowed. - All text is centered and drawn with the system font. - The length of the displayed caption is limited to 78 characters 

  even when there is space on the caption bar to accommodate extra

An application can essentially render its own caption consisting of any graphic and text with the standard graphics and text primitives by painting on the nonclient area of the window. The application should draw in response to the WM_NCPAINT, WM_NCACTIVATE, WM_SETTEXT, and WM_SYSCOMMAND messages. When processing these messages, an application should first pass on the message to DefWindowProc() for default processing, then render its caption before returning from the message. This ensures that Microsoft Windows can properly draw the nonclient area. Because drawing the caption is part of DefWindowProc()'s nonclient area processing, an application should specify an empty window title to avoid any Windows-initiated drawing in the caption bar. The following steps indicate the computations needed to determine the caption drawing area: 

Get the current window's rectangle using GetWindowRect(). This includes client plus nonclient areas and is in screen coordinates. 

Get a device context (DC) to the window using GetWindowDC(). 

Compute the origin and dimensions of the caption bar. One needs to account for the window decorations (frame, border) and window bitmaps (min/max/system boxes). Remember that different window styles will result in different decorations and a different number of min/max/system boxes. Use GetSystemMetrics() to compute the dimensions of the frame, border, and the system bitmap dimensions. 

Render the caption within the boundaries of the rectangle computed in step 3. Remember that the user can change the caption bar color any time by using the Control Panel. Some components of the caption, particularly text backgrounds, may need to be changed based on the current caption bar color. Use GetSysColor to determine the current color. 

The following code sample draws a left-justified caption for a window (the code sample applies only to the case where the window is active): 

Sample Code

      if ((BOOL)wParam == FALSE)
         DefWindowProc( hWnd, message, wParam, lParam );
      // Add code here to draw caption when window is inactive.

         return TRUE;
      // Fall through if wParam == TRUE, i.e., window is active.

      case WM_NCPAINT:
      // Let Windows do what it usually does. Let the window captio
Posted on 2001-02-16 11:08:00 by Hiroshimator
thx I'll try that hey, sorry for doubleposting :) regards Typhoon
Posted on 2001-02-16 18:02:00 by Typhoon