#define idc_main_status 101 // Define Status Bar Control Id
#include
INITCOMMONCONTROLS (); // Load ComctL32.dll in _twinmain ()
WM_CREATE: / / Create a status bar in the WM_CREATE message.
Int Parts [5]
= {100, 200, 300, 400, -1}; // The status bar is divided into five grid. The abscissa on the right side of the first grid is 100, and the second grid is 200.
HWndStatusbar = CreateStatusWindow (WS_CHILD | WS_VISIBLE | WS_BORDER,
TEXT ("
First Part Text ... "),
HWnd,
IDC_MAIN_STATUS
); // Create a status bar control
// Another equivalent function
/ *
HWndStatusbar = CreateWindowex (0,
StatusclassName,
Text ("First Part Text ..."),
WS_CHILD | WS_VISIBLE,
0, 0, 0, 0,
HWnd,
(HMENU) IDC_MAIN_STATUS,
Hinst,
NULL); * /
SendMessage (hwndstatusbar, sb_setminHeight,
19
,
0
) / / Set the control height of 19 points.
SendMessage (hwndstatusbar, sb_setparts, 5, (lparam) Parts; // is divided into five grids
WM_SIZE: / / Responds to the WM_SIZE message.
HWndStatusbar = getdlgitem (hwnd, idc_main_status);
SendMessage (HWndStatusbar, WM_SIZE, 0, 0);
The program is running as follows: