|
Kwanalouie wrote: Thanks to all for the help.
You're welcome.
Kwanalouie wrote: The function in your reply should have been AfxGetMainWnd() and not AfxGetMainWindow()
Of course. Fixed: thank you for pointing out.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
hai,
what is the difference between bool and BOOL?
reply me..
Born to win...!
|
|
|
|
|
bool vs BOOL[^]
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
bool is a C++ keyword, BOOL a Microsoft alias for int :
typedef int BOOL;
Any variable declared bool can assume only the following two values: true or false , moreover C++ conditional expressions evaluates to a bool result (true or false ). On the other hand, a BOOL variable is a fully qualified int and hence can assume any numeric value an int can (MSDN suggest: it should be either TRUE or FALSE ).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
CPallini wrote: typedef int BOOL
not really
maybe
|
|
|
|
|
toxcct wrote: not really
You've gotta be kidding me. CPallini is correct.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Maybe both my local help and my windef.h file are wrong?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
May be toxcct is on drugs today for a change.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Rajesh R Subramanian wrote: May be toxcct is on drugs today for a change
come on, have you ever worked under linux ?
Microsoft IS NOT the standard, even if 85% of the PCs worldwide are windows based...
|
|
|
|
|
toxcct wrote: come on, have you ever worked under linux ?
Yes, why?
toxcct wrote: Microsoft IS NOT the standard, even if 85% of the PCs worldwide are windows based... [D'Oh!]
So, I don't get the point here. I have worked on development projects on fedora, debian and ubuntu. Linux does not have a BOOL datatype as far as I know. I say - BOOL belongs to Windows. Comments?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
toxcct wrote: have you ever worked under linux
What kind of drug is that ?
|
|
|
|
|
Cedric Moonen wrote: What kind of drug is that ?
i'd better give up there ! lol
|
|
|
|
|
I dunno. Azk CPallini. He'z da one who abuzez drug to answer queris realllly fazzt. He haz gud drugz and gud linkz. azk him plz.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
I supposed too.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
if you're coding in C, bool just don't exist (I prefer mention it, even it's obvious).
in C++, bool is a native type. it weights 1 byte and takes the values 0b00000001 (true ) or 0b00000000 (false ).
you can assign an integer to a bool . if it is different from 0 , it equals the value "true ", and will be automatically converted into 0b00000001 anyway.
BOOL is different. it is an enum type inherited from the old C days.
it's definition is like this :
enum BOOL {
FALSE = 0,
TRUE
};
An enum is actually an int , which mean it weights 4 bytes (on a 32 bits system).
apparently, Microsoft implements it in a different manner, so you have to be much more careful with it. for instance :
typedef int BOOL;
BOOL b = 4;
if (b == true) {
}
modified on Tuesday, May 20, 2008 9:50 AM
|
|
|
|
|
toxcct wrote: BOOL is different. it is an enum type inherited from the old C days.
it's definition is like this :
enum BOOL {
FALSE = 0,
TRUE
};
Where did you get this information from? Under Windows, BOOL is defined as an integer in Windef.h
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
humm, it was in the C days... but anyway, an enum is an int
|
|
|
|
|
I was just asking where was BOOL defined as an enum . Since the C days, BOOL is an int and even the latest Windows SDK, it is so, to have C compatibility. I have never seen BOOL being defined as an enum in the Windows world.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Rajesh R Subramanian wrote: in the Windows world.
man, we are not alone !
|
|
|
|
|
toxcct wrote: 0x00000001 (true) or 0x00000000 (false).
Uhmmmmmmmmmmm. Never seen a byte having so much hex digits...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
what ?????
doesn't a Byte having 8 bits ?
|
|
|
|
|
But it hasn't 8 hexadecimal digits. I.e. I was kidding about your binary numbers prefixed like hexadecimal ones.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
you're right, i fixed it.
|
|
|
|
|
toxcct wrote: doesn't a Byte having 8 bits
Yes, so it is coded 0x00 to 0xFF (hexa representation) or 0b00000000 to 0b11111111 (binary representation).
|
|
|
|
|
yes yes, fixed already
|
|
|
|