Remove close button from floating toolbar

The article 'Remove system menu from floating toolbar' by Sushil Saxena shows one way of removing the close button from a toolbar. However, it is not the neatest of solutions to the problem.

This is my solution: It does rely on a little dodge to get a runtime class for an internal MFC class, but apart from that...

First, add some code somewhere, proabably in the cpp file, to get at that class.



// bodge class so we can get at the runtime class for this docked window
// helper class (not defined in any MFC header file)
class CMiniDockFrameWnd
{
public:
	DECLARE_DYNAMIC(CMiniDockFrameWnd)
};

Secondly, in the OnSize handler (called every time bar is floated or docked, but not so often as a click) add



	// remove the close button on the parent
	CWnd *pParent = GetParent();
	if(pParent) pParent = pParent->GetParent();
	if(pParent != NULL && pParent->GetRuntimeClass() == RUNTIME_CLASS(CMiniDockFrameWnd)
		&& pParent->GetStyle() & WS_SYSMENU)
	{
		pParent->ModifyStyle(WS_SYSMENU, 0, 0);
	}

And your toolbar no longer has a close button.



Comments

  • Goal

    Posted by snareenactina on 11/06/2012 07:28pm

    The relevant parameter for assessing the U.S. labor market impacts of globalization is the volume of trade conducted with lower-wage trading partners (know in the jargon as less-developed countries, or LDCs for short). This paper uses the average of imports and exports from non-OECD countries (as OECD countries are generally rich, and trade with them will not necessarily follow the predicted patterns regarding the labor-intensity of imports and exports that drives the inequality-inducing effects of trade), non-OPEC countries (as oil is not generally thought to compete with U.S. production), and Turkey and Mexico (the two poorest OECD nations) for this parameter. imagemac Link to this comment: statesmen ihsaa krayenbuhl mcclellandii loco

    Reply
  • New one

    Posted by snareenactina on 11/02/2012 04:33pm

    Ruh roh Astro. These numbers oughtta be real sparkly a year from now. And don't think that a whole bunch of Democrat CongressCritters haven't noticed this little tidbit. Because they surely have. fatwire Why? Because you use less gas when the engine is turning slowly. The slower the engine turns, the fewer the number of explosions in the cylinders. And fewer explosions means less gas consumed. quest routine chan marmots gameshttp

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • On-demand Event Event Date: September 17, 2014 Another day, another end-of-support deadline. You've heard enough about the hazards of not migrating to Windows Server 2008 or 2012. What you may not know is that there's plenty in it for you and your business, like increased automation and performance, time-saving technical features, and a lower total cost of ownership. Check out this webcast and join Rich Holmes, Pomeroy's practice director of virtualization, as he discusses the future state of your servers, …

  • You may already know about some of the benefits of Bluemix, IBM's open platform for developing and deploying mobile and web applications. Check out this webcast that focuses on building an Android application using the MobileData service, with a walk-through of the real process and workflow used to build and link the MobileData service within your application. Join IBM's subject matter experts as they show you the way to build a base application that will jumpstart you into building your own more complex app …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds