How do I create a status bar ? The following code doesn't work. The status bar is displayed when the windows is created. But when I call GetClientRect, the size is not correct. When I resize the window, the status bar disappears.

.DATA
ctls INITCOMMONCONTROLSEX <8, ICC_BAR_CLASSES>

.CODE
  INVOKE  CreateWindowEx, WS_EX_CLIENTEDGE, ADDR className, ADDR appName,\
	WS_OVERLAPPED+WS_CAPTION+WS_SYSMENU+WS_SIZEBOX+WS_MINIMIZEBOX+WS_MAXIMIZEBOX+WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT,INTERFACE_WIDTH,INTERFACE_HEIGHT, NULL, NULL, g_hInst, NULL
  mov  g_hWnd, eax

  INVOKE  InitCommonControlsEx, ADDR ctls
  INVOKE  CreateStatusWindow, WS_CHILD + WS_VISIBLE, NULL, g_hWnd, IDC_STATUS  
  mov     eax, g_statWnd
  INVOKE  ShowWindow, eax, SW_SHOWNORMAL
  INVOKE  UpdateWindow, g_statWnd
  ; create status bar
Any help appreciated. Thanks. This message was edited by karim, on 6/12/2001 4:26:56 PM
Posted on 2001-06-12 16:24:00 by karim
Did you send the WM_SIZE message to the statusbar on resizing?

in your wndproc handler:
.. on WM_SIZE ...
invoke SendMessage, g_statWnd, WM_SIZE, wParam, lParam
Thomas
Posted on 2001-06-12 16:35:00 by Thomas
Thanks Thomas, it works when I call SendMessage and UpdateWindow like this :

.IF ( uMsg == WM_SIZE )
INVOKE	SendMessage, g_statWnd, WM_SIZE, wParam, lParam
INVOKE	UpdateWindow, g_statWnd
But when the window is masked by another window, the status bar disappear.
Posted on 2001-06-12 16:49:00 by karim
You mean that other controls overlap the status bar? It depends on the Z-order of the controls which control is on top of another. Try creating the statusbar as first or last control, so that it will have the highest Z-order, or call MoveWindow or SetWindowPos (don't know exactly, I don't have any docs right now), one of them can set the Z-order. Thomas
Posted on 2001-06-12 17:01:00 by Thomas
I have only one status bar. After the status bar has been recovered by another window, it's not repainted correctly. But when I resize the window or minimize then maximize the window, everything is displayed correctly. I will look at it tomorrow. Thanks for you help!
Posted on 2001-06-12 17:20:00 by karim
Hi karim, I had question along same line I think about one week ago. see my post 'scrolling status bar', I got some execellant suggestions and help and all works fine now. Hope this is helpful. Also it you want I be happy to send you my list view source with status bar on it. best regards, czDrillard
Posted on 2001-06-13 00:11:00 by czDrillard
It works when I use the following code to process the WM_PAINT message :

   INVOKE BeginPaint, hwnd, ADDR ps
   INVOKE SendMessage, g_statWnd, WM_PAINT, wParam, lParam
   INVOKE EndPaint, hwnd, ADDR ps
I've tried it in C under Windows NT and it works. I will try it in asm under Windows98 tonight. Thanks for your help. This message was edited by karim, on 6/13/2001 5:57:23 AM
Posted on 2001-06-13 03:13:00 by karim
Ernie helped me with a similar problem recently. The thread is "Getting status bar to appear" in the beginner's section. I got it going, and it doesn't seem to mind Z-order. You can see the source in generic3.zip at www.hammick.com/hcs/win32.html.
Posted on 2001-06-13 05:55:00 by Larry Hammick