|
Data types commonly referred to as real are basically the language's way of saying it is a floating point number.
I think the term real comes from the mathematical classification of numbers:
- Natural Numbers: 1,2,3,4,..
- Whole Numbers: 0,1,2,3,4..
- Integers: -2,-1,0,1,2,3,..
- Real: 3.4, 1.0, 2.0, -5.664, 3.142
- Complex Numbers: 5+3i
So the real data type can be used to represents numbers that can be whole (3,5,6) or a fraction of a number (2.1, 5.6, 1.333..).
In C++, real data type can be defined as a float, or a double variable. Double uses a higher level of precision than a float value.
COM Objects represents real values using the VARIANT type of
VT_R4 (float) or VT_R8 (double). VT_R4, RT_4 and float are just language specific ways of representing the same number, just expressed differently.
I'm sure there are more detailed explaination on data types on this topic, but I just wanted to give a general view, without going into to much details and specifics. Maywell be that Its not as accurate, but you should get the idea.
"..Even my comments have bugs!"
Inspired by Toni78
|
|
|
|
|
RChin wrote:
I think the term real comes from the mathematical classification of numbers:
It's an actual data type in Pascal (and related languages).
|
|
|
|
|
Hi,
I am trying to read thru a .txt file using ODBC.but when i create a CRecordset derived class using Class Wizard specifying the DSN and filename in usual way,Only 1 field value is reflected in my CRecordset derived class , mean In the text file there are 6 columns namely A,B,C,D,E,F.But I am getting only 1 member variable m_A in my specialized recordset class,all other fields are not mapped.
Please help.
|
|
|
|
|
What does your .TXT file look like?
In your CRecordset-derived class' header file, there should be a Field/Param Data section with a member variable for each "column" in your .TXT file. In the DoFieldExchange() method of this class, there should be a RFX_xxx mapping statement for each of these member variables.
|
|
|
|
|
Did you map/define the 6 fields in your ODBC DSN setup? You need to do this to access the fields in a text file correctly (including field delimiter, Field name, logical data type, etc...).
|
|
|
|
|
Arghhhhh! Shouldn't this work????
------------------------------------
POINT pt;
<later...>
case WM_MOUSEMOVE:
pt.x = GET_X_LPARAM(lParam);
pt.y = GET_Y_LPARAM(lParam);
<etc...>
------------------------------------
I keep getting the error in the subject! I don't know what's wrong!
-untwisted
www.uber-ware.com
brian@uber-ware.com
|
|
|
|
|
Did you remember to include:
#define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
#define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
in your file?
|
|
|
|
|
Isn't that already defined for me though?
Edit: I definded it, and now it's working! Thanks!
-untwisted
www.uber-ware.com
brian@uber-ware.com
|
|
|
|
|
#include <windowsx.h> usually does the trick, but I got used to
#ifndef GET_X_LPARAM
#define GET_X_LPARAM(lParam) ((int)(short)LOWORD(lParam))
#endif
#ifndef GET_Y_LPARAM
#define GET_Y_LPARAM(lParam) ((int)(short)HIWORD(lParam))
#endif
(WTL does the same, btw.)
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
peterchen wrote:
#include usually does the trick, but I got used to
He meant #include <window.h>.
Hey Peterchen, after all this time, I cannot believe you've fallen in the so-known < > trap
~RaGE();
|
|
|
|
|
|
It goes like this:
When I finished changing items in a ListCtrl I wanna make all the columns the actually width like I just double clicked the header-divider. But I don't know exaclty how to put codes in my program.
Anyone please help me figure it out or give me some tips.
Thanks very much! ^_^
|
|
|
|
|
CListCtrl *pLC = (CListCtrl *)GetDlgItem(IDC_MYLVCTRL);
pLC->SetColumnWidth(0,LVSCW_AUTOSIZE);
|
|
|
|
|
|
(first sorry if the topic doesnt fit to this board but i didnt find a better place)
Well,
Id like to have a class and derivate several classes from it. Then id like to have a container that could contain object from any of the derivated classes. Example:
class A {public: int a; virtual void print() {printf("a\n");}; };
class B:public A {public: void print() {printf("b\n");}; };
class C:public A {public: int b;};
int main(int argc, char* argv[])
{
A a; B b; C c;
vector <A> X;
X.push_back(a);X.push_back(b);X.push_back(c);
for (int i=0;i<x.size();i++) X[i].show();
// HERE I WANT TO CALL THE RIGHT print METHOD
return 0;
}
It might be basic but its been a long time im wondering how to do that,
any help would be greatly appreciated....
Remy
|
|
|
|
|
One solution is dynamic allocation.
// Assuming ClassA is base
std::vector<class a*=""> data;
A *a = new A;
data.push_back(dynamic_cast<classa>(a);
...
Kuphryn
|
|
|
|
|
Thanks Kuphryn,
My final goal is to insert that into a class. Wouldnt i have some memory problems if i do that?:
class A {public:int a;virtual void show() {printf("a\n");};};
class B:public A{public:void show() {printf("b\n");};};
class C:public A{public:int b;};
class CodeProject
{
public:
std::vector<a*> data;
void Init()
{
A *a = new A; data.push_back(dynamic_cast<a*>(a));
B *b = new B; data.push_back(dynamic_cast<a*>(b));
C *c = new C; data.push_back(dynamic_cast<a*>(c));
}
void Main()
{
Init();
for (int i=0;i<data.size();i++)
data[i]->show();
}
};
int main(int argc, char* argv[])
{
CodeProject Rulez;
Rulez.Main();
return 0;
}
|
|
|
|
|
No. Remember you are working with pointers. Just deallacate the memory after you're done. In other words, delete the pointers. One solution is to loop through all elements in the container and call "delete ..."
Kuphryn
|
|
|
|
|
Oups,
Well, lets say i was just testing your skills Kuphyn.
Thanks a lot again, its really useful for me.
Remy
|
|
|
|
|
Hi,
I'm writing an OCX in VC which passes a string containg NULLs. VB discards these NULL bytes. The length of the string shows as 0, when VC++ sends a NULL char. to the VB Event.
Can someone help me How to handle these NULLs in VB?
VC++, OCX event declared as ...
void FireWriteToPort(LPCTSTR portData)
VB handles it as ...
Private Sub ThreadOCX1_WriteToPort(ByVal portData As String)
... portData becomes empty when a NULL char. comes into picture.
Thanks in advance,
|
|
|
|
|
VB uses a null char to truncate the string with just like C/C++. If there is a NULL at the front of the string it will consider that the end of the string.
Look at the following code for an example of this...
Private Sub Form_Load()
Dim Message As String
Message = vbNullChar
Message = Message & "Oh, Happy "
Message = Message & vbNullChar
Message = Message & "Day"
ShowNull Message
End Sub
Sub ShowNull(ByVal Data As String)
MsgBox Data
End Sub
It will show a blank message box, but if you commment the line Message = vbNullChar it will output "Oh, Happy ".
Jeremy Falcon
|
|
|
|
|
Hello All,
I have a composite Activex control which has a few common window controls over it. Now I am trying to place this activex control over a normal mfc dialog generated through MFC Appwizard. The dialog does not get created at all neither does it run. Why. Am I missing something. Is this allowed in the first place.
I know with a MFC Activex control this works but how do I make it work for a Active x control generated through ATL. I have tried with Full Control too.
Regards
Rajdeep Majumdar
|
|
|
|
|
I remeber there is a article in codeguru or coderoject ever,but i can't find it.please give some tips.
|
|
|
|
|
How to take "argc" (like comand line) in dialog based aplication?
|
|
|
|
|