|
Check out the _T() macro:
TRACE(_T("Hello build with UNICODE support"));
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hi.
I'm using the marco _T() indeed.
The macro _T() wrapped L.
Demian.
|
|
|
|
|
Demian Panello wrote:
The macro _T() wrapped L.
Of course. And in the case where _UNICODE is not defined, _T() resolves to nothing. This will eliminate the need for all of the #ifdef directives.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hi David.
You are right!
This is the solution, at least with TRACE() an others functions.
Thank you very much.
Demian.
|
|
|
|
|
corelibc.lib(pegwmain.obj) : error LNK2019: unresolved external symbol _WinMain referenced in function _WinMainCRTStartup
X86Dbg/image.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
i have this kind of error message but i dont have any clue ... i think something wrong with the emulator ? im using eVC 3.0 and i try eVC 4.0 sp3 but same result....
|
|
|
|
|
Just a guess - but it sounds like the project settings don't match reality - for instance, you have your project set up to build a Windows application, but you have coded a console application.
Sometimes I feel like I'm a USB printer in a parallel universe.
|
|
|
|
|
Someone know where I can find same examples look at Extending the WAB (windows address book) Context Menu Actions
Tanks in advice.
Matteo
|
|
|
|
|
Hello
I've got a vehicle class (cVehicle), and two 'heirs', car (cCar)and van (cVan). I store cars and vans in a list. The cvehicle class has a vehicle_type atribute (a char that is 'c' when it's a car and 'v' if it's a van). I want to take it out.
in the following code, i get a vehicle from a list. I don;t know if it's a car or it's a van. I use the vehicle_type atribute to see if it's a car, and if it is, i must return it.
<br />
cvehicle *vtemp=(list->Getvehicle());<br />
if (vtemp->get_vehicle_type()=='c')<br />
return vtemp;<br />
<br />
i've heard of a more elegant way to solve it, that is with the typeid operator. Do you know how to use it?
thanks!
|
|
|
|
|
do you know MSDN ?
i cite :
typeid Operator
C++ Specific —>
<code>typeid( type-id )
typeid( expression )</code>
The <code>typeid </code>operator allows the type of an object to be determined at run-time.
The result of a <code>typeid </code>expression is a <code>const type_info&</code>. The value is a reference to a <code>type_info </code>object that represents either the type-id or
the type of the expression, depending on which form of <code>typeid </code>is used.
See type_info Class for more information.
END C++ Specific
here you are
TOXCCT >>> GEII power
|
|
|
|
|
sorry, i'm new to c++ and i don't have msdn cds.
would you mind giving me an example of typeid usage, if it's not too much trouble?
|
|
|
|
|
string clss;
if (typeid(obj)==typeid(int)) clss = "I";
else if (typeid(obj)==typeid(unsigned int)) clss = "i";
else if (typeid(obj)==typeid(float)) clss = "F";
else if (typeid(obj)==typeid(double)) clss = "D";
else if (typeid(obj)==typeid(short)) clss = "B";
else if (typeid(obj)==typeid(unsigned short)) clss = "b";
else if (typeid(obj)==typeid(long)) clss = "I";
else if (typeid(obj)==typeid(unsigned long)) clss = "i";
got the idea?
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
i tried this but it doesn't work
cvehicle *vtemp=(list->Getvehicle());
if (typeid(vtemp)==typeid(ccar)))
return vtemp;
|
|
|
|
|
just tried this and it works
CString temp;
CString temp1;
const type_info& t = typeid(temp);
AfxMessageBox (t.name ()); // It gave class CString
if(typeid(temp1) == typeid(CString))
AfxMessageBox ("Matched"); // It said matched
Check this too:
class Base { ... };
class Derived : public Base { ... };
void f()
{
Derived* pd = new Derived;
Base* pb = pd;
...
const type_info& t = typeid(pb); // t holds pointer type_info
const type_info& t1 = typeid(*pb); // t1 holds Derived info
...
}
(This is your prob, you should dereference the pointer)
What does yours do?
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
t and t1 are always diferent!
from the debugger:
t: + _m_d_name 0x00433890 ".PAVcvehicle@@"
t1: + _m_d_name 0x00433850 ".?AVccar@@"
|
|
|
|
|
yes so check it against t1
dereference first the pointer you receive and then compare it to typeid(ccar)
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Papa wrote:
dereference first the pointer you receive and then compare it to typeid(ccar)
what do you mean by this?
sorry, english isn't my first language
|
|
|
|
|
cvehicle *vtemp=(list->Getvehicle());
if (typeid(*vtemp)==typeid(ccar)))
return vtemp;
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
it gives me an error: (runtime error, it builds alright)
unhandled exception
|
|
|
|
|
"If the expression is dereferencing a pointer, and that pointer’s value is zero, typeid throws a bad_typeid exception. If the pointer does not point to a valid object, a __non_rtti_object exception is thrown."
Do you have a NULL pointer?
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
no, *vtemp isn't null
it gives me this warning
warning C4541: 'typeid' used on polymorphic type 'class ccar' with /GR-; unpredictable behavior may result
|
|
|
|
|
typeid depends on RTTI being turned on. RTTI is part of the language standard but C++ turns it off by default. Change your project settings to enable RTTI and you will get rid of the compile-time warning and the run-time exception.
|
|
|
|
|
that did it!!!!!!!!!!!!!1
thanks!!
|
|
|
|
|
you deference a pointer when you don't get the address it contains but when you get what is at the pointed address.
<font style="color:blue;">char</font>* pc = (<font style="color:blue;">char</font>*)malloc(<font style="color:blue;">sizeof</font>(<font style="color:blue;">char</font>)); <font style="color:green;">
*pc = 'a'; <font style="color:green;">
pc : simple pointer (cointaining an address)
*pc : dereferenced pointer (value at the pointed address)
TOXCCT >>> GEII power
|
|
|
|
|
Hi all,
Is there a way to respond to an external function call raised by another process without having to modify the callees's code?
Thanks.
|
|
|
|
|
the "raising" process must send its PID however you won't be able to know who sent you such message.
TOXCCT >>> GEII power
|
|
|
|