and the then kicking of the constructer via myeventptr->MyEvent::MyEvent(....);
is this going to create the object for me ???
You really don't want to do that. Pallini probably has the solution you should use but what you described is covered in C++ with Placement new[^]
As always I strongly recommend novice C++ developers not to make stuff up. There exists an enormous amount of information freely available on the internet. Use it or make up your own stuff, it's your choice.
class Myevent : public CEvent
static Myevent& GetMyEvent();
// Make the constructors and destructor private
Myevent& operator=(Myevent const&);
Thanks for the references, I'm ordering one ASAP. I'm aware that I could explicitly invoke the base class' method beforehand, I was looking for a way to make the invocation implicit, and the base class' method is invoked after the derived class' method. Something like this:
The scope of that question is far to large to discuss in a forum which is why I referred you to other sources. However a quick couple of points I will provide are; 1) your notion of calling the base class method after the Bar method. Notice in my posted example the base class is called first. That is because in your posted code the Bar method frees the memory.
void DoSomething(void *p)
Calling the Foo method after that would result in the Foo method having an invalid pointer.
2) Also using void pointers is NOT Best Practice. Strongly Typed code is preferable.
Anyway all of these types of problems are covered in materials such as the ones I pointed you at. How do you think I know about them? I didn't invent anything you know, I learned from others.
The second problem is simply a problem with my example. I was in rather a rush, so apologies for causing the misunderstanding. I hadn't thought about the first problem though. You're right; the base class' method should be called first. But is there any way to make this call implicit?
Not sure how to respond to that. If you have to do something to make it happen then it can't be implicit can it? If they made that implicit, then you would have to do something to eliminate the base being called. It seems the current way is more obvious therefore easier to understand, yes?
What I mean is this. Normally, when the derived class' method is called, the base class' method is not. What I'm looking for is how to make the base' class method be called, and then the derived class' method
Example: I call Bar->DoSomething((void *)0x12345), the parameters are pushed onto the thread's stack, and Bar::DoSomething is invoked. I want the parameters to be pushed, Foo::DoSomething to be called (the base class) and then Bar::DoSomething to be called (the derived class) automatically
If it helps, a little background. I have a Stream base class. It has a LinkedStream property, which refers to a Stream pointer. When I call Stream::Write, I want to call LinkedStream->Write beforehand, then pass the arguments to the derived class' write method
I want the parameters to be pushed, Foo::DoSomething to be called (the base class) and then Bar::DoSomething to be called (the derived class) automatically
Then write your own language and compiler that will do that I guess. I terms of C++ it's like you are saying you want up to be down. That's just to bad for you because it isn't, period.
However I would also point out that it seems you are making a big deal out of nothing. In your background explanation with streams, if your derived class just calls the base first it results in the runtime behavior you describe.
I've got a few extensions I need to add to the registry so when the user is exploring via windows explorer they will see a default icon I've created for the extensions. I've already created a script to register the 'display description' (ie: '.htm' file extensions are described with 'HTML Document'). That, I have working.
What keys do I need to create in order for an icon to be displayed for the file. (By default, the 'Unknown Document' is shown.) I want to display my own icon. All the sites I've explored during my research only mention how to change existing registry entries.
I need a .reg file because the app is going to be deployed.
Will I need to create a CLSID or use one from the App that has been created? I'm thinking I'm going to need 2 or 3 registry entries in order to get this to work but I don't know where to start.