|
To complete what CPalllini said: if you have a private constructor, you won't be able to derive a class from this class (the child class cannot access the constructor of the base class, so you'll have a compilation error). In both case, only the class itself (or derivate) can create an instance. The only way to do this is through a static function (because to be able to call a non-static function, you already need to have an instance).
|
|
|
|
|
Adding to other replies, private, protected access specifier acts the same way as with other functions; with private the member is not accessible outside the class, you can make this property useful in many ways;
modified on Thursday, April 24, 2008 5:29 AM
|
|
|
|
|
You know that if you provide any constructor (even one which is not the default), then the default constructor which is implicitely added by your compiler will be ignored ?
Try your code and remove the default constructor. Try now to construct an object by using its default constructor. You'll see that you won't be able to compile because there's no default constructor for the class.
|
|
|
|
|
Yes, You are correct, I should have compiled to remember it.
|
|
|
|
|
Hi All !
How do I create a tooltip (using CToolTipCtrl) for a CStatic member in a dialog ? for a CButton class member it works just fine but for the CStatic class member I get no tooltip.
Thanks,
Amit
|
|
|
|
|
Does your static control have the SS_NOTIFY style?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Hamid Hi !
Thanks for the link - it helped,
However, when I try to create it dynamically (using Create function) I get an error...
Amit
|
|
|
|
|
|
How can i copy a string (LPSTR) to a wide string variable (LPWSTR).
When i am assigning directly (=) i am loosing some data.
Thank you.
Saadhinchaali
|
|
|
|
|
Saadhinchaali wrote: How can i copy a string (LPSTR) to a wide string variable (LPWSTR).
When i am assigning directly (=) i am loosing some data.
You sure about that? Such an attempt will cause a compiler error.
LPCSTR pChar = "LPCSTR";
LPCWSTR pWChar = L"LPCWSTR";
pWChar = pChar;
Even if that made sense, which it doesn't, it would only copy the pointers.
Don't tell me you cast the problem away!
Show us some code.
Steve
|
|
|
|
|
Stephen Hewitt wrote: LPCSTR pChar = "LPCSTR";
LPCWSTR pWChar = L"LPCWSTR";
pWChar = pChar; // error C2440: '=' : cannot convert from 'const char *' to 'const unsigned short *'
sorry. I casted the problem away
LPCWSTR pWChar = (LPWSTR) pChar
Saadhinchaali
|
|
|
|
|
Saadhinchaali wrote: sorry. I casted the problem away
Don't! The compiler issues an error for a reason! Calling a dog a cat doesn't make it one!
Steve
|
|
|
|
|
Actually the compiler is happy about it (I suspect it enjoys such mistakes...).
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
|
|
|
|
|
Stephen Hewitt wrote: Calling a dog a cat doesn't make it one!
Too funny!
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Saadhinchaali wrote: How can i copy a string (LPSTR) to a wide string variable (LPWSTR).
They are quite different beasts, do you need to convert.
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
|
|
|
|
|
I suggest you try to understand the concepts that are behind by reading this series of articles[^]. At least, you will understand why you can't cast the pointers directly.
|
|
|
|
|
Hi,
U cannot directly cast a LPSTR to Widechar LPWSTR and if u do that u will lose data. use API MultiByteToWideChar to do it.
thanks
Nitheesh
|
|
|
|
|
Actually you don't loose any data. Anyway your conclusion is correct: there must be a conversion to get a corrensponding string as result.
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
|
|
|
|
|
I am to create a DLL utility which will read properties file i.e. similar like the log4j.properties.
Kindly please let me know how should I go about it.
Thanks.
modified on Thursday, April 24, 2008 3:06 AM
|
|
|
|
|
Please Help me out with my previous request.
|
|
|
|
|
Hi,
I have been running stackwalker under the Visual Studio Debugger and Even though I can see from the Threads => Call Stack display that I am Few levels deep (in the Stack)
After Just one Call to StackWalk the return Value is zero or I get a ERROR_INVALID_ADDRESS from GetLastError
indicating I am at the end of the Stack
Were as the visual studio debugger shows there stll many routines for that Thread
Do I have modify any of the parms to StackWalk before each call e.g. (esb or ebp register in the context parm)
to continue to the next Frame
P.S. I use SymGetSymFromAddr to get the sym->Name of the function after the Stack walker call
|
|
|
|
|
Sorry
to waste the time of all those who have been so helpfull to me
But I forgot to initilize the Stack Address did the Frame an PC forgot the third
|
|
|
|
|
Hi all,
I have two exe' one is in vc6 and one in vc2005.
I am running a vc6 exe through vc2005(using ShellExecute() api). Now what i want is that my vc6 exe should only run when it is called through vc2005 exe(i.e if i click on vc6 exe it should first check that vc2005 exe is calling it and if it is not calling it should not run...). I want to make a child-parent relationship between these two exe's.
How can i implement this??
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
what about a named synchronisation object. For instance VC2005 exe creates a named mutex and VC6 opens that named mutex and it continues to run only if it successfully opens the mutex.
|
|
|
|