<?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; WinMain</title>
	<atom:link href="http://vdiscussion.com/tag/winmain/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>WM_PAINT Message Visual Programming</title>
		<link>http://vdiscussion.com/wm_paint-message-visual-programming/</link>
		<comments>http://vdiscussion.com/wm_paint-message-visual-programming/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 13:01:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Theory Subjects]]></category>
		<category><![CDATA[Visual Programming]]></category>
		<category><![CDATA[CS_HREDRAW]]></category>
		<category><![CDATA[CW_VREDRAW]]></category>
		<category><![CDATA[ScrollDC function]]></category>
		<category><![CDATA[ScrollWindow function]]></category>
		<category><![CDATA[UpdateWindow]]></category>
		<category><![CDATA[WinMain]]></category>
		<category><![CDATA[WM PAINT]]></category>
		<category><![CDATA[WM_PAINT]]></category>
		<category><![CDATA[WM_PAINT Function]]></category>

		<guid isPermaLink="false">http://vdiscussion.com/?p=34</guid>
		<description><![CDATA[Windows programs call the function UpdateWindow during initialization in WinMain shortly before entering the message loop. Windows takes this opportunity to send the window procedure its first WM_PAINT message. This message informs the window procedure that the client area must be painted. Thereafter, that window procedure should be ready at almost any time to process [...]]]></description>
			<content:encoded><![CDATA[<p>Windows programs call the function <strong><em>UpdateWindow</em></strong> during  initialization in <strong><em>WinMain</em></strong> shortly before entering the message loop.  Windows takes this opportunity to send the window procedure its first <strong>WM_PAINT</strong> message. This message informs the window procedure that the client area must be  painted. Thereafter, that window procedure should be ready at almost any time to  process additional <strong>WM_PAINT</strong> messages and even to repaint the entire client area  of the window if necessary. A window procedure receives a WM_PAINT message  whenever one of the following events occurs:</p>
<ul>
<li>A previously hidden area of the window is brought into view when a user  moves a window or uncovers a window.</li>
<li>The user resizes the window (if the window class style has the <strong>CS_HREDRAW</strong> and <strong>CW_VREDRAW</strong> bits set).</li>
<li>The program uses the <em>ScrollWindow</em> or <em>ScrollDC</em> function to  scroll part of its client area.</li>
<li>The program uses the <em>InvalidateRect</em> or <em>InvalidateRgn</em> function  to explicitly generate a <em>WM_PAINT</em> message.</li>
</ul>
<p>In some cases when part of the client area is temporarily written over,  Windows attempts to save an area of the display and restore it later. This is  not always successful. Windows may sometimes post a <strong>WM_PAINT</strong> message when:</p>
<ul>
<li>Windows removes a dialog box or message box that was overlaying part of the  window.</li>
<li>A menu is pulled down and then released.</li>
<li>A tool tip is displayed.</li>
</ul>
<p>In a few cases, Windows always saves the area of the display it overwrites  and then restores it. This is the case whenever:</p>
<ul>
<li>The mouse cursor is moved across the client area.</li>
<li>An icon is dragged across the client area.</li>
</ul>
<p>Dealing with <strong>WM_PAINT</strong> message requires that you alter the way you think about  how you write to the video display. Your program should be structured so that it  accumulates all the information necessary to paint the client area but paints  only &#8220;on demand&#8221;—when Windows sends the window procedure a <strong>WM_PAINT</strong> message. If  your program needs to update its client area at some other time, it can force  Windows to generate this <strong>WM_PAINT</strong> message. This may seem a roundabout method of  displaying something on the screen, but the structure of your program will  benefit from it.</p>
]]></content:encoded>
			<wfw:commentRss>http://vdiscussion.com/wm_paint-message-visual-programming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Create the Window in Visual Programming C++</title>
		<link>http://vdiscussion.com/how-to-create-the-window-in-visual-programming-c/</link>
		<comments>http://vdiscussion.com/how-to-create-the-window-in-visual-programming-c/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 14:51:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Theory Subjects]]></category>
		<category><![CDATA[Visual Programming]]></category>
		<category><![CDATA[CreateWindow()]]></category>
		<category><![CDATA[CW_USEDEFAULT]]></category>
		<category><![CDATA[program instance handle]]></category>
		<category><![CDATA[RegisterClass]]></category>
		<category><![CDATA[szAppName]]></category>
		<category><![CDATA[window menu handle]]></category>
		<category><![CDATA[WinMain]]></category>
		<category><![CDATA[WS_OVERLAPPEDWINDOW]]></category>

		<guid isPermaLink="false">http://vdiscussion.com/?p=32</guid>
		<description><![CDATA[The window class defines general characteristics of a window. By using that window class we can create many different windows. We can create a window by calling CreateWindow. Programmers new to Windows are sometimes confused about the distinction between the window class and the window and why all the characteristics of a window can&#8217;t be [...]]]></description>
			<content:encoded><![CDATA[<p>The window class defines general characteristics of a window. By using that window class we can create many different windows. We can create a window by calling <strong><em>CreateWindow.</em></strong></p>
<p>Programmers new to Windows are sometimes confused about the distinction  between the window class and the window and why all the characteristics of a  window can&#8217;t be specified in one shot. Actually, dividing the information in  this way is quite convenient. <em>For example</em>, all push-button windows are created  based on the same window class. The window procedure associated with this window  class is located inside Windows itself, and it is responsible for processing  keyboard and mouse input to the push button and defining the button&#8217;s visual  appearance on the screen. All push buttons work the same way in this respect.  But not all push buttons are the same. They almost certainly have different  sizes, different locations on the screen, and different text strings. These  latter characteristics are part of the window definition rather than the window  class definition.</p>
<p>While the information passed to the <em>RegisterClass</em> function is specified  in a data structure, the information passed to the <em>CreateWindow</em> function  is specified as separate arguments to the function. Here&#8217;s the  <em>CreateWindow</em> call</p>
<blockquote><p><strong>hwnd = CreateWindow (szAppName,                  // window class name<br />
TEXT (&#8220;The Hello Program&#8221;), // window caption<br />
WS_OVERLAPPEDWINDOW,        // window style<br />
CW_USEDEFAULT,              // initial x position<br />
CW_USEDEFAULT,              // initial y position<br />
CW_USEDEFAULT,              // initial x size<br />
CW_USEDEFAULT,              // initial y size<br />
NULL,                       // parent window handle<br />
NULL,                       // window menu handle<br />
hInstance,                  // program instance handle<br />
NULL) ;                     // creation parameters</strong></p></blockquote>
<p><strong>szAppName</strong> &#8212; &gt; &#8220;window class name&#8221;. The name of the window class the program just registered</p>
<p>The window created by this program is a normal overlapped window. It will have a title bar; a system menu button to the left of the title bar; a thick window-sizing border; and minimize, maximize, and close buttons to the right of the title bar. That&#8217;s a standard style for windows, and it has the name <strong>WS_OVERLAPPEDWINDOW</strong>, which appears as the &#8220;window style&#8221; parameter in CreateWindow. If you look in <em>WINUSER.H</em>, you&#8217;ll find that this style is a combination of several bit flags:</p>
<p><strong>#define WS_OVERLAPPEDWINDOW (WS_OVERLAPPED     | \<br />
WS_CAPTION        | \<br />
WS_SYSMENU        | \<br />
WS_THICKFRAME     | \<br />
WS_MINIMIZEBOX    | \<br />
WS_MAXIMIZEBOX)</strong><br />
The &#8220;<em>window caption</em>&#8221; is the text that will appear in the title bar of the window.</p>
<p>The arguments marked &#8220;<strong>initial x position</strong>&#8221; and &#8220;<strong>initial y position</strong>&#8221; specify the initial position of the upper left corner of the window relative to the upper left corner of the screen. By using the identifier <strong>CW_USEDEFAULT</strong> for these parameters, we are indicating that we want Windows to use the default position for an overlapped window. (<strong>CW_USEDEFAULT</strong> is defined as <strong>0&#215;80000000</strong>.) By default, Windows positions successive newly created windows at stepped horizontal and vertical offsets from the upper left corner of the display. Similarly, the &#8220;<strong>initial x size</strong>&#8221; and &#8220;<strong>initial y size</strong>&#8221; arguments specify the initial width and height of the window. The <strong>CW_USEDEFAULT</strong> identifier again indicates that we want Windows to use a default size for the window.</p>
<p>The argument marked &#8220;<strong>parent window handle</strong>&#8221; is set to NULL when creating a  &#8220;top-level&#8221; window, such as an application window. Normally, when a parent-child  relationship exists between two windows, the child window always appears on the  surface of its parent. An application window appears on the surface of the  desktop window, but you don&#8217;t need to find out the desktop window&#8217;s handle to  call <strong><em>CreateWindow</em></strong>.</p>
<p>The &#8220;<strong>window menu handle</strong>&#8221; is also set to NULL because the window has no menu.  The &#8220;<strong>program instance handle</strong>&#8221; is set to the instance handle passed to the  program as a parameter of <em>WinMain</em>. Finally, a &#8220;creation parameters&#8221;  pointer is set to NULL. You could use this parameter to point to some data that  you might later want to reference in your program.</p>
<p>The <em>CreateWindow</em> call returns a handle to the created window. This  handle is saved in the variable <em>hwnd</em>, which is defined to be of type HWND  (&#8220;handle to a window&#8221;). Every window in Windows has a handle. Your program uses  the handle to refer to the window. Many Windows functions require <em>hwnd</em> as  an argument so that Windows knows which window the function applies to. If a  program creates many windows, each has a different handle. The handle to a  window is one of the most important handles that a Windows program (pardon the  expression) handles.</p>
]]></content:encoded>
			<wfw:commentRss>http://vdiscussion.com/how-to-create-the-window-in-visual-programming-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Basic Visual Program C++ and Explaination</title>
		<link>http://vdiscussion.com/basic-visual-program-c-and-explaination/</link>
		<comments>http://vdiscussion.com/basic-visual-program-c-and-explaination/#comments</comments>
		<pubDate>Sat, 31 Oct 2009 02:15:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Theory Subjects]]></category>
		<category><![CDATA[Visual Programming]]></category>
		<category><![CDATA[hPrevInstance]]></category>
		<category><![CDATA[iCmdShow]]></category>
		<category><![CDATA[Preprocessor directives]]></category>
		<category><![CDATA[PSTR szCmdLine]]></category>
		<category><![CDATA[Visual C++ Developer Studio]]></category>
		<category><![CDATA[WINAPI]]></category>
		<category><![CDATA[WINBASE.H]]></category>
		<category><![CDATA[WINDEF.H]]></category>
		<category><![CDATA[Windows program]]></category>
		<category><![CDATA[WINGDI.H]]></category>
		<category><![CDATA[WinMain]]></category>
		<category><![CDATA[WINNT.H]]></category>
		<category><![CDATA[WINUSER.H]]></category>

		<guid isPermaLink="false">http://vdiscussion.com/?p=25</guid>
		<description><![CDATA[#include &#60;windows.h&#62; # Preprocessor directives are lines included in the code of our programs that are not program statements but directives for the preprocessor. These lines are always preceded by a hash sign (#). The preprocessor is executed before the actual compilation of code begins, therefore the preprocessor digests all these directives before any code [...]]]></description>
			<content:encoded><![CDATA[<p>#include &lt;windows.h&gt;</p>
<p><strong># Preprocessor directives</strong> are lines included in the code of our programs that are not program statements but directives for the preprocessor. These lines are always preceded by a hash sign (<tt>#</tt>). The preprocessor is executed before the actual compilation of code begins, therefore the preprocessor digests all these directives before any code is generated by the statements.</p>
<p>These preprocessor directives extend only across a single line of code. As soon as a newline character is found, the preprocessor directive is considered to end. No semicolon (;) is expected at the end of a preprocessor directive. The only way a preprocessor directive can extend through more than one line is by preceding the newline character at the end of the line by a backslash (<tt>\</tt>).</p>
<p><strong>WINDOWS.H</strong> is a master include file that includes other Windows header files, some of which also include other header files. The most important and most basic of these header files are:</p>
<ul>
<li><em>WINDEF.H </em> Basic type definitions.</li>
<li><em>WINNT.H </em> Type definitions for Unicode support.</li>
<li><em>WINBASE.H </em> Kernel functions.</li>
<li><em>WINUSER.H </em> User      interface functions.</li>
<li><em>WINGDI.H </em> Graphics      device interface functions.</li>
</ul>
<p>These header files define all the Windows data types, function calls, data structures, and constant identifiers. They are an important part of Windows documentation. You might find it convenient to use the Find In Files option from the Edit menu in the Visual C++ Developer Studio to search through these header files. You can also open the header files in the Developer Studio and examine them directly.</p>
<p>The entry point to a Windows program is <strong><em>WinMain</em></strong></p>
<p><em>Looks Like this</em><strong><em></em></strong></p>
<blockquote><p>int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,                     PSTR szCmdLine, int iCmdShow)</p></blockquote>
<p><strong>WINAPI</strong> must be included because windows expects a WinMain that is of the _stdcall calling convention, not the default _cdecl.</p>
<p>The first parameter <strong>HINSTANCE hInstance</strong> is a instance handle.  Handle is simply a number that an application uses to identify something. In  this case, the handle uniquely identifies the program. It is required as an  argument to some other Windows function calls. In early versions of Windows,  when you ran the same program concurrently more than once, you created  <em>multiple instances</em> of that program. All instances of the same application  shared code and read-only memory (usually resources such as menu and dialog box  templates). A program could determine if other instances of itself were running by checking  the <em><strong><em>hPrevInstance</em></strong></em> Second parameter. It could then skip certain chores and move  some data from the previous instance into its own data area.</p>
<p>In the 32-bit versions of Windows, this concept has been abandoned. The second  parameter to <em>WinMain</em> is always NULL (defined as 0).</p>
<p>The third parameter to <strong>PSTR szCmdLine</strong> is the command line used to run the  program. Some Windows applications use this to load a file into memory when the  program is started.</p>
<p>The fourth parameter to <strong>int iCmdShow</strong> indicates how the program should be  initially displayed—either normally or maximized to fill the window, or  minimized to be displayed in the task list bar.</p>
]]></content:encoded>
			<wfw:commentRss>http://vdiscussion.com/basic-visual-program-c-and-explaination/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
