|
#include <iostream>
#include <conio.h>
#include <iomanip>
using namespace std;
ostream& curren(ostream &s, int fieldSize)
{
cout << "$";
cout.setf(ios.fixed | ios::showpoint);
cout.precision(2);
cout.width(fieldSize);
return s;
}
// was this deprecated??
omanip (int) currency (int fieldSize);
{
return omanip<int>(curren,fieldSize);
}
void main ()
{
double someMoney = 13.5678;
cout<<currency(7)<<someMoney<<endl;
}
Jon
|
|
|
|
|
|
Actually it seems Microsoft left it out from omanip that comes bundled with VS2003, however it seems to be available on Borland (which I don't have).
Thanks for your help.
Jon
|
|
|
|
|
Help me to figure out, how can i control windows explorer with my program ?. For example i want to make program if i click button "back" in my program, it command windows explorer to back, if i click button "up", it command windows explorer to going up from current directory. is this possible to make ???? please help me
Sory about my english, like you guess english not my mother language
|
|
|
|
|
You might want to start of by using a spy utility like SPY++ to find out what commands and such are sent when buttons are pressed. If you can find that out it should be a simple task as sending the window a message )
|
|
|
|
|
i create a thread and got the Handle.
how can i get the following information of the thread?
1. is the thread object signaled? when can it be signaled?
2. is the thread suspended? it is easy but how to get the suspend count?
3. has the thread terminated? what happens to the thread object if the thread funtion quits? reset to NULL?
i looked up the google but could not get clear answer, wish you guys here can help me out, thanks alot!
|
|
|
|
|
A thread object is signaled when the thread exits. Call WaitForSingleObject() with a timeout of 0, and if it returns WAIT_OBJECT_0 then the object is signaled. The thread object in the kernel (like all such objects) remain around until all handles on them are closed.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
(2)Did you see SuspendThread(...) and ResumeThread(...)
|
|
|
|
|
The following error is being displayed when running this simple program:
stack around the variable 'values' was corrupted (same as subject)
#include <iostream>
#include <conio.h>
using namespace std;
void main ()
{
int x;
const int fieldSize = 10;
const int arraySize = 5;
double values[arraySize];
values[0] = 23.4;
for (x= 0; x < arraySize; x++)
values [x+1] = values[x] * .10;
for (x= 0; x < arraySize; x++)
{
cout.width(fieldSize);
cout<< values[x]<<endl;
}
cout.precision(2);
cout<<"After precision (2) call"<< endl;
for (x=0; x < arraySize; x++)
{
cout.width(fieldSize);
cout<<values[x]<<endl;
//error is displayed when arraySize = 5. The program seems to perform an extra loop.
}
}
Jon
|
|
|
|
|
|
|
const int arraySize = 5;
double values[arraySize];
values[0] = 23.4;
for (x = 0; x < arraySize; x++)
values [x+1] = values[x] * .10; Plug in x = 4 in the loop and you get:
values[5] = values[4] * .10; You're writing off the end of the array when you assign to values[5] .
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
that's right, sorry
Jon
|
|
|
|
|
I know its possible in C# using web resource provider but please tell me how to do it using VC++ .Is there any MFC available ???? i also want to login into that website using id and password. please reply
|
|
|
|
|
micku wrote: Is there any MFC available ????
Yes. Here's the MFC equivalent[^] of WebResourceProvider. You will likely want to pass the user id and password as post arguments.
/ravi
|
|
|
|
|
I have a toolbar and a statusbar on my main window, which I would like the user to be able to show or hide. Easy enough I know, but the problem is I have many controls on the dialog which would need to move as a result. I have coded it in a way that when ever a WM_SIZE message is processed, it calculates the rect for the toolbar and status bar. Calling the ShowWindow() function, does hide the controls, but GetClientRect() still return with the size. Is there a way around this? Non MFC by the way.
|
|
|
|
|
Can't you use SetWindowLong to show and hide one control?
you may need to use to the style using GetWindowLong function.
-- modified at 9:22 Sunday 20th August, 2006
|
|
|
|
|
Thanks for the suggestion. I used the SetWindowLong() function to disable the autosize feature of the toolbar, then resized it to 0, all seems to work, until I want to restore it. I reset the Styles, reset the size, and call for an update. The toolbar appears, minus the buttons??? I thought this would be a simple task so I left6 it till the last, guess I was wrong!
|
|
|
|
|
Currently i have a structure of
struct data
{
long int addNumber,addPostal,exMth,exYear;
char fName[40],lsName[40],addStreet[40],addCity[40],addState[40];
};
data dataRecords[100];
This is used to store values in dataRecords[0],dataRecords[1], etc...
In using this method, I can only store up to a max of 0-100 records. Is there anyway where number of dataRecords can be made dynamic? instead of limiting it to 100. There is another method of using linked list instead, but i dun have enuff time to change my whole program to adapt to it.
Thanks
|
|
|
|
|
The best way to deal with dynamic arrays is using the vector class from the standard template library.
Another way is yo use dynamic arrays (by using new[] and delete[]) but then you have to manage the memory yourself.
|
|
|
|
|
Using the STL vector class is probably the best way to go. And while you're at it you may save a bit of space using the STL string class too.
|
|
|
|
|
|
Hello everyone,
I always notice that some guys are using some VC built-in variables to specify some properties, like OutDir, ProjectName, SolutionName, etc. Then we can use the built-in variables to specify, for example, the generated library name, like $(OutDir)/$(ProjectName).lib.
I think this way is very convenient compared with hardcoded names. I am wondering where can I find a list of all such built-in variable names and meanings?
thanks in advance,
George
|
|
|
|
|
In VS.NET 2003, go to Project Properties, Build Events, Post-Build Event, click in the Command Line box, then click the [...] button that appears at the end of the field. Then click the [Macros>>] button to expand this dialog. This lists all the macros valid for use in this project.
|
|
|
|
|
Cool way, Mike!
I could also see the values as well.
regards,
George
|
|
|
|