WNDCLASSEX wc;
wc.cbSize = sizeof( WNDCLASSEX );
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = TestCallback;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = m_hInstance;
wc.hIcon = ::LoadIcon(0, IDI_APPLICATION);
wc.hCursor = ::LoadCursor(0, IDC_ARROW);
wc.hbrBackground = (HBRUSH)::GetStockObject(LTGRAY_BRUSH);
wc.lpszMenuName = 0;
wc.lpszClassName = "TestToolWindow";
if( RegisterClassEx( &wc ) == 0 )
{
DWORD error = GetLastError( );
Logging::Instance( )->Printf( "Failed to register window, ERROR: %d", error );
}
For some reason RegisterClassEx fails with error code 87 ( The classic Invalid Paramter ).
Now if I use all the same settings and switch it over to the non ex versions it works fine and I can open all the windows I want. According to the docs they should be identical minus a few extra options.
At the time this fails I do already have a main window open and updating. This window uses a DirectX device for rendering.
Any ideas?
Thanks Adam
Using RegisterWindowEx
I'm building a tool that needs quite a few free floating child windows. I'm not an expert at Win32 but from the little bits of documentation i've found I need to use WS_EX_TOOLWINDOW window type.
So i'm doing this.
You haven't set the hIconSm member of the WNDCLASSEX structure for one (there might be others, I didn't check). Try this:
WNDCLASSEX wc = {};
/// rest is the same
That'll initialize everything to zero to begin with.
WNDCLASSEX wc = {};
/// rest is the same
That'll initialize everything to zero to begin with.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement