Larry Lindstrom
2010-01-28 10:41:45 UTC
Hi Folks:
Developing on VS 2008 Pro, XP Pro, Win32, no MFC.
I'm having a WTF moment.
Several of my application's are using status bars with no
particular problems.
I'm having a problem converting one of these apps from CGI and CGI+
to OpenGL and I need to build a little sample code. Perhaps I'll post
to the OpenGL group if I can't find a solution on my own.
To accurately duplicate my application's situation, I want to have
a status bar on the bottom of the window.
This simplified code will work to add a status bar in my original
application:
void setup_main_window_test(HWND hdlg, HINSTANCE hinstance)
{
HDC hdc = 0;
RECT rectangle;
DWORD error_code = 0;
SetLastError(0);
HWND status_bar_handle =
CreateWindowEx(
0L, // no extended styles
STATUSCLASSNAME, // status bar
TEXT(""), // no text
WS_CHILD | WS_BORDER | WS_VISIBLE, //
styles
CW_USEDEFAULT, CW_USEDEFAULT, // x, y
CW_USEDEFAULT, CW_USEDEFAULT, //cx, cy
hdlg, // parent window
(HMENU)100, // status window ID
hinstance,
NULL); // window data
if(status_bar_handle == NULL)
{
error_code = GetLastError();
LPVOID lpMsgBuf;
// string message;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
error_code,
0, // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL);
LocalFree( lpMsgBuf );
}
}
But this function fails when run in my sample code. CreateWindowEx
() returns a status_bar_handle of NULL, and the error code is 1407,
"Cannot find window class".
I have comctl32.lib defined, and include commctrl.h. Hinstance is
0x00400000, hdlg has the correct value.
What am I missing?
Thanks
Larry
Developing on VS 2008 Pro, XP Pro, Win32, no MFC.
I'm having a WTF moment.
Several of my application's are using status bars with no
particular problems.
I'm having a problem converting one of these apps from CGI and CGI+
to OpenGL and I need to build a little sample code. Perhaps I'll post
to the OpenGL group if I can't find a solution on my own.
To accurately duplicate my application's situation, I want to have
a status bar on the bottom of the window.
This simplified code will work to add a status bar in my original
application:
void setup_main_window_test(HWND hdlg, HINSTANCE hinstance)
{
HDC hdc = 0;
RECT rectangle;
DWORD error_code = 0;
SetLastError(0);
HWND status_bar_handle =
CreateWindowEx(
0L, // no extended styles
STATUSCLASSNAME, // status bar
TEXT(""), // no text
WS_CHILD | WS_BORDER | WS_VISIBLE, //
styles
CW_USEDEFAULT, CW_USEDEFAULT, // x, y
CW_USEDEFAULT, CW_USEDEFAULT, //cx, cy
hdlg, // parent window
(HMENU)100, // status window ID
hinstance,
NULL); // window data
if(status_bar_handle == NULL)
{
error_code = GetLastError();
LPVOID lpMsgBuf;
// string message;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
error_code,
0, // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL);
LocalFree( lpMsgBuf );
}
}
But this function fails when run in my sample code. CreateWindowEx
() returns a status_bar_handle of NULL, and the error code is 1407,
"Cannot find window class".
I have comctl32.lib defined, and include commctrl.h. Hinstance is
0x00400000, hdlg has the correct value.
What am I missing?
Thanks
Larry