Technically, decimal means base-10 (deca is Greek for ten). So, rather than using a float type, are you wanting to use an int type?
If you simply need more precision, you might try the DECIMAL type. However, I suspect you are not having precision problems. Most beginners assume you can compare floating-point numbers just like you can non floating-point numbers. For example, this would never produce the desired result:
float a = 0.1;
if (a == 0.1)
because a is stored internally as 0.0999999999, give or take a few 9s.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
I am trying to read the entire content of a text file with the following code:
File.seekg(0, ios::end);<br />
long lFileSize = File.tellg();<br />
szFileBuffer = new char[lFileSize + 1];<br />
if ( szFileBuffer == NULL )<br />
MessageBox(NULL, "There is not enough memory to run this application",<br />
NULL, MB_ICONERROR | MB_OK);<br />
return 1;<br />
File.seekg(0, ios::beg);<br />
File.get(szFileBuffer, lFileSize + 1, EOF);<br />
The actual filesize is 715KB but the program is only reading 540KB...tellg gives the correct filesize yet get seems to only be getting 540KB...are there any workarounds for this...in general, are there buffer size limitations as far as istream::get is concerned?
I am giving "&" symbol to menu items, but at runtime, the Menu item is not underlined. Its only when i press "Alt" key it becomes underlined. I want the "short Key" character to be visible at runtime, just like Visual C++ 6.0 IDE or MS Office. How can i do so ?
Because they have their menu ownerdraw and decided for whatever reason to ignore this system setting.
The setting for the system can be retrieved by
function SystemParametersInfo, using flag SPI_GETKEYBOARDCUES.
You can change the setting for the system by using SPI_SETKEYBOARDCUES flag with the mentioned function.
Mr Bose Dayala wrote: can anybody gimme the program with code to create a anolog clock.
Probably, but nobody will. Why don't you write it yourself and if you run into any problems, ask a question about how to do a particular thing. You're much more likely to get a useful response that way.
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late"John Nichol "Point Of Impact"
I found one some months ago here on CP. have you looked here in the articles?
besides I don't think it should be so dificult to make.
think of what parts a clock consists (circle, lines, pointers,...) All of them are static accept the pointers, the base is static (center of the circle) while the point moves, it moves (for the seconds) 360/60 of the circle every second.
The only thing you need to do is to redraw this pointer every second on the right place.
Just know your geometry.;)
hope this helps...
Oh by the way, I did analog meters for a car once, which worked perfectly, the one thing you may want to consider is buffering to reduce flicker. I did it as described above, but I don't have the code anymore
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
I am calling Form2 from Form1, and depending on the input in Form2, I want to enable/disable buttons in Form1 when I exit. However, because I need to call Form2 header before I define class Form1, Form1 is not defined when the compiler sees my call to it. If I therefore call Form1 header in Form2 header, then the compiler will see my call to Form2 before Form2 is defined!!.
Basically therefore, I wanna be able to call each form from each form, but have to define and make the call in one first.
This seems to me a very obvious thing to want to do, but I can't figure out myself how to do it, as you can't declare an extern class, or see any examples on the net of how to do it in Visual C++.net.
Any help appreciated, as is a real stumbling block for me.
In any case one form will be the parent of the other form. So in the 2nd form use the GetParent() function to get the pointer cast it to the parent parentclass, set the parent's values using the currently got value
I am creating a class derived from CListBox so I can control the fonts, color, etc2. I also want to control the background color of the listbox (not the text's background color, but the whole listbox' background color), and I am doing it by handling WM_ERASEBKGND message in OnEraseBkgnd() function.
The OnEraseBkgnd() implementation is very simple, basically I just obtain the client rect and the use CDC::FillSolidRect to fill it with the background color of my choice.
The problem is, the background color is correctly drawn if there is at least one item in the listbox, but when the listbox is empty, the background color is always displayed as white, even though I have stepped in the debugger and make sure that the FillSolidRect function is executed.
Could someone tell me what the possible cause for this is? Thanks!
The WM_CTLCOLORLISTBOX message is sent to the parent window of a list box before the system draws the list box. By responding to this message, the parent window can set the text and background colors of the list box by using the specified display device context handle.<br />
Hello, I'm creating a program that displays a menu to the user and gives the user the option to open the following programs:
It does open the programs correctly but when the user enters 4 for quit, I want my program to close all of the programs the user opened. I am not sure how to do that though. I have created a function called ExitProcess and have a call to it when the user enters 4 as their choice. There is no code in that function.