Jump to content
  • Advertisement
Sign in to follow this  
adam23

Using RegisterWindowEx

This topic is 3629 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.
	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

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!