|
Hi all,
In my application after calculation i m get value in this form "2606.451613".
i want the after "." two digit value like "2606.45".
how can i do this.
Help me for this.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
CString::Format helps.
CString str;
str.Format("%.02f",f);
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
thanks.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
The other answer you got was correct, but you don't need a CString object to do this. The format specification[^] (%.02f) is the one that does the trick.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
Fixed link - June 12, 2008 3:47 AM
|
|
|
|
|
How does format specifiers for debugger solve the OP's problem?
-Saurabh
|
|
|
|
|
I got it now. I linked him to the format specifications recognized by the debugger. Link fixed, thanks for pointing out. And, my post was to emphasize that a CString object is not required to do something like that.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
No problem. You are welcome.
-Saurabh
|
|
|
|
|
|
Yes VC++ do allow to put variables anywhere within function body. You are getting this error because you are compiling this code from a .c file. In C variables are allowed only at the begining of a function. Just change the file extension from c to cpp and it will compile.
-Saurabh
|
|
|
|
|
is there anywhere in the registry or using one of the wmi classes that i can get the gpu core, memory, shader speed?
if no. does anyone know how to get this info?
|
|
|
|
|
For basic information like Name of the gpu card, memory, etc you can use Win32_VideoController class in WMI. For number of shaders, texture units, etc you will have to use directx or opengl.
-Saurabh
|
|
|
|
|
i need core speed shader speed and memory speed only. the rest dont matter
|
|
|
|
|
Hi,
How to get rid of reference to MSJAVA.DLL in Visual C++?
I am building x64 bit COM object and for some reason the DLL depends on MSJAVA.DLL (which is x86); therefore, I am unable to debug this on runtime.
I got this error when turned on "Enabled unmanaged code debugging" in C#:
Error while trying to run project: Unable to start program 'C:\Temp\COM\TestDriver\TestDriver.exe'.
The debugger does not support debugging managed and native code at the same time on this platform.
Anyone know how to remove this reference? I am using Visual Studio 2005.
Cheers
|
|
|
|
|
Hi Masters!
I've a window without titlebar; So it doesn't have any text on its taskbar button. Can i set a title to it?
|
|
|
|
|
Usef Marzbani wrote: Can i set a title to it?
Yes, Call SetWindowText( _T( "New title" ));
For e.g. If I have a dialog without a caption bar I would call SetWindowText in OnInitDialog to avoid a blank button in the windows taskbar.
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Yes you can do.
-@SuDhIrKuMaR@-
|
|
|
|
|
Has anyone here created a Visual Studio project to build the LZMA SDK as a DLL (or lib; I can convert it). It would also be nice to have a project to build the command line utility.
(I like 7-zip, but my goodness, his source is a pain to deal with.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
I recently built 7-zip myself since I wanted to change the icons and it compiled smoothly with VS 2008. What version of VS are you using and what problem do you have building it? There is a project file for standalone command line utility for LZMA at CPP\7Zip\Compress\Lzma_Alone, I just tried it compiles fine. For building it as a librrary I guess there are files for it in CPP\7Zip\Compress\Lzma, did you tried to create a new empty win32 lib project and adding all the files in it?
Saurabh
|
|
|
|
|
I'm building it in VS6. Apparently I need the 2003 PSDK, which I downloaded before heading home tonight. I'll probably build it for VS 2005 as well (long story, don't ask.) I was just curious if someone had created a .dsw for it.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
I have a Windows listview control with 15 columns. Is there a way for me to highlight a specific column in the listview? Can I also move the highlight by scrolling left and right on the listview? Thanks.
|
|
|
|
|
kani98 wrote: Is there a way for me to highlight a specific column in the listview?
Yes. Look at OwnerDraw[^]
led mike
|
|
|
|
|
|
a Dialog-Based project
i begin a thread in OnInitialDialog()
m_list is a variable related with a CListCtrl widget
when compiling
it shows that
error C2065: 'USES_CONVERSION' : undeclared identifier
error C2065: 'ReadDirectoryChangesW' : undeclared identifier
error C2065: 'm_list' : undeclared identifier
error C2227: left of '->InsertItem' must point to class/struct/union
error C2227: left of '->GetItemCount' must point to class/struct/union
error C2227: left of '->SetItemText' must point to class/struct/union
How can i deal with it ??
And why ??
thanks
|
|
|
|
|
york528 wrote: error C2065: 'USES_CONVERSION' : undeclared identifier
See here.
york528 wrote: error C2065: 'ReadDirectoryChangesW' : undeclared identifier
See here.
york528 wrote: error C2065: 'm_list' : undeclared identifier
See here.
What does any of what you posted have to do with threads?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
there's only one problem
error C2065: 'ReadDirectoryChangesW' : undeclared identifier
after i do the follow
Header Declared in WinBase.h; include Windows.h.
it's still have the problem
|
|
|
|