Discussion:
Create status bar
(too old to reply)
Larry
2010-02-10 18:35:19 UTC
Permalink
Hi,

I am tring to create a regular status bar via C++ code, the following is
an excerpt:

[code]
#define STRICT
#include <windows.h>
#include <windowsx.h>
#pragma comment (lib, "comctl32.lib")
#include <commctrl.h>

(...)
#define IDC_STATUSBAR 600

HINSTANCE hInst; // Gloabl
(...)

// HANDLE_MSG (hWnd, WM_CREATE, Cls_OnCreate);
//
BOOL Cls_OnCreate(HWND hwnd, LPCREATESTRUCT lpCreateStruct)
{
InitCommonControls();
HWND hWndStatus = CreateWindowEx(0,TEXT("STATUSCLASSNAME"),NULL,
SBARS_SIZEGRIP | WS_CHILD | WS_VISIBLE,0, 0, 0, 0,
hwnd,(HMENU)IDC_STATUSBAR,hInst,NULL);

if (hWndStatus == NULL)
{
MessageBox (NULL, TEXT("Status Bar not created!"), NULL, MB_OK );
return false;
}
return true;
}
[/code]

I run the code and get the MessageBox() :-(

What am I doing wrong?

thanks
Igor Tandetnik
2010-02-10 18:53:35 UTC
Permalink
Post by Larry
I am tring to create a regular status bar via C++ code, the
HWND hWndStatus = CreateWindowEx(0,TEXT("STATUSCLASSNAME"),NULL,
SBARS_SIZEGRIP | WS_CHILD | WS_VISIBLE,0, 0, 0, 0,
hwnd,(HMENU)IDC_STATUSBAR,hInst,NULL);
Just use STATUSCLASSNAME, not TEXT("STATUSCLASSNAME"). STATUSCLASSNAME is a macro that expands to an appropriate string.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is hard to be sure where they are going to land, and it could be dangerous sitting under them as they fly overhead. -- RFC 1925
Continue reading on narkive:
Loading...