Archived

This topic is now archived and is closed to further replies.

psykr

no window caption?

Recommended Posts

psykr    295
When I first create this window, there is no window caption, but if I call SetWindowText() right after CreateWindow(), it works.
WNDCLASSEX wc;
memset( &wc, 0x0, sizeof( WNDCLASSEX ) );
wc.cbSize       = sizeof( WNDCLASSEX );
wc.cbWndExtra   = 4;
wc.hCursor      = LoadCursor( NULL, IDC_ARROW );
wc.hInstance    = GetModuleHandle( NULL );
wc.lpfnWndProc  = CWindows::WndProc;
wc.lpszClassName= "CWindows";
wc.style        = CS_OWNDC;
// register class and create window

RegisterClassEx( &wc );
m_hWnd = CreateWindowEx( WS_EX_ACCEPTFILES, "CWindows", "main window", WS_VISIBLE|WS_SYSMENU,
    0, 0, 640, 480, NULL, NULL, GetModuleHandle( NULL ), this );
if( !m_hWnd ) return E_FAIL;
SetWindowText( m_hWnd, "main window" );
oh, and those four extra bytes are for the long-winded SetWindowLongPtr() trick to make the WndProc a member function.

Share this post


Link to post
Share on other sites