|
DO I also need to do something else? It says that std is not a namesapce etc. THanks for the help.
|
|
|
|
|
Just have to make sure you have this line in the file:
#include <limits>
Steve
|
|
|
|
|
For strict ANSI you should only use <limits.h> and assume the the most negative double representable is -DBL_MAX (the negative of DBL_MAX). This will result in -1.7976931348623158e+308, which is, in fact the most negative number that can be represented.
This assumption is reasonable since the sign bit can always be used to represent any negative form of any positive number and vice-versa.
Note, however, that the "resolution" is only of about 15 digits. This means that 10e20 + 1.0 will result in 10e20. And you can keep adding 1.0 and the result will never change from 10e20.
So, it is important to note the difference between dynamic range (308 exponent) and resolution (about 15 decimal digits).
Rilhas
|
|
|
|
|
Hi.
I’m trying to develop an application that operates on the oracle database using (ODBC) CDatabase & CRecordset. But the application can't show the record (NUMBER) type correctly and it show instead some strange numbers in the edit contrl. -19841 something like this.
// here's an example of the code.
char str[255];
int index=0;
CDBVariant var;
record.GetFieldValue(index,var);
wsprintf(str,"%d",var.m_iVal);
EditCtrl->SetWindowText(str);
Somebody tell me please what I have to do to convert the number and show it correctly?
I'm using VC++ 6.0 & Oracle 9i (9.2.0.1.0)
Best regards.
|
|
|
|
|
M_Nuaimi wrote: char str[255];
int index=0;
CDBVariant var;
record.GetFieldValue(index,var);
wsprintf(str,"%d",var.m_iVal);
EditCtrl->SetWindowText(str);
You are using char with with wsprintf ! Could be a reason. Please check.
Nibu thomas
Software Developer
|
|
|
|
|
I would have thought that would have generated a compiler error....
Steve
|
|
|
|
|
Yeah. But he is saying the application is showing invalid numbers. That means it compiled.
Nibu thomas
Software Developer
|
|
|
|
|
I think we were both mistaken here. Here's the prototype for wsprintf :
int wsprintf( LPTSTR lpOut,
LPCTSTR lpFmt,
...
);
It's not UNICODE!
We were thinking of swprintf which looks like this:
int swprintf(
wchar_t *buffer,
size_t count,
const wchar_t *format [,
argument]...
);
There must be another reason for this problem.
Steve
|
|
|
|
|
Stephen Hewitt wrote: int wsprintf( LPTSTR lpOut, LPCTSTR lpFmt, ...);
I guess it's the TCHAR version of sprintf . But there is another one _stprintf .
Docs say it(wsprintf ) is implemented as Unicode and ANSI versions on Windows NT/2000/XP.
Nibu thomas
Software Developer
|
|
|
|
|
Nibu thomas wrote: I guess it's the TCHAR version of sprintf. But there is another one _stprintf.
wsprintf() is implemented by Windows, _stprintf() is the CRT version
Ryan "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"
|
|
|
|
|
The Oracle NUMBER data type is not an integer, so you can't use var.m_iVal like that. You should be checking the data type of the CDBVariant and using the correct field value appropriately.
NUMBER s map to the variant VT_DECIMAL type, which CDBVariant probably maps to a double - I generally don't use CDBVariant as it is too limiting.
Ryan "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 changed all to double, but the problem still appear, it shows now 3516408 instead 500
Ryan may you tell me please about what you usually use instead of CDBVariant?
thanks to all for attention
|
|
|
|
|
I generally use COleVariant or just a plain VARIANT structure.
You mustcheck the type of data thats in the CDbVariant . Check the m_dwType field to determine the type of data - that is the only way you'll know which data member to use.
Ryan "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 need some help,could you help me?
In my program ,I create a other frame by myself:
pFrame = theApp.m_pDrawDocTemplate->CreateNewFrame(this, NULL);
theApp.m_pDrawDocTemplate->SetDefaultTitle(this);
pFrame->SetParent (NULL);
theApp.m_pDrawDocTemplate->InitialUpdateFrame(pFrame, this, TRUE);
the frame work well,but I can't debug it in step mode(the break point can't work).
this is all
|
|
|
|
|
Where did you put the breakpoint?
Ryan "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 put the breakpoint in OnDraw() event of the view (in the first line).but when run to here ,
the program will dead.
And if set the breakpoint in the menu event,the program will not response it.
|
|
|
|
|
I'm after a control like the one shown in this image. I'm considering putting a hyperlink control in a static text control, but was wondering if someone has already written such a non-MFC class ?
http://img136.imageshack.us/img136/9983/customcontrolwithcustomisableh.png
The control should have the following features:
1) allows you to mix normal text with hyperlink text (ie. blue in the screenshot).
2) mouse cursor should change to hand cursor when over link
3) should be possible to indent lines and long lines should wrap onto a new line if too long
4) text should not be selectable (although it would be nice if this could be enabled/disabled)
5) No text cursor should be displayed
6) should be dynamically resizable
7) Vertical scrollbar should be enabled and allow to scroll if there are too many lines
Does anyone know of an existing non-MFC class which can do this ?
Also, I'm considering using WTL (although not definite) and was wondering if it has an in-built class like this ?
-- modified at 19:31 Wednesday 26th April, 2006
|
|
|
|
|
Make one or Buy one! Thats the easiest way.
Nibu thomas
Software Developer
|
|
|
|
|
bool screen::addCube(cube* newCube)
screens[i].addCube(&cubeSet[i]);
Is there anything wrong with the way i have all the function.
I the screen obj has builds a linked list of displayable obj, well just my cubes really.
But later when draw gets called the some of the values of the cube from cubeSet are incorrect or null and the program halts.
The program starts with declarations,
cube cubeSet[4];
screen screens[4];
please help,
thanks
|
|
|
|
|
Try this:
screens[i].addCube(cubeSet[i]);
Ankita
|
|
|
|
|
that gives Error error C2664: 'screen::addCube' : cannot convert parameter 1 from 'cube' to 'cube *'
|
|
|
|
|
Sorry, I didn't see that you had static Array declaration for the cubeSet.
so you are saying some of the values being dispalyed are incorrect, but not all? could you post some more detailed code?
Ankita
|
|
|
|
|
You have not initialized the cubes properly.
Nibu thomas
Software Developer
|
|
|
|
|
how should i initialize cubeSet?
My loop goes like this.
cubeSet[i] = cube(); //cube::cube() is the constuctor
.
.
change side colors
.
.
screens[i].addCube(&cubeSet[i]);//ad cube to screen one cube to each screen
Then later in draw func
for(int i = 0;i<4;i++){
screens[i].draw();
}
Screen obj holds the cube in a node
and eventually calls drawNode->cubeItem->draw();
then when in the draw function during debuging i see that some of the cubes info is off
even though back in the setup function the info looked good.
thanks for the help
joe
|
|
|
|
|
how can make a cursor invisible in a certain application?
|
|
|
|