Jump to content
  • Advertisement
Sign in to follow this  
fluke

issue with changing window styles on vista

This topic is 3890 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've spent the last three days researching this issue and have come up with nothing. what's happening is this. if i switch an mdi child window's style to remove the caption and thickframe styles when going into a pseudo fullscreen mode, and then switch it reinstating the previous style, when the child windows is moved or sized, the non-client area fails to repaint. one interesting thing however, is if a second child is given focus and then the first problematic child is click/moved/ect, it repaints fine. i watched all the messages firing in spy++ and then manually generated these messages using SendMessage, but to no avail. there is of course a chance i didn't invoke all of them correctly... :/ note: you can easily re-produce this by pasting the following code into a barebones mdi app and calling setfs in an mdi childs lbuttondown/rbuttondown event with the fullscreen flag set appropriately.
//this code works fine on xp, but has non-client redraw issues on vista :/
void setfs(HWND parent,HWND child,int fullscreen){
	if(fullscreen){
		SetWindowLong(parent,GWL_style,WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
		RECT rc;
		SystemParametersInfo(SPI_GETWORKAREA,0,&rc,0); 
		SetWindowPos(parent,HWND_TOP,rc.left,rc.top,rc.right,rc.bottom,SWP_SHOWWINDOW);	

		SetWindowLong(child,GWL_style,GetWindowLong(child,GWL_style) & ~WS_CAPTION & ~WS_THICKFRAME); //remove one of these and the redraw issue will go away, but obviously at the cost of an incorrectly implemented fullscreen feature
		SetWindowPos(child,HWND_TOP,rc.left,rc.top,rc.right,rc.bottom-GetSystemMetrics(SM_CYMENU),SWP_SHOWWINDOW);
	}else{
		SetWindowLong(parent,GWL_style,WS_CAPTION | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_MAXIMIZE | WS_SYSMENU | WS_THICKFRAME | WS_OVERLAPPED | WS_MINIMIZEBOX | WS_MAXIMIZEBOX);		
		SetWindowPos(parent,NULL,50,50,600,500,SWP_SHOWWINDOW);		
		ShowWindow(main_window_handle,SW_SHOWNORMAL);		

		SetWindowLong(child,GWL_style,GetWindowLong(child,GWL_style) | WS_CAPTION | WS_THICKFRAME);		
		SetWindowPos(child,0,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);	
		SetWindowPos(child,HWND_TOP,50,50,200,300,SWP_SHOWWINDOW);	
	}
}
the one stipulation i have here, is that i can't use anything like ShowWindow(hwnd,SW_MAXIMIZE). i need to keep everything pretty much the way it is if possible. any help on this issue is MUCH appreciated. it's caused me some major headaches the last few days, so i'd even be happy with the link to another forum where i can post this question if nobody here knows the answer. :)

Share this post


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

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!