|
Hello!
May I use Windows XP icons in my application? I searched the Microsoft website, but couldn't find anything related to licensing their icons... Or are they free to use for anyone? I don't need them as application icon, I need them for some lists and toolbars...
Best regards
|
|
|
|
|
you has better alter the icon not fully the same as M$
or you may be some day charged with....
路漫漫其修远兮,吾将上下而求索。
|
|
|
|
|
|
I believe that distributing / using the icons that are distributed with the SDK is fine, but extracting one from a copyrighted application violates that copyright.
|
|
|
|
|
how can i get the number of instances of my clasess?
there is one way like we can declare a static member variable and increment that in the constructor, but if you create a derived object, that count also increases
in the base class. how can i prevent that ?
i need to get the count of parent objects only.
any idea?
Ninety-eight percent of the thrill comes from knowing that the thing you designed works, and works almost the way you expected it would. If that happens, part of you is in that machine.
|
|
|
|
|
just write two constructors function
路漫漫其修远兮,吾将上下而求索。
|
|
|
|
|
Decrement the counter by one in your derived class's constructor?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
|
can u write the code for that ???
Ninety-eight percent of the thrill comes from knowing that the thing you designed works, and works almost the way you expected it would. If that happens, part of you is in that machine.
|
|
|
|
|
class CBase {
static int m_iCounter;
public:
CBase() {
m_iCounter++;
}
virtual ~CBase() {
m_iCounter--;
}
};
class CChild : public CBase {
};
now, you could do this :
void foo() {
CChild myChild1;
CChild myChild2;
{
CCHild myChild3;
}
myChild1.~CChild();
}
when the program goes out a scope, the objects destructor is automatocally called.
for a CCHild object, the CCHild destructor is firstly call, then its CBase destructor...
was it well what you wanted ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Writing a virtual destructor for a base class is generally a good idea, but is not absolutely necessary for this application.
That apart, my interpretation of the OP's question was that he wanted to count only explicitly created instances of CBase, that's why I suggested decrementing it in derived class constructors.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
hey how it is possible?
how can i say other ppls to decrement parent clasess counter in your clasess?
i need to maintain my class as an entity, i just need to know the number of instances of my base class
Ninety-eight percent of the thrill comes from knowing that the thing you designed works, and works almost the way you expected it would. If that happens, part of you is in that machine.
|
|
|
|
|
class Base
{
protected:
static int counter;
public:
Base() { counter++; }
};
int Base::counter;
class Derived : Base
{
public:
Derived()
{
counter--;
}
};
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
How can I convert a string to an ASCII value and then store it in an element of a char array? For example, I'd like the 30 to be stored in element[18] of the array. This is what I have. Thanks!
char array[20];
array = "Supernatural";
CString str = "40";
strcpy(array[18],str); error C2664: 'strcpy' : cannot convert parameter 1 from 'char' to 'char *'
|
|
|
|
|
str.GetBuffer will work!
路漫漫其修远兮,吾将上下而求索。
|
|
|
|
|
You can't. It's not possible to store a string as an element in a character array. Maybe what you're looking for is an array of char * ?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
yes he can. CString class provides a LPTSTR cast operator...
so using strcpy() is possible as it uses this way 2 char arrays...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
No he can't . It's not possible to store a string as an element in an array of characters. From what I understood, the OP wants to do this
char arr[20] = "Senthil";
arr[5] = "Kumar";
which isn't logically possible.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
oh yes, i did this it like this. i saw (arr + 5) = "Kumar"; which would mean writing from the 5th position in the array.
but ok, you're right, i appology.
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Yes, I do have an array of characters. I need to convert the ASCII value which is currently a string value to an ASCII character. Then store that ASCII character into the 18th element of the array. How do I go about doing that?
|
|
|
|
|
Are you talking about this:
CString str = "40";
array[18] = atoi(str);
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
elephantstar wrote:
array = "Supernatural";
What is this, other than a syntax error? If you want array to contain the string literal, use either of:
char array[20] = "Supernatural";
...
char array[20];
strcpy(array, "Supernatural"); elephantstar wrote:
strcpy(array[18],str);
The error message tells you exactly what the problem is. array[18] is a char , but the first parameter of strcpy() is supposed to be a char* .
Why are you using char in such a fashion? If this is an MFC application, use CString . Mixing the two types is seldom necessary.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I want to store the value of CString str into the array.
vtValue.ChangeType(VT_BSTR);
str = (LPCSTR)((_bstr_t)vtValue.bstrVal);
Then I want to store the exact same data type into array[18].
Yes, it is an MFC application. I'm using char so that I can manipulate the data in each element easily.
|
|
|
|
|
elephantstar wrote:
vtValue.ChangeType(VT_BSTR);
str = (LPCSTR)((_bstr_t)vtValue.bstrVal);
What's with all of the BSTR and VARIANT stuff? Is this part of the original problem?
elephantstar wrote:
I'm using char so that I can manipulate the data in each element easily.
CString objects can be manipulated just as easily.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Sorry, I should have included the rest of the code. I'm using ADO to query some values.
CString str, str2;
_variant_t vtValue;
vtValue = t_Rec->Fields->GetItem("NAME")->GetValue();
vtValue.ChangeType(VT_BSTR);
str = (LPCSTR)((_bstr_t)vtValue.bstrVal);
Instead of using char array[20], you're suggesting I just work with CString then. But if I do use CString, the following code fails. What am I doing wrong? Thanks.
vtValue = t_Rec->Fields->GetItem("NUMBER")->GetValue();
vtValue.ChangeType(VT_BSTR);
str2 = (LPTSTR)((_bstr_t)vtValue.bstrVal);
char x;
x = atoi(str2);
str.GetAt(18, str2);
|
|
|
|