|
Can u please make it a bit clear in "turn off the User Access Control [UAC]"....
|
|
|
|
|
Why is it people always gravitate toward the option that I didn't recommend?
Turning off UAC is as simple as going to "control panel", "User Accounts", "Turn User Access Control on or off".
However, the system will keep reminding you eternally that your security settings leave you vulnerable. Turning off UAC is really only useful for a simple test to see if your programmatic behavior/problem is related to UAC. You should not design your application with the requirement that the user set their security settings in any particular fashion.
The Microsoft endorsed way of properly designing an application for UAC is to use a security manifest section in your manifest file/resource.
Windows Vista Application Development Requirements for User Account Control Compatibility[^]
Create and Embed an application manifest[^]
Certified for Logo Test Case[^]
|
|
|
|
|
I want to duplicate an object, knowing only a base object and the type_info
In following sample, with function DuplicateObject(.), I want to duplicate an object pVarA.
Does anybody have an idea ?
Best regards.
//*****************************************************
class classA
{
public :
classA( string MyComment)
{
_MyComment = MyComment;
}
string _MyComment;
};
//*****************************************************
class classB : public classA
{
public:
classB( string MyComment, string MyOtherComment)
: classA( MyComment)
{
_MyOtherComment = MyOtherComment;
}
string _MyOtherComment;
};
//*****************************************************
void DuplicateObject( classA *pVarA, const type_info& pType)
{
static_cast<ptype> *pVarB = new static_cast<ptype>( ""); // !!! problem
*pVarB = *pVarA; // !!! problem
}
//*****************************************************
void func()
{
// dupplicate object of same class (classic)
classA *pVarA1 = new classA( "hello world !");
classA *pVarA2 = new classA( "");
*pVarA2 = *pVarA1;
// dupplicate object of heritance (problem !!!)
classB *pVarB1 = new classB( "hello world !", "come on !");
DuplicateObject( pVarB1, typeid( pVarB1));
}
|
|
|
|
|
Please read the posting guidelines before posting (formating of your code).
Do you want to clone an existing object, is that right ? If that's what you want, why don't you simply provide a virtual virtual Clone function in the base class that you redefine for the child classes:
classA* classA::Clone()
{
return new classA(this);
}
classB* classB::Clone()
{
return new classB(this);
}
If your classes contains more than simple data (e.g. pointers) you will need to provide a copy constructor in order to adapt it to your need. Otherwise the Clone function will be enough.
|
|
|
|
|
Why not just provide a copy constructor and be done with it? I don't understand the need for a ::Close() function.
|
|
|
|
|
If you have polymorphic types in a container and want to duplicate them (or some of them), you don't know the exact type of the object. So, if you have a virtual Clone function, you can simply work with the base class and call the Clone function to have a duplicate of the correct type of your polymorphic object.
Of course, this is used in very specific cases only
Gary R. Wheeler wrote: ::Close() function
It's a Clone function
|
|
|
|
|
Okay, okay. It's only 4 keys away on the keyboard...
|
|
|
|
|
Cédric,
Thank you for your answer.
But I think it's more difficult.
classA is the base class for all my messages (objects exchange through mailslots).
classB, classC, etc have herited from classA (they are more sophisticated messages).
My function called "Duplicate" function is in reality a function to send a message of classB, C, etc to SEVERAL mailslots (several destination).
So, I want to "give" my sophisticated message reference with its type (which is typeid( xVar)) to my function, wich will do a loop in order to duplicate the given message as necessary as to send it to ALL the mailslots.
It's the destination thread which delete the object after processing.
So, I want to "clone" the object, but the parameter of the function is of type "classA" (which is common to all types), and the type is only known by TYPEID.
Is there a possibility to do that ?
Best regards
|
|
|
|
|
Ok,
Now I have understand the mechanism.
Only a small detail : all the Clone() methods needs to have the same return type. So it's necessary to cast the returned result :
class classB : public classA
{
//...
}
classA* classA::Clone()
{
return new classA(this);
}
classA* classB::Clone()
{
return (classA *) new classB(this);
}
Thank you.
|
|
|
|
|
Hi, sorry for the late answer but I was in holidays.
marcelcerdanjunior wrote: Only a small detail : all the Clone() methods needs to have the same return type. So it's necessary to cast the returned result :
Not necessarily, you can use a 'covariant return type', which means that your classB::Clone method can return a classB* (because classB inherits from classA). Anyway, you never need to cast classB into classA: classB IS already a classA object.
|
|
|
|
|
Dear All,
My project requirement is VC++ application need to create setup package and deployment in VC++ with out using dll file(im having exe file only).
It will be much helpful to me to give some advice on this..
Thank you very much,
Yours,
Anitha
|
|
|
|
|
u looking for NSIS[^] or use Installshield.
Or do you want to create an application installer?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
I have developed a MFC application.I need to create a setup pack for that application.
Thanks & Regards
Anitha
|
|
|
|
|
then you can use NSIS or installshield. Even with visual studio you can create setup and deployment project
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
We use Inno Setup[^]. It is a very good freeware installer.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Hi sashoalm,
I red that innosetup document.That installation document given for Visual C++ 6.0.But Im using Visual Studio 2005.Is it possible for Visual Studio 2005.
Thanks & Regards
Anitha
|
|
|
|
|
Yes, it is possible. You just have to create an iss file and specify in it which files are part of the setup.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Hi sashoalm,
I have created the setup package.But i need to install a driver before the exe file execution. Is it possible?
Thanks & Regards
Anitha
|
|
|
|
|
hi
in my application i have one dll ,and 3 views.
when user clicks on one view --dll function is called(mapped to dll fun)
from that function i nead to send message to other view or same view..how to doit can any one give hint....
|
|
|
|
|
|
thats not correct...un related article u sent..
|
|
|
|
|
Hi all
I need simple time example on dailog.Plz help me
|
|
|
|
|
This link[^]"> will be of little help...
Regards,
Rane
|
|
|
|
|
Thx's for link
I want to use timer for update DoModal() dailog.Can you help me..
void Crtdlg::Ondo()
{
CT dlg;
dlg.DoModal();
}
And i want to update this dailog every 5mins..
Plz help me
|
|
|
|
|
knowvc wrote: Can you help me..
Have you bothered to look at SetTimer() ?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|