• Advertisement

Archived

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

no window caption?

This topic is 5303 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement

  • Advertisement