|
Hi Maxwell,
Thanks a lot for your detailed explanation.
Sarvan AL
|
|
|
|
|
I have a VC6 app (no manifest resource) which has a window with several children; The main part of the window is covered by a scrolling edit window (but with only a vertical scrollbar). The SB is 'blue' with etched horizontal lines, and is (presumably) done by the edit control non-client stuff as normal (it's a regular edit control).
I want to put several windows underneath the edit control, such as tab selection stuff (think Excel workbook), and a horizontal scrollbar under around half the window (again, think Excel).
However, when I create the scrollbar, it appears as a 'standard grey/gray' boring old scrollbar (not like the one in the edit window).
Is there a relatively simple way I can make it render in a more modern style? I'm presuming themes here, but being a retro kind of guy (hey, I have clients who still run Windows 95 and 98 ) I haven't done anything with them yet; any pointers, hints or samples welcomed.
Incidentally, does anyone have a link to the 'ThemeExplorer' sample mentioned in MSDN Oct 2001, which looks like it might be useful at some point?
(And yes, I am moving to VS2005, slowly. I didn't realise my code was so non-compliant with more recent standards...
Steve S
Developer for hire
|
|
|
|
|
Some times the SetWindowTheme() function may help u
nave
|
|
|
|
|
Um, yes, sometimes it might. I should, however, have checked that my manifest was being correctly compiled into the resources, which, as it turned out, wasn't, because I'd used what I assumed would be a predefined value for the ID, rather than '1'.
Irritatingly, the standard controls I was using (list view/richedit/tree) all had visual styles, so I didn't spot it straight away....
Steve S
Developer for hire
|
|
|
|
|
CString Str1 = "Some STring here";
CString Str2 = "Some thing here too";
if (Str1 == Str2)
{
}
Any problem using this comparison??? than using its member function to compare???
|
|
|
|
|
No, it works because the operators are overloaded. But be carefull it is a case-sensitive comparison.
For more details, see the MSDN[^]
|
|
|
|
|
On using the if(Str1==Str2)
You are comparing the pointers to character arrays.
That is you are comparing the memory addresses and not the string objects with overloaded comparison operators
Vision is Always important and so is your ATTITUDE.
Wishes.
Anshuman Dandekar
-- modified at 7:03 Friday 5th May, 2006
|
|
|
|
|
_AnShUmAn_ wrote: You are comparing the pointers to character arrays.
no. these objects are CString s, which class overload the operator==.
the code actually does :
if (Str1.operator==(Str2)) ...
but this doesn't work with C-Style strings
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
_AnShUmAn_ wrote: You are comparing the pointers to character arrays
Wrong, Str1 and Str2 are CString, not char*. CString class has an overloaded == operator which is equal to the Compare member function.
|
|
|
|
|
|
What actully compared..?? see the flow of calling sequence of functions
int Compare( PCXSTR psz ) const throw()
{
ATLASSERT( AtlIsValidString( psz ) );
return( StringTraits::StringCompare( GetString(), psz ) );
}
//for MBCS
static int __cdecl StringCompare( LPCSTR pszA, LPCSTR pszB ) throw()
{
return _mbscmp( reinterpret_cast< const unsigned char* >( pszA ), reinterpret_cast< const unsigned char* >( pszB ) );
}
//for Unicode
static int __cdecl StringCompare( LPCWSTR pszA, LPCWSTR pszB ) throw()
{
return wcscmp( pszA, pszB );
}
So finally what is the result..??
"const char *" are compared..
Knock out 'T' from CAN'T
You 'CAN' if you think you 'CAN'
|
|
|
|
|
No, no and no
Look at the code he provided !! We are talking about CString classes! Those classes have an overloaded == operator (geez, I think it will be the sentence I wrote the most today ) thus this code is perfectly legal.
And, in what you posted:
static int __cdecl StringCompare( LPCWSTR pszA, LPCWSTR pszB ) throw()
{
return wcscmp( pszA, pszB );
}
You think that this is equal to
return (pszA == pszB);
The content of the wcscmp function compare the contents of the pointers ! So there is a huge difference.
Did you understood the question in the first part ?
-- modified at 8:32 Friday 5th May, 2006
|
|
|
|
|
|
*be patient, everything will be fine soooon*
|
|
|
|
|
What i want to say that, The core functionality behind the == comparison
I aggred with Cedric Moonen that "The content of the wcscmp function compare the contents of the pointers"
The wcscmp function compares pszA and pszB lexicographically and returns a value indicating their relationship
Knock out 'T' from CAN'T
You 'CAN' if you think you 'CAN'
|
|
|
|
|
I think you didn't really understood what was going on because of the language (english, I mean). I didn't say that the == operator wasn't calling the compare function. The question was if there will be a problem if this is used in this way (with the == operator).
Now, how it is handled inside the class, we don't care (this is 'hidden' to the end user). The important thing is that it works .
Now when you say the the function compares the pointers (it is what I understood from your previous message) I say no! It's not because the Compare function receives the two pointers that it will compare the addresses.
So, I don't understand why you posted your previous message in fact .
|
|
|
|
|
The purpose of my previous post is just information what actually logic behind the comparison
Not to oppose to any one as you are doing.
And don't warry about my english
Knock out 'T' from CAN'T
You 'CAN' if you think you 'CAN'
-- modified at 9:32 Friday 5th May, 2006
|
|
|
|
|
inline int CompareNoCase(LPCWSTR lpsz) const
{
// ignore case
return _wcsicmp(m_pchData, lpsz);
} // MBCS/Unicode aware
is what the definition of the CompareNoCase function that can be found in chstring.h file.
So aren't we passing a char * to this function.
Vision is Always important and so is your ATTITUDE.
Wishes.
Anshuman Dandekar
|
|
|
|
|
I think you are missing the important point: we are not discussing about char arrays (so something like char* MyArray or char MyArray[5] ) but about CString classes (MFC classes), which is a huge difference. The CString class has an overloaded == operator (take a look at the link I supplied).
|
|
|
|
|
The == operator internall use the compare function
see the implementaion of operator==
_AFX_INLINE bool AFXAPI operator==(const CString& s1, const CString& s2)<br />
{ <br />
return s1.Compare(s2) == 0; <br />
}
so if wants to know if two strings are equal using compare function u have use like this
if( Str1.Compare( Str2) == 0 )<br />
{<br />
}
nave
|
|
|
|
|
I saw this coding in one sample...
My doubt is already "this" is a pointer.then why they use another pointer in this.
CTrans & CTrans::operator=(CTrans dData)
{
m_bClose = dData.m_bClose;
m_sData = dData.m_sData;
return *this;
}
|
|
|
|
|
This function is like a constructor where the values being passed are copied into the variables of the object with which this constructor is called.
So to reflect all the changes properly you need to take the values into a pointer and return 'this' for the same.
Vision is Always important and so is your ATTITUDE.
Wishes.
Anshuman Dandekar
-- modified at 9:29 Friday 5th May, 2006
|
|
|
|
|
Anu_Bala wrote: My doubt is already "this" is a pointer.then why they use another pointer in this.
It's because it is returning a reference so *this is required. This is called De-Referencing .
If the function was modified as follows
CTrans* CTrans::operator=(CTrans& dData)
{
...
return this;
}
This means we are passing the address of this class. Hence no *this is required.
Nibu thomas
Software Developer
Faqs by Michael dunn
|
|
|
|
|
i don't exactly understand your problem (english speaking i think), but here is what i can say about the subject :
in C++, each member function (the functions declared within a class receive an implicit parameter : the this pointer. here is why...
when you do such thing, the function has to know on which instance it works on :
CMyObject o1, o2;
o1.Foo();
how does the Foo() function know it works on the o1 instance, instead of o2, or even instead of any CMyObject object ? the solution : this .
the this type is a pointer to the class (here CMyObject* ), and can be also set to const if the function is declared as a const member (like void Foo(void) const; ).
once you know that, the question is "why does the operator= return *this ?"
here is the tip. you know that C++ allow such statements :
int a, b, c;
a = b = c = 1;
so the behavior should also be reproduced with classes :
CMyObject o1, o2, o3;
o1 = o2 = o3 = ;
which is equivalent to :
CMyObject o1, o2, o3;
o1.operator=(o2.operator=(o3.operator=( )));
the only way to do this is that each operator= return a reference to the object it has just altered so that the other operator= can get its new modified state.
do you understand better with this ?
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
How to sort the rows of CListCtrl depanding upon Particular column. Or Please tell me how to use CListCtrl::SortItems function for sorting.
|
|
|
|