<?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>Vdiscussion &#187; WM_HSCROLL</title>
	<atom:link href="http://vdiscussion.com/tag/wm_hscroll/feed/" rel="self" type="application/rss+xml" />
	<link>http://vdiscussion.com</link>
	<description>Vinoth Kumar&#039;s Discussion</description>
	<lastBuildDate>Wed, 09 Dec 2009 15:34:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Scroll Bar Messages:Visual Programming</title>
		<link>http://vdiscussion.com/scroll-bar-messages-visual-programming/</link>
		<comments>http://vdiscussion.com/scroll-bar-messages-visual-programming/#comments</comments>
		<pubDate>Sun, 25 Oct 2009 02:42:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Theory Subjects]]></category>
		<category><![CDATA[Visual Programming]]></category>
		<category><![CDATA[SB_THUMBPOSITION]]></category>
		<category><![CDATA[SB_THUMBTRACK]]></category>
		<category><![CDATA[Scroll Bar Messages]]></category>
		<category><![CDATA[WINUSER.H]]></category>
		<category><![CDATA[WM_HSCROLL]]></category>
		<category><![CDATA[WM_VSCROLL]]></category>
		<category><![CDATA[wParam]]></category>

		<guid isPermaLink="false">http://vdiscussion.com/?p=19</guid>
		<description><![CDATA[Windows sends the window procedure WM_VSCROLL (vertical scroll) and WM_HSCROLL (horizontal scroll) messages when the scroll bar is clicked with the mouse or the thumb is dragged. Each mouse action on the scroll bar generates at least two messages, one when the mouse button is pressed and another when it is released. WM_VSCROLL and WM_HSCROLL [...]]]></description>
			<content:encoded><![CDATA[<p>Windows sends the window procedure WM_VSCROLL (vertical scroll) and WM_HSCROLL  (horizontal scroll) messages when the scroll bar is clicked with the mouse or  the thumb is dragged. Each mouse action on the scroll bar generates at least two  messages, one when the mouse button is pressed and another when it is released.</p>
<p>WM_VSCROLL and WM_HSCROLL are accompanied by the <em>wParam</em> and <em>lParam</em> message parameters. For messages from scroll bars created as part of your  window, you can ignore <em>lParam</em>; that&#8217;s used only for scroll bars created  as child windows, usually within dialog boxes.</p>
<p>The <em>wParam</em> message parameter is divided into a <strong>low word and a high  word</strong>. The low word of <em>wParam</em> is a number that indicates what the mouse is  doing to the scroll bar. This number is referred to as a &#8220;notification code.&#8221;  Notification codes have values defined by identifiers that begin with SB, which  stands for &#8220;scroll bar.&#8221; Here&#8217;s how the notification codes are defined in  WINUSER.H:</p>
<blockquote><p>#define SB_LINEUP           0<br />
#define SB_LINELEFT         0<br />
#define SB_LINEDOWN         1<br />
#define SB_LINERIGHT        1<br />
#define SB_PAGEUP           2<br />
#define SB_PAGELEFT         2<br />
#define SB_PAGEDOWN         3<br />
#define SB_PAGERIGHT        3<br />
#define SB_THUMBPOSITION    4<br />
#define SB_THUMBTRACK       5<br />
#define SB_TOP              6<br />
#define SB_LEFT             6<br />
#define SB_BOTTOM           7<br />
#define SB_RIGHT            7<br />
#define SB_ENDSCROLL        8</p></blockquote>
<p><img class="alignnone size-full wp-image-20" title="Scroll Bar Messages" src="http://vdiscussion.com/wp-content/uploads/2009/10/Scroll-Bar-Messages.jpg" alt="Scroll Bar Messages" width="600" height="450" /></p>
<p>If you hold down the mouse button on the various parts of the scroll bar, your  program can receive multiple scroll bar messages. When the mouse button is  released, you&#8217;ll get a message with a notification code of SB_ENDSCROLL. You can  generally ignore messages with the SB_ENDSCROLL notification code. Windows will  not change the position of the scroll bar thumb. Your application does that by  calling <em>SetScrollPos</em>.</p>
<p>When you position the mouse cursor over the scroll bar thumb and press the mouse  button, you can move the thumb. This generates scroll bar messages with  notification codes of SB_THUMBTRACK and SB_THUMBPOSITION. When the low word of  <em>wParam</em> is SB_THUMBTRACK, the high word of <em>wParam</em> is the current  position of the scroll bar thumb as the user is dragging it. This position is  within the minimum and maximum values of the scroll bar range. When the low word  of <em>wParam</em> is SB_THUMBPOSITION, the high word of <em>wParam</em> is the  final position of the scroll bar thumb when the user released the mouse button.  For other scroll bar actions, the high word of <em>wParam</em> should be ignored.</p>
<p>To provide feedback to the user, Windows will move the scroll bar thumb when  you drag it with the mouse as your program is receiving SB_THUMBTRACK messages.  However, unless you process SB_THUMBTRACK or SB_THUMBPOSITION messages by  calling <em>SetScrollPos</em>, the thumb will snap back to its original position  when the user releases the mouse button.</p>
<p>A program can process either the SB_THUMBTRACK or SB_THUMBPOSITION messages, but  doesn&#8217;t usually process both. If you process SB_THUMBTRACK messages, you&#8217;ll move  the contents of your client area as the user is dragging the thumb. If instead  you process SB_THUMBPOSITION messages, you&#8217;ll move the contents of the client  area only when the user <em>stops</em> dragging the thumb.</p>
<p>The WINUSER.H header files includes notification codes of SB_TOP, SB_BOTTOM,  SB_LEFT, and SB_RIGHT, indicating that the scroll bar has been moved to its  minimum or maximum position. However, you will never receive these notification  codes for a scroll bar created as part of your application window.</p>
<p>Although it&#8217;s not common, using 32-bit values for the scroll bar range is  perfectly valid. However, the high word of <em>wParam</em>, which is only a 16-bit  value, cannot properly indicate the position for SB_THUMBTRACK and  SB_THUMBPOSITION actions. In this case, you need to use the function  <em>GetScrollInfo</em></p>
]]></content:encoded>
			<wfw:commentRss>http://vdiscussion.com/scroll-bar-messages-visual-programming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
