<?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>Programming Interview Questions And Answers</title>
	<atom:link href="http://programminginterviewquestions.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://programminginterviewquestions.com</link>
	<description>Real time questions and answers collected from various interviews.</description>
	<lastBuildDate>Sun, 15 Nov 2009 04:57:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Printing Through .NET</title>
		<link>http://programminginterviewquestions.com/2009/11/14/printing-through-net-2/</link>
		<comments>http://programminginterviewquestions.com/2009/11/14/printing-through-net-2/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 04:57:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C Programming]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[VC++]]></category>

		<guid isPermaLink="false">http://programminginterviewquestions.com/?p=7192</guid>
		<description><![CDATA[Any sophisticated application would definitely have support for printing. .NET facilitates printing with the help of a        PrintDocument component. Along with this we can make use of the various dialog boxes that are commonly used for printing.
      The  PrintDocument Component
   [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fprogramminginterviewquestions.com%2F2009%2F11%2F14%2Fprinting-through-net-2%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fprogramminginterviewquestions.com%2F2009%2F11%2F14%2Fprinting-through-net-2%2F" height="61" width="51" /></a></div><p>Any sophisticated application would definitely have support for printing. .NET facilitates printing with the help of a       <b> PrintDocument</b> component. Along with this we can make use of the various dialog boxes that are commonly used for printing.</p>
<p>      <b>The <i> PrintDocument</i> Component</b></p>
<p>      .NET supports printing through methods and properties of the <b> PrintDocument</b> component. The       <b> PrintDocument</b> component is available in the Toolbox and when added to a form, it appears in the component tray at the bottom of the Windows Forms Designer. This is because the <b>PrintDocument</b> component is not visible at runtime.<br />      <b><br />      </b>The <b> PrintDocument</b> class represents the <b> PrintDocument</b> component and falls under the       <b> System.Drawing.Printing</b> namespace. Typically in a printing application we call the       <b> Print( )</b> method of the <b> PrintDocument</b> class. It also contains properties such as       <b> DefaultPageSettings</b>, which gets or sets page settings that are used as defaults for all pages to be printed,       <b> PrinterSettings</b>, which gets or sets the printer that prints the document. The class contains events like       <b> BeginPrint</b>, <b> EndPrint</b> and <b> PageEvent</b>. BeginPrint is raised when the       <b> Print( )</b> method is called and before the first page of the document is printed. Here we can do any initializations if needed.       <b> EndPrint</b> event is raised when the last page of the document has been printed. We can do cleaning up jobs here. The       <b> PrintPage</b> event is raised when it’s time to print the current page. We can write code in the handler of this event to do the desired printing. Hence the order of events raised when <b> Print( )</b> method is called is <b> BeginPrint</b>, <b> PrintPage</b> and then       <b> EndPrint</b>. In the following sections, we have programmed simple examples that illustrate how to use the       <b> PrintDocument</b> component to achieve printing.</p>
<p>      <b>Printing A Salary Slip</b></p>
<p>Let us see an example where we wish to print salary slip of an employee. Here we have created a Windows Form Application named <b> Salaryslip</b>. We have added 5 textboxes to the form to gather information about the employee—a ‘Name’ textbox named name, a ‘Month’ textbox named month, a ‘Gross Salary’ textbox named <b> sal</b>, a ‘Tax’ textbox named <b> tax</b> and a ‘Total’ textbox named       <b>total</b>. We have added these textboxes to collect information about an employee like his name, his salary, the tax he needs to pay, etc. Next we have calculated his salary according to the tax. We have also added two buttons to the form—a ‘Print’ button named <b> print</b> and a ‘Calculate’ button named <b>cal</b>. As soon as the user clicks on the       <b> Calculate</b> button the salary gets calculated and if he clicks on the Print button the salary slip gets printed. Next we have added the       <b> PrintDocument</b> component to our form. It gets added in the component tray. We have changed the name of the component from       <b> PrintDocument1</b> to <b> mypdoc</b>.</p>
<p>      We have added an event handler called <b> cal_Click( )</b> to handle the <b> Click</b> event of the       <b> Calculate</b> button. This handler is shown below:</p>
<p class="myprog" align="justify">private void cal_Click ( object sender, System.EventArgs e )<br />      {       </p>
<p class="myprog1in" align="justify">int t = int.Parse ( sal.Text ) &#8211; int.Parse ( tax.Text ) ;<br />	total.Text = t.ToString( ) ;       </p>
<p class="myprog" align="justify">}       </p>
<p class="mybody" align="justify">Here we have subtracted the tax from the gross salary and stored it in an integer variable called t. Then we have set the       <b> Text</b> property of the textbox named <b> total</b> to <b> t</b> (we converted       <b> t</b> from an integer to a string). On clicking the <b> Print</b> button the event handler called       <b> print_Click( )</b> would get called. This handler is shown below:</p>
<p class="myprog" align="justify">private void print_Click ( object sender, System.EventArgs e )<br />      {       </p>
<p class="myprog1in" align="justify">mypdoc.Print( ) ;       </p>
<p class="myprog" align="justify">}       </p>
<p class="mybody" align="justify">In this handler we have simply called the       <b> Print( )</b> method of the <b> PrintDocument</b> class. Whenever the <b> Print( )</b> method is called the events are raised. We have not added handlers for the       <b> BeginPrint</b> and <b> EndPrint</b> handlers. We have added a handler for the       <b> PrintPage</b> event. If we double click on <b> mypdoc</b> in the component tray of the Windows Form Designer, the       <b> mypdoc_PrintPage( )</b> event handler gets added automatically to the code. This handler is shown below:</p>
<p class="myprog" align="justify">private void mypdoc_PrintPage ( object sender, System.Drawing.Printing.PrintPageEventArgs e )<br />      {       </p>
<p class="myprog1in" align="justify">Graphics g = e.Graphics ;<br />	SolidBrush b = new SolidBrush ( Color.Black ) ;<br />	Pen p = new Pen ( Color.Black, 3 ) ;<br />	Font f = new Font ( &#8220;Arial&#8221;, 10 ) ;</p>
<p>	g.DrawString ( &#8220;Name&#8221;, f, b, 30, 50 ) ;<br />	g.DrawString ( empname.Text, f, b, 130, 50 ) ;</p>
<p>	g.DrawString ( &#8220;Month&#8221;, f, b, 30, 70 ) ;<br />	g.DrawString ( month.Text, f, b, 130, 70 ) ;</p>
<p>	g.DrawString ( &#8220;Gross Salary&#8221;, f, b, 30, 100 ) ;<br />	g.DrawString ( sal.Text, f, b, 130, 100 ) ;</p>
<p>	g.DrawString ( &#8220;Tax&#8221;, f, b, 30, 120 ) ;<br />	g.DrawString ( tax.Text, f, b, 130, 120 ) ;</p>
<p>	g.DrawString ( &#8220;Total&#8221;, f, b, 30, 140 ) ;<br />	g.DrawString ( total.Text, f, b, 130, 140 ) ;</p>
<p>	Font f1 = new Font ( &#8220;Arial&#8221;, 15, FontStyle.Bold ) ;<br />	g.DrawString ( &#8220;KNK Pvt Ltd&#8221;, f1, b, 50, 10 ) ;</p>
<p>	g.DrawRectangle ( p, 14, 4, 180, 175 ) ;<br />	p.Width = 2 ;<br />	g.DrawRectangle ( p, 22, 95, 165, 75 ) ;       </p>
<p class="myprog" align="justify">} </p>
<p class="mybody" align="justify"><b>PrintPageEventsArgs</b> provides data for the       <b> PrintPage</b> event. Using this class we have retrieved the <b> Graphics</b> object using which we will do the painting. Next we have created       <b>Pen</b>, <b> Brush</b> and <b> Font</b> objects. Then using these objects we have printed the strings.<br />      Run the program. Enter the salary and tax and click the <b> Calculate</b> button. The result would get displayed in the       <b> Total</b> text box. Figure 1 shows the form with salary details.<br />
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td width="100%">
<p align="center">
<p>      Figure 1</p>
</td>
</tr>
</tbody>
</table>
<p class="mybody" align="left">As soon as we click the <b> Print</b> button, the ‘Printing’ dialog indicating the number of page that is getting printed gets displayed. The salary slip that gets printed is shown in Figure 2.<br />
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td width="100%">
<p align="center">
<p> Figure 2</p>
</td>
</tr>
</tbody>
</table>
<p class="mybody" align="center">
<p align="justify">
<p>  <!--webbot bot="Include" U-Include="../footer.htm" TAG="BODY" startspan -->
<div align="center">   <center>   </center> </div>
<p> <!--webbot bot="Include" endspan i-checksum="27678" -->
<p align="justify"></p>
]]></content:encoded>
			<wfw:commentRss>http://programminginterviewquestions.com/2009/11/14/printing-through-net-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>General Tips To Overcome An Interview</title>
		<link>http://programminginterviewquestions.com/2009/11/14/general-tips-to-overcome-an-interview-2/</link>
		<comments>http://programminginterviewquestions.com/2009/11/14/general-tips-to-overcome-an-interview-2/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 04:57:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C Programming]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[VC++]]></category>

		<guid isPermaLink="false">http://programminginterviewquestions.com/?p=5895</guid>
		<description><![CDATA[
Campus So what if you are not a mountaineer. Or a keen hiker. You still cannot treat your interview like a careless morning trot along a jogger&#8217;s path. Your jaw-jaw at the interview table is nothing less than a cautious climb up a mountain trail&#8211;which begins around your early childhood and meanders through the years [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fprogramminginterviewquestions.com%2F2009%2F11%2F14%2Fgeneral-tips-to-overcome-an-interview-2%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fprogramminginterviewquestions.com%2F2009%2F11%2F14%2Fgeneral-tips-to-overcome-an-interview-2%2F" height="61" width="51" /></a></div><p><span style="font-size:100%;"><strong><span style=";font-family:&quot;;" ><br /></span></strong></span></p>
<p style="margin: 5pt 0.5in;"><span style=";font-family:&quot;;font-size:100%;color:black;"   >Campus So what if you are not a mountaineer. Or a keen hiker. You still cannot treat your interview like a careless morning trot along a jogger&#8217;s path. Your jaw-jaw at the interview table is nothing less than a cautious climb up a mountain trail&#8211;which begins around your early childhood and meanders through the years at the academia before reaching a new summit in your career.And as you retrace your steps down memory lane make sure that you post flags at important landmarks of your life and career, so that you can pop them before the interview panel scoops them out of you. You don&#8217;t want to be at the receiving end, do you?</span></p>
<p style="margin: 5pt 0.5in;"><span style=";font-family:&quot;;font-size:100%;color:black;"   >Face the panel, but don&#8217;t fall of the chair in a headlong rush-and-skid attempt to tell your story. Take one step at a time. If you place your foot on slippery ground, you could be ejecting out on a free fall.</span></p>
<p style="margin: 5pt 0.5in;"><span style=";font-family:&quot;;font-size:100%;color:black;"   >So prepare, fortify your thoughts, re-jig your memory, and script and design your story (without frills and falsity). Without the right preparation and storyboard, you could be a loser at the interview. Here are a few preparation tips that books on interviews sometimes overlook. </span></p>
<p><span style=";font-family:&quot;;font-size:100%;color:black;"   >Before the interview                                    </span><span style="font-size:100%;color:steelblue;"><a href="http://www.freshersworld.com/interview/#top"><span style="text-decoration: none;color:navy;" ><!--[if gte vml 1]><v:shape id="_x0000_i1026" type="#_x0000_t75" alt="" href="#top" style="'width:24pt;height:8.25pt'" button="t">  <v:imagedata src="file:///D:\USERPR~1\sshende\LOCALS~1\Temp\msohtmlclip1\01\clip_image001.gif" href="http://www.freshersworld.com/img/top.gif"> </v:shape><![endif]--><!--[if !vml]--><span style=""><img src="file:///D:/USERPR%7E1/sshende/LOCALS%7E1/Temp/msohtmlclip1/01/clip_image001.gif" shapes="_x0000_i1026" width="32" border="0" height="11" /></span><!--[endif]--></span></a></span></p>
<p><span style=";font-family:&quot;;font-size:100%;color:black;"   >1. </span><span style=";font-family:&quot;;font-size:100%;color:blue;"   >Chronological Outline of Career and Education Divide your life into &#8220;segments&#8221; defining your university, first job, second job. For each stage, jot down :</span></p>
<p style="margin: 5pt 0.5in;"><span style=";font-family:&quot;;font-size:100%;color:black;"   >The reason for opting certain course or profession; Your job responsibilities in your previous/current job; Reason of leaving your earlier/current job. You should be clear in your mind where you want to be in the short and long term and ask yourself the reason why you would be appropriate for the job you are being interviewed for and how it will give shape to your future course.</span></p>
<p><span style="font-size:100%;color:black;">2. </span><span style=";font-family:&quot;;font-size:100%;color:blue;"   >Strengths and Weaknesses</span></p>
<p style="margin: 5pt 0.5in;"><span style=";font-family:&quot;;font-size:100%;color:black;"   >You should keep a regular check on your strengths and weaknesses. Write down three (3) technical and three (3) non-technical personal strengths. Most importantly, show examples of your skills. This proves more effective than simply talking about them. So if you&#8217;re asked about a general skill, provide a specific example to help you fulfil the interviewer&#8217;s expectations. It isn&#8217;t enough to say you&#8217;ve got &#8220;excellent leadership skills&#8221;. Instead, try saying:</span></p>
<p style="margin: 5pt 0.5in;"><span style=";font-family:&quot;;font-size:100%;color:black;"   >&#8220;I think I have excellent leaderships skills which I have acquired through a combination of effective communication, delegation and personal interaction. This has helped my team achieve its goals.&#8221;</span></p>
<p style="margin: 5pt 0.5in;"><span style=";font-family:&quot;;font-size:100%;color:black;"   >As compared to strengths, the area of weaknesses is difficult to handle. Put across your weakness in such a way that it at leaset seems to be a positive virtue to the interviewer. Describe a weakness or area for development that you have worked on and have now overcome.</span></p>
<p><span style="font-size:100%;color:black;">3. </span><span style=";font-family:&quot;;font-size:100%;color:blue;"   >Questions you should be prepared for</span><span style=";font-size:100%;color:steelblue;"  >                                                                                       </span><span style="font-size:100%;color:steelblue;"><a href="http://www.freshersworld.com/interview/#top"><span style="text-decoration: none;color:navy;" ><!--[if gte vml 1]><v:shape id="_x0000_i1027" type="#_x0000_t75" alt="" href="#top" style="'width:24pt;height:8.25pt'" button="t">  <v:imagedata src="file:///D:\USERPR~1\sshende\LOCALS~1\Temp\msohtmlclip1\01\clip_image001.gif" href="http://www.freshersworld.com/img/top.gif"> </v:shape><![endif]--><!--[if !vml]--><span style=""><img src="file:///D:/USERPR%7E1/sshende/LOCALS%7E1/Temp/msohtmlclip1/01/clip_image001.gif" shapes="_x0000_i1027" width="32" border="0" height="11" /></span><!--[endif]--></span></a></span></p>
<p style="margin: 5pt 0.5in;"><span style=";font-family:&quot;;font-size:100%;color:black;"   >Tell us about yourself.<br />What do you know about our company?<br />Why do you want to join our company?<br />What are your strengths and weaknesses?<br />Where do you see yourself in the next five years?<br />How have you improved the nature of your job in the past years of your working? Why should we hire you?<br />What contributions to profits have you made in your present or former company? Why are you looking for a change?</span></p>
<p><span style=";font-family:&quot;;font-size:100%;color:black;"   ><br />Answers to some difficult questions :                                          </span><span style="font-size:100%;color:steelblue;"><a href="http://www.freshersworld.com/interview/#top"><span style="text-decoration: none;color:navy;" ><!--[if gte vml 1]><v:shape id="_x0000_i1028" type="#_x0000_t75" alt="" href="#top" style="'width:24pt;height:8.25pt'" button="t">  <v:imagedata src="file:///D:\USERPR~1\sshende\LOCALS~1\Temp\msohtmlclip1\01\clip_image001.gif" href="http://www.freshersworld.com/img/top.gif"> </v:shape><![endif]--><!--[if !vml]--><span style=""><img src="file:///D:/USERPR%7E1/sshende/LOCALS%7E1/Temp/msohtmlclip1/01/clip_image001.gif" shapes="_x0000_i1028" width="32" border="0" height="11" /></span><!--[endif]--></span></a></span></p>
<p style="margin: 5pt 0.5in;"><span style=";font-family:&quot;;font-size:100%;color:black;"   >Tell me about yourself ?<br />Start from your education and give a brief coverage of previous experiences. Emphasise more on your recent experience explaining your job profile.</span></p>
<p style="margin: 5pt 0.5in;"><span style=";font-family:&quot;;font-size:100%;color:black;"   >What do you think of your boss?<br />Put across a positive image, but don&#8217;t exaggerate.</span></p>
<p style="margin: 5pt 0.5in;"><span style=";font-family:&quot;;font-size:100%;color:black;"   >Why should we hire you? Or why are you interested in this job?<br />Sum up your work experiences with your abilities and emphasise your strongest qualities and achievements. Let your interviewer know that you will prove to be an asset to the company.</span></p>
<p style="margin: 5pt 0.5in;"><span style=";font-family:&quot;;font-size:100%;color:black;"   >How much money do you want?<br />Indicate your present salary and emphasise that the opportunity is the most important consideration.</span></p>
<p style="margin: 5pt 0.5in;"><span style=";font-family:&quot;;font-size:100%;color:black;"   > Do you prefer to work in a group?<br />Be honest and give examples how you&#8217;ve worked by yourself and also with others. Prove your flexibility.</span></p>
<p><span style=";font-family:&quot;;font-size:100%;color:black;"   >4. </span><span style=";font-family:&quot;;font-size:100%;color:blue;"   >Questions to As </span><span style=";font-family:&quot;;font-size:100%;color:steelblue;"   >                                                                                         </span></p>
<p style="margin: 5pt 0.5in;"><span style=";font-family:&quot;;font-size:100%;color:black;"   > At the end of the interview, most interviewers generally ask if you have any questions. Therefore, you should be prepared beforehand with 2-3 technical and 2-3 non-technical questions and commit them to your memory before the interview.</span></p>
<p style="margin: 5pt 0.5in;"><span style=";font-family:&quot;;font-size:100%;color:black;"   >Do not ask queries related to your salary, vacation, bonuses, or other benefits. This information should be discussed at the time of getting your joining letter. Here we are giving few sample questions that you can ask at the time of your interview.</span></p>
<p><span style=";font-family:&quot;;font-size:100%;color:black;"   >Sample Questions</span></p>
<p style="margin: 5pt 0.5in;"><span style=";font-family:&quot;;font-size:100%;color:black;"   >Could you tell me the growth plans and goals for the company?<br />What skills are important to be successful in this position?<br />Why did you join this company? (optional)<br />What&#8217;s the criteria your company uses for performance appraisal?<br />With whom will I be interacting most frequently and what are their responsibilities and the nature of our interaction?<br />What is the time frame for making a decision at this position?<br />What made the previous persons in this position successful/unsuccessful?</span></p>
<p><span style=";font-family:&quot;;font-size:100%;"  > 5. </span><span style=";font-family:&quot;;font-size:100%;color:blue;"   >Do your homework  </span><span style=";font-size:100%;color:steelblue;"  >                                                                                                                            </span><span style="font-size:100%;color:steelblue;"><a href="http://www.freshersworld.com/interview/#top"><span style="text-decoration: none;color:navy;" ><!--[if gte vml 1]><v:shape id="_x0000_i1029" type="#_x0000_t75" alt="" href="#top" style="'width:24pt;height:8.25pt'" button="t">  <v:imagedata src="file:///D:\USERPR~1\sshende\LOCALS~1\Temp\msohtmlclip1\01\clip_image001.gif" href="http://www.freshersworld.com/img/top.gif"> </v:shape><![endif]--><!--[if !vml]--><span style=""><img src="file:///D:/USERPR%7E1/sshende/LOCALS%7E1/Temp/msohtmlclip1/01/clip_image001.gif" shapes="_x0000_i1029" width="32" border="0" height="11" /></span><!--[endif]--></span></a></span></p>
<p style="margin: 5pt 0.5in;"><span style=";font-family:&quot;;font-size:100%;color:black;"   > </span><span style=";font-family:&quot;;font-size:100%;color:black;"   >Before going for an interview, find out as much information on the company (go to JobsAhead Company Q and A) as possible. The best sources are the public library, the Internet (you can check out the company&#8217;s site), and can even call the company and get the required information. The information gives you a one-up in the interview besides proving your content company or position.</span></p>
<p style="margin: 5pt 0.5in;"><span style=";font-family:&quot;;font-size:100%;color:black;"   > Clearing the interview isn&#8217;t necessarily a solitary attempt. Seek assistance from individuals who are in the profession and whose counsel you value most. Be confident in your approach and attitude; let the panel feel it through your demeanour, body language and dressing.</span></p>
<p style="margin: 5pt 0.5in;"><span style=";font-family:&quot;;font-size:100%;color:black;"   >Getting prepared for your interview is the best way to dig deep and know yourself. You will be surprised that it would breed a new familiarity become more familiar with your own qualifications that will be make you present yourself better. All the best and get ready to give a treat.</span></p>
<p class="MsoNormal"><span style="font-size:100%;"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:100%;"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:100%;"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:100%;"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:100%;"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:100%;"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:100%;"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:100%;"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:100%;"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:100%;"><o:p> </o:p></span></p>
<p><span style="font-size:100%;"><br /></span></p>
]]></content:encoded>
			<wfw:commentRss>http://programminginterviewquestions.com/2009/11/14/general-tips-to-overcome-an-interview-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What is downcasting?</title>
		<link>http://programminginterviewquestions.com/2009/11/14/what-is-downcasting-2/</link>
		<comments>http://programminginterviewquestions.com/2009/11/14/what-is-downcasting-2/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 04:57:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C Programming]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[VC++]]></category>

		<guid isPermaLink="false">http://programminginterviewquestions.com/?p=7242</guid>
		<description><![CDATA[Consider the following example:class B { &#8230; };class D : public B { &#8230; };void f(){B* pb = new D; // unclear but okB* pb2 = new B;D* pd = dynamic_cast(pb); // ok: pb actually points to a D&#8230;D* pd2 = dynamic_cast(pb2); //error: pb2 points to a B, not a D// pd2 == NULL&#8230;}This type [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fprogramminginterviewquestions.com%2F2009%2F11%2F14%2Fwhat-is-downcasting-2%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fprogramminginterviewquestions.com%2F2009%2F11%2F14%2Fwhat-is-downcasting-2%2F" height="61" width="51" /></a></div><p>Consider the following example:<br />class B { &#8230; };<br />class D : public B { &#8230; };<br />void f()<br />{<br />B* pb = new D; // unclear but ok<br />B* pb2 = new B;<br />D* pd = dynamic_cast(pb); // ok: pb actually points to a D<br />&#8230;<br />D* pd2 = dynamic_cast(pb2); //error: pb2 points to a B, not a D<br />// pd2 == NULL<br />&#8230;<br />}<br />This type of conversion is called a &#8220;downcast&#8221; because it moves a pointer down a class hierarchy, from a given class to a class derived from it.</p>
]]></content:encoded>
			<wfw:commentRss>http://programminginterviewquestions.com/2009/11/14/what-is-downcasting-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What is a class?</title>
		<link>http://programminginterviewquestions.com/2009/11/14/what-is-a-class-2/</link>
		<comments>http://programminginterviewquestions.com/2009/11/14/what-is-a-class-2/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 04:57:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C Programming]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[VC++]]></category>

		<guid isPermaLink="false">http://programminginterviewquestions.com/?p=7243</guid>
		<description><![CDATA[According to Rumbaugh &#38; Co, &#8220;an object class describes a group of objects with similar properties (attributes), common behavior (operations), common relationships to other objects, and common semantics.&#8221; In one word class is a type. This is a way to create a new types of objects in C++. You may then proceed to explanation on [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fprogramminginterviewquestions.com%2F2009%2F11%2F14%2Fwhat-is-a-class-2%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fprogramminginterviewquestions.com%2F2009%2F11%2F14%2Fwhat-is-a-class-2%2F" height="61" width="51" /></a></div><p>According to Rumbaugh &amp; Co, &#8220;an object class describes a group of objects with similar properties (attributes), common behavior (operations), common relationships to other objects, and common semantics.&#8221; In one word class is a type. This is a way to create a new types of objects in C++. You may then proceed to explanation on the class structure, level of access and so on.</p>
]]></content:encoded>
			<wfw:commentRss>http://programminginterviewquestions.com/2009/11/14/what-is-a-class-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C language Interview Questions And Answers</title>
		<link>http://programminginterviewquestions.com/2009/11/14/c-language-interview-questions-and-answers-2/</link>
		<comments>http://programminginterviewquestions.com/2009/11/14/c-language-interview-questions-and-answers-2/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 04:57:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C Programming]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[VC++]]></category>

		<guid isPermaLink="false">http://programminginterviewquestions.com/?p=6420</guid>
		<description><![CDATA[With respect to function parameter passing, what is the difference between call-by-value and call-
How can I write a function that takes a variable number of arguments? What are the limitations
Can we declare a function that can return a pointer to a function of the same type?
How to declare an array of N pointers to functions [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fprogramminginterviewquestions.com%2F2009%2F11%2F14%2Fc-language-interview-questions-and-answers-2%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fprogramminginterviewquestions.com%2F2009%2F11%2F14%2Fc-language-interview-questions-and-answers-2%2F" height="61" width="51" /></a></div><p><a href="http://www.forum.technicalcontents.com/index.php?as=t1emci1ribxdzhbok9w6hlosckee7szl&amp;tid=328">With respect to function parameter passing, what is the difference between call-by-value and call-</a><br />
<a href="http://www.forum.technicalcontents.com/index.php?as=t1emci1ribxdzhbok9w6hlosckee7szl&amp;tid=327">How can I write a function that takes a variable number of arguments? What are the limitations</a><br />
<a href="http://www.forum.technicalcontents.com/index.php?as=t1emci1ribxdzhbok9w6hlosckee7szl&amp;tid=326">Can we declare a function that can return a pointer to a function of the same type?</a><br />
<a href="http://www.forum.technicalcontents.com/index.php?as=t1emci1ribxdzhbok9w6hlosckee7szl&amp;tid=325">How to declare an array of N pointers to functions returning pointers to functions returning</a><br />
<a href="http://www.forum.technicalcontents.com/index.php?as=t1emci1ribxdzhbok9w6hlosckee7szl&amp;tid=324">What are inline functions?</a><br />
<a href="http://www.forum.technicalcontents.com/index.php?as=t1emci1ribxdzhbok9w6hlosckee7szl&amp;tid=323">What is the purpose of a function prototype?</a><br />
<a href="http://www.forum.technicalcontents.com/index.php?as=t1emci1ribxdzhbok9w6hlosckee7szl&amp;tid=322">Does C support function overloading?</a><br />
<a href="http://www.forum.technicalcontents.com/index.php?as=t1emci1ribxdzhbok9w6hlosckee7szl&amp;tid=320">Does extern in a function declaration mean anything?</a><br />
<a href="http://www.forum.technicalcontents.com/index.php?as=t1emci1ribxdzhbok9w6hlosckee7szl&amp;tid=319">How to declare a pointer to a function?</a><br />
<a href="http://www.forum.technicalcontents.com/index.php?as=t1emci1ribxdzhbok9w6hlosckee7szl&amp;tid=318">What are the common causes of pointer bugs?</a><br />
<a href="http://www.forum.technicalcontents.com/index.php?as=t1emci1ribxdzhbok9w6hlosckee7szl&amp;tid=317">What is an opaque pointer?</a><br />
<a href="http://www.forum.technicalcontents.com/index.php?as=t1emci1ribxdzhbok9w6hlosckee7szl&amp;tid=316">Why is sizeof() an operator and not a function?</a><br />
<a href="http://www.forum.technicalcontents.com/index.php?as=t1emci1ribxdzhbok9w6hlosckee7szl&amp;tid=315">What is the difference between malloc() and calloc()?</a><br />
<a href="http://www.forum.technicalcontents.com/index.php?as=t1emci1ribxdzhbok9w6hlosckee7szl&amp;tid=314">What are near, far and huge pointers?</a><br />
<a href="http://www.forum.technicalcontents.com/index.php?as=t1emci1ribxdzhbok9w6hlosckee7szl&amp;tid=313">What operations are valid on pointers? When does one get the Illegal use of pointer in function</a><br />
<a href="http://www.forum.technicalcontents.com/index.php?as=t1emci1ribxdzhbok9w6hlosckee7szl&amp;tid=312">Is *(*(p+i)+j) is equivalent to p[i][j]? Is num[i] == i[num] == *(num + i) == *(i + num)?</a><br />
<a href="http://www.forum.technicalcontents.com/index.php?as=t1emci1ribxdzhbok9w6hlosckee7szl&amp;tid=311">What do pointers contain?</a><br />
<a href="http://www.forum.technicalcontents.com/index.php?as=t1emci1ribxdzhbok9w6hlosckee7szl&amp;tid=310">What is a dangling pointer? What are reference counters with respect to pointers?</a><br />
<a href="http://www.forum.technicalcontents.com/index.php?as=t1emci1ribxdzhbok9w6hlosckee7szl&amp;tid=309">What are brk() and sbrk() used for? How are they different from malloc()?</a><br />
<a href="http://www.forum.technicalcontents.com/index.php?as=t1emci1ribxdzhbok9w6hlosckee7szl&amp;tid=308">What is a memory leak?</a><br />
<a href="http://www.forum.technicalcontents.com/index.php?as=t1emci1ribxdzhbok9w6hlosckee7szl&amp;tid=307">What is the difference between an array of pointers and a pointer to an array?</a><br />
<a href="http://www.forum.technicalcontents.com/index.php?as=t1emci1ribxdzhbok9w6hlosckee7szl&amp;tid=306">What do Segmentation fault, access violation, core dump and Bus error mean?</a><br />
<a href="http://www.forum.technicalcontents.com/index.php?as=t1emci1ribxdzhbok9w6hlosckee7szl&amp;tid=305">What is a void pointer? Why can&#8217;t we perform arithmetic on a void * pointer?</a><br />
<a href="http://www.forum.technicalcontents.com/index.php?as=t1emci1ribxdzhbok9w6hlosckee7szl&amp;tid=304">What&#8217;s the difference between const char *p, char * const p and const char * const p?</a><br />
<a href="http://www.forum.technicalcontents.com/index.php?as=t1emci1ribxdzhbok9w6hlosckee7szl&amp;tid=303">What does malloc() , calloc(), realloc(), free() do? What are the common problems with malloc()?</a><br />
<a href="http://www.forum.technicalcontents.com/index.php?as=t1emci1ribxdzhbok9w6hlosckee7szl&amp;tid=302">Is the cast to malloc() required at all?</a><br />
<a href="http://www.forum.technicalcontents.com/index.php?as=t1emci1ribxdzhbok9w6hlosckee7szl&amp;tid=301">Does an array always get converted to a pointer? What is the difference between arr and &amp;arr?</a><br />
<a href="http://www.forum.technicalcontents.com/index.php?as=t1emci1ribxdzhbok9w6hlosckee7szl&amp;tid=300">What is a null pointer assignment error?</a><br />
<a href="http://www.forum.technicalcontents.com/index.php?as=t1emci1ribxdzhbok9w6hlosckee7szl&amp;tid=299">What is a NULL pointer? How is it different from an unitialized pointer? How is a NULL pointer</a><br />
<a href="http://www.forum.technicalcontents.com/index.php?as=t1emci1ribxdzhbok9w6hlosckee7szl&amp;tid=298">What does *p++ do? Does it increment p or the value pointed by p?</a></p>
]]></content:encoded>
			<wfw:commentRss>http://programminginterviewquestions.com/2009/11/14/c-language-interview-questions-and-answers-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Can base class reference is initialized with derived class object ?</title>
		<link>http://programminginterviewquestions.com/2009/11/14/can-base-class-reference-is-initialized-with-derived-class-object-2/</link>
		<comments>http://programminginterviewquestions.com/2009/11/14/can-base-class-reference-is-initialized-with-derived-class-object-2/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 04:57:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C Programming]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[VC++]]></category>

		<guid isPermaLink="false">http://programminginterviewquestions.com/?p=8921</guid>
		<description><![CDATA[We can declare a reference  to base class and initialize it with derived class&#8217;s object as shown in the following program..
#include &#60;iostream.h&#62;
class B
{
public:
int i ;
B( )
{
}
} ;
class D : public B
{
public:
D( )
{
}
} ;
main( )
{
D d ;
B &#38;b = d ;
}
]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fprogramminginterviewquestions.com%2F2009%2F11%2F14%2Fcan-base-class-reference-is-initialized-with-derived-class-object-2%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fprogramminginterviewquestions.com%2F2009%2F11%2F14%2Fcan-base-class-reference-is-initialized-with-derived-class-object-2%2F" height="61" width="51" /></a></div><p>We can declare a reference  to base class and initialize it with derived class&#8217;s object as shown in the following program..</p>
<blockquote><p>#include &lt;iostream.h&gt;</p>
<p>class B</p>
<p>{</p>
<p>public:</p>
<p>int i ;</p>
<p>B( )</p>
<p>{</p>
<p>}</p>
<p>} ;</p>
<p>class D : public B</p>
<p>{</p>
<p>public:</p>
<p>D( )</p>
<p>{</p>
<p>}</p>
<p>} ;</p>
<p>main( )</p>
<p>{</p>
<p>D d ;</p>
<p>B &amp;b = d ;</p>
<p>}</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://programminginterviewquestions.com/2009/11/14/can-base-class-reference-is-initialized-with-derived-class-object-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Create Control Panel Applet ?</title>
		<link>http://programminginterviewquestions.com/2009/11/14/how-to-create-control-panel-applet/</link>
		<comments>http://programminginterviewquestions.com/2009/11/14/how-to-create-control-panel-applet/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 04:53:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[VC++]]></category>
		<category><![CDATA[Control Panel Applet]]></category>

		<guid isPermaLink="false">http://programminginterviewquestions.com/?p=8925</guid>
		<description><![CDATA[Though Windows provides a number of standard Control Panel applets, we are allowed to add new ones to suit our requirement. A Control Panel applet resides in a DLL having an extension ‘.cpl’. In this article we will discuss how to create an applet that will allow you to swap mouse buttons and change typical [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fprogramminginterviewquestions.com%2F2009%2F11%2F14%2Fhow-to-create-control-panel-applet%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fprogramminginterviewquestions.com%2F2009%2F11%2F14%2Fhow-to-create-control-panel-applet%2F" height="61" width="51" /></a></div><p>Though Windows provides a number of standard Control Panel applets, we are allowed to add new ones to suit our requirement. A Control Panel applet resides in a DLL having an extension ‘.cpl’. In this article we will discuss how to create an applet that will allow you to swap mouse buttons and change typical mouse settings like mouse trails and double-click time.</p>
<p>Follow the instructions given below to build the applet.</p>
<ol>
<li>Create a new project called <strong>setmouse</strong>.      Select the project type as ‘MFC AppWizard (dll)’ and choose the option      ‘Regular DLL with MFC statically linked’. This option would ensure that      the MFC DLL’s used by our applet would also become part of our DLL. As a      result, we can run this applet easily on machines that do not have MFC.</li>
<li>Since a ‘.cpl’ file is a DLL      we cannot execute it directly. So we will have to build a cpl file, copy      it into <strong>C</strong>:\Windows\System directory and run it through ‘Start |      Settings | Control Panel’. During the course of creation of an applet we      are likely to change the source code often. This would necessitate copying      of .cpl to System directory every time before we can test it. To avoid      this select ‘Project | Settings’ menu. A dialog would pop up. In the      ‘Debug’ tab type <strong>C:\Windows\Control.exe</strong> in the edit box titled      ‘Select Executable for debug session’. Also, in the ‘Link’ tab type <strong>C:\Windows\System\setmouse.cpl </strong>in ‘Output file name’ edit box. Once these settings have been made we      can directly compile and execute the applet using the normal Ctrl F5.</li>
</ol>
<p>Remember that path of ‘control.exe’ and the ‘System’ directory may be different in your machine. So make sure that you give correct entries in the edit boxes.</p>
<ol>
<li>Select ‘File | New | C++      Source File’. Give file name as ‘mousecpl’. This file will contain      definition of exported function. Select ‘File | New | C++ Header File’.      Give file name as ‘mousecpl’. This file will contain declaration of exported      function.</li>
<li>Create an icon (using      Resource Editor) for our applet. This icon will be displayed in Control      Panel. Also create a dialog that will get displayed on double clicking our      applet’s icon in Control Panel. The dialog template should look as shown      below:</li>
</ol>
<p align="center"><img class="alignnone size-full wp-image-8927" title="img1" src="http://programminginterviewquestions.com/wp-content/uploads/2009/11/img1.jpg" alt="img1" width="318" height="212" /></p>
<ol>
<li>Insert a new class called <strong>mydialog</strong> for the above dialog. Add following variables to the <strong>mydialog</strong> class.</li>
</ol>
<table border="1" cellspacing="0" cellpadding="0" width="387">
<tbody>
<tr>
<td width="128" valign="top"><strong>Control</strong><strong> </strong></td>
<td width="116" valign="top"><strong>ID</strong><strong> </strong></td>
<td width="113" valign="top"><strong>Type</strong><strong> </strong></td>
<td width="134" valign="top"><strong>Variable</strong><strong> </strong></td>
</tr>
<tr>
<td width="128" valign="top">Slider</td>
<td width="116" valign="top">IDC_SLIDER1</td>
<td width="113" valign="top">Control</td>
<td width="134" valign="top">m_sliderctrl</td>
</tr>
<tr>
<td width="128" valign="top">Slider</td>
<td width="116" valign="top">IDC_SLIDER1</td>
<td width="113" valign="top">Value (   int )</td>
<td width="134" valign="top">m_sliderval</td>
</tr>
<tr>
<td width="128" valign="top">Spin</td>
<td width="116" valign="top">IDC_SPIN1</td>
<td width="113" valign="top">Control</td>
<td width="134" valign="top">m_spinctrl</td>
</tr>
<tr>
<td width="128" valign="top">Check   Box</td>
<td width="116" valign="top">IDC_SWAP</td>
<td width="113" valign="top">Value (   BOOL )</td>
<td width="134" valign="top">m_swap</td>
</tr>
</tbody>
</table>
<ol>
<li>Add the following code to <strong>OnInitDialog(      )</strong> function.</li>
</ol>
<blockquote><p>BOOL mydialog::OnInitDialog( )</p>
<p>{</p>
<p>CDialog::OnInitDialog( ) ;</p>
<p>m_sliderctrl.SetRange ( 0, 1000 ) ;</p>
<p>m_sliderctrl.SetPos ( 500 ) ;</p>
<p>m_spinctrl.SetRange ( 1, 100 ) ;</p>
<p>m_spinctrl.SetPos ( 1 ) ;</p>
<p>return TRUE; // return TRUE unless you set the focus to a control</p>
<p>// EXCEPTION: OCX Property Pages should return FALSE</p>
<p>}</p></blockquote>
<p>Here, we have specified the range and the initial position for the slider and spin controls.</p>
<ol>
<li>Add the <strong>OnOK( )</strong> handler. The code of <strong>OnOK( )</strong> function is given below:</li>
</ol>
<blockquote><p>void mydialog::OnOK( )</p>
<p>{</p>
<p>CDialog::OnOK( ) ;</p>
<p>::SystemParametersInfo ( SPI_SETMOUSEBUTTONSWAP, m_swap, NULL, NULL ) ;</p>
<p>::SystemParametersInfo ( SPI_SETDOUBLECLICKTIME, m_sliderval, NULL, NULL ) ;</p>
<p>::SystemParametersInfo ( SPI_SETMOUSETRAILS, m_spinctrl.GetPos(), NULL, NULL ) ;</p>
<p>}</p></blockquote>
<p>Here, firstly, we have called base class’s <strong>OnOK( )</strong> function which internally calls <strong>UpdateData</strong> <strong>( TRUE )</strong>. <strong>UpdateDate ( TRUE )</strong> transfers values from the controls to the variables associated with the controls. Next, we have called <strong>::SystemParametersInfo( )</strong> function to change the settings according to the values entered by the user.</p>
<ol>
<li>Every cpl file exports a      callback function called <strong>CPlApplet( )</strong> which serves as an entry      point for an applet. Write the <strong>CplApplet( )</strong> function in      ‘mousecpl.cpp’ as shown below:</li>
</ol>
<blockquote><p>#include &#8220;stdafx.h&#8221;</p>
<p>#include &lt;cpl.h&gt;</p>
<p>#include &#8220;mousecpl.h&#8221;</p>
<p>#include &#8220;resource.h&#8221;</p>
<p>#include &#8220;mydialog.h&#8221;</p>
<p>LONG APIENTRY CPlApplet ( HWND cplhwnd, UINT msg, LONG lparam1, LONG lparam2 )</p>
<p>{</p>
<p>CPLINFO *cplinfo = ( CPLINFO* ) lparam2 ;</p>
<p>mydialog d ( CWnd::FromHandle ( cplhwnd ) ) ;</p>
<p>switch ( msg )</p>
<p>{</p>
<p>case CPL_DBLCLK:</p>
<p>d.DoModal( ) ;</p>
<p>return 0 ;</p>
<p>case CPL_EXIT:</p>
<p>return 0 ;</p>
<p>case CPL_GETCOUNT:</p>
<p>return 1 ;</p>
<p>case CPL_INIT:</p>
<p>return 1 ;</p>
<p>case CPL_NEWINQUIRE:</p>
<p>return 1 ;</p>
<p>case CPL_INQUIRE:</p>
<p>cplinfo -&gt; idIcon = IDI_ICON1 ;</p>
<p>cplinfo -&gt; idInfo = IDINFO ;</p>
<p>cplinfo -&gt; lData = 0 ;</p>
<p>cplinfo -&gt; idName = IDNAME ;</p>
<p>return 0;</p>
<p>case CPL_SELECT:</p>
<p>return 1 ;</p>
<p>case CPL_STOP:</p>
<p>return 1 ;</p>
<p>default:</p>
<p>break;</p>
<p>}</p>
<p>return 1;</p>
<p>}</p></blockquote>
<p>Note that the file ‘cpl.h’ has been #included in this file. <strong>CPlApplet( )</strong> function receives requests in the form of Control Panel (CPL) messages and then carries out the requested work i.e initializing the application, displaying and managing the dialog box, and closing the application.</p>
<p>When the controlling application first loads the Control Panel applet, it retrieves the address of the <strong>CPlApplet( )</strong> function and subsequently uses the address to call the function and pass it messages. Returning a <em>0</em> indicates that we have processed the message. Otherwise we must return <em>1</em>. The meaning of the various messages is given below in brief.</p>
<ul>
<li><strong>CPL_DBLCLK:</strong> Sent to notify <strong>CPlApplet(      )</strong> that the user has chosen the icon associated with a given dialog      box. <strong>CPlApplet( )</strong> should display the corresponding dialog box.</li>
<li><strong>CPL_INIT:</strong> Sent immediately after the      DLL containing the Control Panel application is loaded. All      initializations are done when this message is received.</li>
<li><strong>CPL_GETCOUNT:</strong> Prompts <strong>CPlApplet( )</strong> to return a number that indicates how many dialog boxes it supports.</li>
<li><strong>CPL_INQUIRE:</strong> Prompts <strong>CPlApplet( )</strong> to provide information about a specified dialog box. This information is      stored in a structure called CPLINFO. We have stored the following values      in CPLINFO structure:</li>
</ul>
<p>cplinfo -&gt; idIcon = IDI_ICON1 ;</p>
<p>cplinfo -&gt; idInfo = IDINFO ;</p>
<p>cplinfo -&gt; lData = 0 ;</p>
<p>cplinfo -&gt; idName = IDNAME ;</p>
<p><strong>idIcon</strong> represents the icon we wish to display in Control Panel. We have not specified any value for <strong>lData</strong>. <strong>idName</strong> is the name which appears below the icon of the applet in the Control Panel. <strong>idInfo</strong> contains a string which is displayed in the status bar if icon is selected. Since <strong>idInfo</strong> and <strong>idName</strong> take the id of the string rather than the strings themselves, we have to create a string table using Resource Editor. Add the values to string table as given below.</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="95" valign="top">
<p align="center"><strong>ID</strong><strong> </strong></p>
</td>
<td width="119" valign="top">
<p align="center"><strong>Value</strong><strong> </strong></p>
</td>
<td width="159" valign="top">
<p align="center"><strong>Caption</strong><strong> </strong></p>
</td>
</tr>
<tr>
<td width="95" valign="top">
<p align="center">IDINFO</p>
</td>
<td width="119" valign="top">
<p align="center">1</p>
</td>
<td width="159" valign="top">
<p align="center">Change Mouse Settings</p>
</td>
</tr>
<tr>
<td width="95" valign="top">
<p align="center">IDNAME</p>
</td>
<td width="119" valign="top">
<p align="center">2</p>
</td>
<td width="159" valign="top">
<p align="center">Mouse Settings</p>
</td>
</tr>
</tbody>
</table>
<ul>
<li><strong>CPL_NEWINQUIRE:</strong> This message also prompts <strong>CPlApplet(      ) </strong>to provide information about the dialog box.. However, MSDN      documentation suggests that you should process CPL_INQUIRE and not      CPL_NEWINQUIRE.</li>
<li><strong>CPL_STOP:</strong> Sent once for each dialog      box before the controlling application closes. Memory allocated should be      freed when this message is received.</li>
<li><strong>CPL_EXIT:</strong> Sent after the last      CPL_STOP message and immediately before the controlling application frees      the DLL containing the applet.</li>
</ul>
<ol>
<li>Declare <strong>CplApplet( )</strong> in ‘mousecpl.h’ as follows:</li>
</ol>
<p>LONG APIENTRY CPlApplet ( HWND cplhwnd, UINT umsg,LONG lparam1, LONG lparam2 ) ;</p>
<ol>
<li>Add export statement for <strong>CPlApplet(      )</strong> in the ‘setmouse.def’ file as given below:</li>
</ol>
<p>; setmouse.def : Declares the module parameters for the DLL.</p>
<p>LIBRARY &#8220;setmouse&#8221;</p>
<p>DESCRIPTION &#8217;setmouse Windows Dynamic Link Library&#8217;</p>
<p>EXPORTS</p>
<p>; Explicit exports can go here</p>
<p>CPlApplet</p>
<p>Compile and execute the project using Ctrl F5. When we do so the Control Panel window shown below would appear.</p>
<p align="center"><img class="alignnone size-full wp-image-8928" title="Img2" src="http://programminginterviewquestions.com/wp-content/uploads/2009/11/Img2.gif" alt="Img2" width="426" height="300" /></p>
<p>Double click the ‘Mouse Settings’ icon and you will see the dialog that will allow you to change the mouse settings.</p>
]]></content:encoded>
			<wfw:commentRss>http://programminginterviewquestions.com/2009/11/14/how-to-create-control-panel-applet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to display the system information?</title>
		<link>http://programminginterviewquestions.com/2009/11/14/how-to-display-the-system-information/</link>
		<comments>http://programminginterviewquestions.com/2009/11/14/how-to-display-the-system-information/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 04:49:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[VC++]]></category>
		<category><![CDATA[system information]]></category>

		<guid isPermaLink="false">http://programminginterviewquestions.com/?p=8923</guid>
		<description><![CDATA[

The most easy way to display system information is to add a ready made component &#8216;System Info For About Dlg&#8217; provided with VC++. This component displays system information in the &#8216;About&#8217; dialog box. This component can be added to our project from Project &#124; Add To Project &#124; Components and Controls. Inserting the component in [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fprogramminginterviewquestions.com%2F2009%2F11%2F14%2Fhow-to-display-the-system-information%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fprogramminginterviewquestions.com%2F2009%2F11%2F14%2Fhow-to-display-the-system-information%2F" height="61" width="51" /></a></div><p><strong><br />
</strong></p>
<p>The most easy way to display system information is to add a ready made component &#8216;System Info For About Dlg&#8217; provided with VC++. This component displays system information in the &#8216;About&#8217; dialog box. This component can be added to our project from Project | Add To Project | Components and Controls. Inserting the component in our project adds few lines of code in <strong>CAboutDlg::OnInitDialog( )</strong> function. Changes must be made in the &#8216;About&#8217; dialog according to that code.</p>
]]></content:encoded>
			<wfw:commentRss>http://programminginterviewquestions.com/2009/11/14/how-to-display-the-system-information/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Can base class reference is initialized with derived class object ?</title>
		<link>http://programminginterviewquestions.com/2009/11/14/can-base-class-reference-is-initialized-with-derived-class-object/</link>
		<comments>http://programminginterviewquestions.com/2009/11/14/can-base-class-reference-is-initialized-with-derived-class-object/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 04:48:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[reference]]></category>

		<guid isPermaLink="false">http://programminginterviewquestions.com/2009/11/14/can-base-class-reference-is-initialized-with-derived-class-object/</guid>
		<description><![CDATA[We can declare a reference  to base class and initialize it with derived class&#8217;s object as shown in the following program..
#include &#60;iostream.h&#62;
class B
{
public:
int i ;
B( )
{
}
} ;
class D : public B
{
public:
D( )
{
}
} ;
main( )
{
D d ;
B &#38;b = d ;
}
]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fprogramminginterviewquestions.com%2F2009%2F11%2F14%2Fcan-base-class-reference-is-initialized-with-derived-class-object%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fprogramminginterviewquestions.com%2F2009%2F11%2F14%2Fcan-base-class-reference-is-initialized-with-derived-class-object%2F" height="61" width="51" /></a></div><p>We can declare a reference  to base class and initialize it with derived class&#8217;s object as shown in the following program..</p>
<blockquote><p>#include &lt;iostream.h&gt;</p>
<p>class B</p>
<p>{</p>
<p>public:</p>
<p>int i ;</p>
<p>B( )</p>
<p>{</p>
<p>}</p>
<p>} ;</p>
<p>class D : public B</p>
<p>{</p>
<p>public:</p>
<p>D( )</p>
<p>{</p>
<p>}</p>
<p>} ;</p>
<p>main( )</p>
<p>{</p>
<p>D d ;</p>
<p>B &amp;b = d ;</p>
<p>}</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://programminginterviewquestions.com/2009/11/14/can-base-class-reference-is-initialized-with-derived-class-object/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Explaing Preprocessor Symbol &#8216;#&#8217;</title>
		<link>http://programminginterviewquestions.com/2009/11/14/explaing-preprocessor-symbol/</link>
		<comments>http://programminginterviewquestions.com/2009/11/14/explaing-preprocessor-symbol/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 04:46:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C Programming]]></category>
		<category><![CDATA[Preprocessor Symbol '#']]></category>

		<guid isPermaLink="false">http://programminginterviewquestions.com/?p=8919</guid>
		<description><![CDATA[

The # symbol can be used in front of a normal macro argument to convert the actual argument to string.
#define PRINT(X) printf ( #X &#8221; = %s&#8221;, X ) ;
void main( )
{
char *name = &#8220;Jeff Prosise&#8221; ;
PRINT ( name )
}
The output of the above program is
name = &#8220;Jeff Prosise&#8221;
]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fprogramminginterviewquestions.com%2F2009%2F11%2F14%2Fexplaing-preprocessor-symbol%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fprogramminginterviewquestions.com%2F2009%2F11%2F14%2Fexplaing-preprocessor-symbol%2F" height="61" width="51" /></a></div><p><strong><br />
</strong></p>
<p>The # symbol can be used in front of a normal macro argument to convert the actual argument to string.</p>
<blockquote><p>#define PRINT(X) printf ( #X &#8221; = %s&#8221;, X ) ;</p>
<p>void main( )</p>
<p>{</p>
<p>char *name = &#8220;Jeff Prosise&#8221; ;</p>
<p>PRINT ( name )</p>
<p>}</p></blockquote>
<p>The output of the above program is</p>
<p>name = &#8220;Jeff Prosise&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://programminginterviewquestions.com/2009/11/14/explaing-preprocessor-symbol/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
