|
Thanx a lot ,,Prasad...
dynamic cast was not required
This is enough:
CTreeCtrl* pCtrl = (CTreeCtrl*)(CWnd::FromHandle(HandleToTreeView));
NeWay thaks a lot again.....
SYAMLAL
|
|
|
|
|
SyamlalS wrote: dynamic cast was not required
This is enough:
CTreeCtrl* pCtrl = (CTreeCtrl*)(CWnd::FromHandle(HandleToTreeView));
This works, but C++ standard encourages using dynamic_cast or other operators(reinterpre_cast,static_cast ) . And old function style casts should be avoided wherever possible.
|
|
|
|
|
Hi!!!
I have one simple question..
How i can compare strin..
code is
if(x1.compareNocase(s1 || s2)
{
do something
}
Here if x1 is equal to s1 or s2 then do something in my code..
How i can compare..??
as in || is right or wrong??
Shah Satish
|
|
|
|
|
Hi,
You trying to be too fast
if ( x1.CompareNoCase( s1 ) || x1.CompareNoCase( s2 ) )
{
...
}
-----------
Mila
|
|
|
|
|
I have code..
If(Loopname.CompareNocase(x1)==0 || Loopname.CompareNocase(mytext->contents)==0).
but its not working
|
|
|
|
|
Hi,
hm... interesting - and what type are x1 and mytext->contents -> is it CString too ? (I'm thinking about e.g. you use VS2005 where default is UNICODE defined and you try to compare default CString with char *)
Besides you can check what exactly return particular comparing functions (if equal should returns NULL)
-----------
Mila
|
|
|
|
|
Shah Satish wrote: but its not working
What is this supposed to mean? If one of the calls to CompareNocase() is returning a non-zero value, which you have yet to verify, that indicates the strings do not match. Whether the strings match or not, your code is syntactically correct.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Shah Satish wrote: if(x1.compareNocase(s1 || s2)
{
do something
}
if ((x1.CompareNoCase(s1)== 0) || (x1.CompareNoCase(s2)== 0))
{
}
Shah Satish wrote: as in || is right or wrong??
Here it is wrong, using your way.
|
|
|
|
|
I have code..
If(Loopname.CompareNocase(x1)==0 || Loopname.CompareNocase(mytext->contents)==0).
but its not working..
|
|
|
|
|
Shah Satish wrote: but its not working..
Means what ?
Can you try modifying it to,
If( (Loopname.CompareNocase(x1)==0) || (Loopname.CompareNocase(mytext->contents)==0))
{
}
|
|
|
|
|
No..Not modified..This is my actual code..But i dont know its not working.
|
|
|
|
|
ie only one case is wroking properly..Both together is not working..
If( (Loopname.CompareNocase(x1)==0)---This is working
(Loopname.CompareNocase(mytext->contents)==0))--This is working
If( (Loopname.CompareNocase(x1)==0) || (Loopname.CompareNocase(mytext->contents)==0))--But together is not working..
|
|
|
|
|
you are using a logical OR operator, which returns TRUE if one of the 2 operands is TRUE. so if its 1st part (1st comparison) is TRUE, then the 2nd one is not executed...
are you sure you want to use a OR ? don't you need a AND ( && ) instead ?
|
|
|
|
|
Ya..I have to use only "or" function..
but among them one is pointer and one is string..
mytext->contents is a pointer..
as in
AcDbMtext *mytext ;
mytext->Contents;
If( (Loopname.CompareNocase(x1)==0) || (Loopname.CompareNocase(mytext->contents)==0))
x1 is cstring and (mytext->contents)is a pointer..
what to do?? How t compare it?
|
|
|
|
|
Loopname is a CString, right ?
then look at the signature of CString::CompareNoCase(). it gets a PCXSTR parameter (so, pointer to char).
so ther's no problem in doing so.
if your code doesn't work, it is because of what i notified you previously. have you tried inverting the two statements in the OR operation (C-style string compared first) ?
|
|
|
|
|
Shah Satish wrote: But together is not working..
What does this mean ?
Remember, Loopname.CompareNocase(mytext->contents) will not be called if Loopname.CompareNocase(x1) returns 0. (or rule)
|
|
|
|
|
mytext->contents is a pointer..
as in
AcDbMtext *mytext ;
mytext->Contents;
what to do?? How t compare it?
|
|
|
|
|
you didn't read the answers
|
|
|
|
|
What you've shown in now way indicates that contents is a pointer. While mytext is indeed a pointer, you've shown nothing of its contents member. If contents is indeed a pointer, what's it a pointer to?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Ya..I have to use only "or" function..
but among them one is pointer and one is string..
mytext->contents is a pointer..
as in
AcDbMtext *mytext ;
mytext->Contents;
If( (Loopname.CompareNocase(x1)==0) || (Loopname.CompareNocase(mytext->contents)==0))
x1 is cstring and (mytext->contents)is a pointer..
what to do?? How t compare it?
|
|
|
|
|
Come on Satish !
You are still not reading answers well and replying to our queries well.
1. What does not working mean ? You need to be very clear.
2. Have you taken in to consideration when using || operator second operand will be looked only when first is false ?
Shah Satish wrote: x1 is cstring and (mytext->contents)is a pointer..
It should not matter here.
|
|
|
|
|
Hi Prasad !!!
I am sorry for delay..The ocde is exactly right n its working now..The problem was in my software...But now its working properly..
Thanks man !!!
Shah
|
|
|
|
|
if this does not work, split the CompareNoCase and the if in different statements and debug each statement separatly.
bool b1 = (x1.CompareNoCase(s1)== 0);
bool b2 = (x1.CompareNoCase(s2)== 0);
if ( b1 || b2 )
{
}
|
|
|
|
|
Hi Maximilien !!!
I am sorry for delay..The Code is exactly right n its working now..The problem was in my software...But now its working properly..
Thanks man !!!
Shah
|
|
|
|
|
When I create a child frame and close it, a memory leak is reported in the output window as follows:
"childfrm.cpp(44) : {2414101} client block at 0x01AF7A00, subtype c0, 444 bytes long."
I would like to know what is possibility for this leak.
I am initializing only one bool variable in the constructor of child frame class.
I am having some user-defined functions in child frame class with return type LRESULT,
and a CSplitterWnd object which is used to create panes with CreateStatic() and CreateView() methods.
Is there any chance for leak from CSplitterWnd.
Is there function to delete the panes created by the splitter.
Any help would be greatly appreciated.
Thanks & Regards,
Suman
|
|
|
|