<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Reflections of my thoughts... &#187; C++</title>
	<atom:link href="http://codereflect.com/category/c-code-3/feed/" rel="self" type="application/rss+xml" />
	<link>http://codereflect.com</link>
	<description>on programming tips and trending topics...</description>
	<lastBuildDate>Wed, 08 Feb 2012 08:58:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How to restrict Window Movement?</title>
		<link>http://codereflect.com/2010/09/16/how-to-restrict-window-movement/</link>
		<comments>http://codereflect.com/2010/09/16/how-to-restrict-window-movement/#comments</comments>
		<pubDate>Thu, 16 Sep 2010 14:44:36 +0000</pubDate>
		<dc:creator>@sarat</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Visual C++]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[Windows 7]]></category>
		<category><![CDATA[MFC]]></category>
		<category><![CDATA[Win32]]></category>
		<category><![CDATA[Windows Vista]]></category>
		<category><![CDATA[Windows XP]]></category>

		<guid isPermaLink="false">http://codereflect.com/2010/09/16/how-to-restrict-window-movement/</guid>
		<description><![CDATA[This is beginner level post. How we can make a Window immovable? Roughly we’ve two methods to do this. Method #1. Handle the NCHITTEST message and ignore while user click on the caption area (Titlebar). This method doesn’t work well in Windows 7/Vista if Aero is enabled. This method works with any type of Window [...]]]></description>
			<content:encoded><![CDATA[<p>This is beginner level post. How we can make a Window immovable?</p>
<p>Roughly we’ve two methods to do this.</p>
<p><strong>Method #1</strong>. Handle the NCHITTEST message and ignore while user click on the caption area (Titlebar). This method doesn’t work well in Windows 7/Vista if Aero is enabled. This method works with any type of Window having titlebar. The disadvantage of this method is , the user will still able to move using keyboard, if system menu is available.</p>
<p>&#160;</p>
<pre>
LRESULT CMoveWindowSampleDlg::OnNcHitTest(CPoint point)
{
    UINT nHitTest = CDialogEx::OnNcHitTest(point);

    if( HTCAPTION == nHitTest )
        nHitTest = HTNOWHERE;

    return nHitTest;
}</pre>
<p><strong>Method #2</strong> – Remove the Move command from System Menu (Works with windows having system menu stle (WS_SYSMENU) ). The the Move command in the system menu will be removed in this case. Windows will internally disable the movement of this kind of Windows. </p>
<pre>
BOOL CMoveWindowSampleDlg::OnInitDialog()
{
    CDialogEx::OnInitDialog();

    CMenu* pSysMenu = GetSystemMenu(FALSE);

    if (pSysMenu != NULL)
    {
        pSysMenu-&gt;RemoveMenu( SC_MOVE, MF_BYCOMMAND );
       }
...

       return TRUE;
}
</pre>
<p>PS: Using method 2, this is the same method we use to disable the close button of a Window. For disabling a menu/titlebar button. Call EnableMenu function with relevant parameters.</p>
]]></content:encoded>
			<wfw:commentRss>http://codereflect.com/2010/09/16/how-to-restrict-window-movement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to remove the Document name from the SDI/MDI Window titlebar?</title>
		<link>http://codereflect.com/2010/03/05/how-to-remove-the-document-name-from-the-sdimdi-window-titlebar/</link>
		<comments>http://codereflect.com/2010/03/05/how-to-remove-the-document-name-from-the-sdimdi-window-titlebar/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 04:27:44 +0000</pubDate>
		<dc:creator>@sarat</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[MFC]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Visual C++]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[MDI]]></category>
		<category><![CDATA[SDI]]></category>

		<guid isPermaLink="false">http://codereflect.com/2010/03/05/how-to-remove-the-document-name-from-the-sdimdi-window-titlebar/</guid>
		<description><![CDATA[When you create a simple SDI Application, you can see that the Title of the Window is displayed as “Document Name – Application name” like you’re seeing below. How we can remove this? It’s simple, just remove the FWS_ADDTOTITLE style from the frame window. You’ve to speicify this before the window being created. You can [...]]]></description>
			<content:encoded><![CDATA[<p>When you create a simple SDI Application, you can see that the Title of the Window is displayed as “Document Name – Application name” like you’re seeing below.</p>
<p><img style="display: inline; border: 0px;" title="image" src="http://codereflect.com/wp-content/uploads/2010/03/image.png" border="0" alt="image" width="293" height="192" /></p>
<p>How we can remove this? It’s simple, just remove the FWS_ADDTOTITLE style from the frame window. You’ve to speicify this before the window being created. You can write the code in PreCreateWindow function.</p>
<p>See the snippet below</p>
<pre>
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT&amp; cs)
 {
 	cs.style &amp;= ~ FWS_ADDTOTITLE;	// Remove the style
 	if( !CFrameWndEx::PreCreateWindow(cs) )
 		return FALSE;
 	return TRUE;
}
</pre>
<p>After that you can see the Window title like this!</p>
<p><img style="display: inline; border: 0px;" title="image" src="http://codereflect.com/wp-content/uploads/2010/03/image1.png" border="0" alt="image" width="233" height="159" /></p>
]]></content:encoded>
			<wfw:commentRss>http://codereflect.com/2010/03/05/how-to-remove-the-document-name-from-the-sdimdi-window-titlebar/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

