• Advertisement
Sign in to follow this  

Using RegisterWindowEx

This topic is 3361 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

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.
	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

Share this post

Link to post
Share on other sites
You haven't set the hIconSm member of the WNDCLASSEX structure for one (there might be others, I didn't check). Try this:

/// rest is the same

That'll initialize everything to zero to begin with.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement