|
sorry its tricky but:
Cc1::M1() is identical to Cc2::M1() ...
the only "data" some Mi() uses is the "this" pointer
Cc1::M1() { code m1 }
Cc2::M1() { code m1 }
... etc..
Cc1::M3() { f_calculate(this); ... }
Cc2::M3() { f_calculate(this); ... }
...
modified 5-Jan-17 10:54am.
|
|
|
|
|
The code in that form usually had a function to push/pull the class or object into and back off a stream. You would know the process if you are familiar with C# as serialization.
Microsoft has provided a bit more support and safety doing in C++ with MFC and the DECLARE_SERIAL macro which is the same as your MACRO.
Serialization: Making a Serializable Class[^]
It's still pretty much done the same way, you should have two constructors on the objects one of which has no parameters?
Just look into the code and check if the serialization is still used?
In vino veritas
|
|
|
|
|
?? stream?
don´t understand because I don´t us a stream
but do ou mean, that these horrible MFC macros came up because of th same problem?
|
|
|
|
|
What is written looks very much like the way you do serialization in C++
Serialization - Wikipedia, the free encyclopedia[^]
Read the article there are a number of reasons why you may want to serialize code from transmission thru, time based processing thru to encryption protection of code.
You will note within the article they talk about C and C++ not having serialization but you can do it with a sort of standard form. Your code looks to me like that standard form. MFC has the same setup because it has serialized classes and even that is discussed in the wiki article.
Note MFC's main reason for serialization: "The technique is called differential execution. It is useful in the programming of user interfaces whose contents are time-varying — graphical objects can be created, removed, altered, or made to handle input events without necessarily having to write separate code to do those things."
You were saying you don't know why the original code was written like that and they won't let you change it. If you need the serialization it would indeed break the program if you write it a different way.
So I am suggesting you check if the code is indeed doing serialization. If it is and that serialization is still needed you can not change it even if you wanted to.
In vino veritas
modified 9-Jul-16 0:34am.
|
|
|
|
|
maybe I got now what you talk about
"Changing the class is not possible when transfered via serial... because of reconstruction is dependent of class structure"?
OK, this doesnt happen here, there is an extra struct that holds data to store and load.
What I know is, that the code was extended within years, adding more and more features to the software. The derived classes have more features and do some different calculations
e.g. B::M1() ... used in B, Ca1, Cb1 also Ca2, Cb2 ... ect is different to Cc1::M1(), Cc2::M1() ... etc.
|
|
|
|
|
an example:
We have animals, cats and dogs
class animal()
{
OpenMouth() ;
breath_in();
breath_out();
}
class cat() : public animal
{
play_with_wool();
}
class dog() : public animal
{
hunt_cats();
}
class mops1() : public dog
{
get_fat_and_fart()
}
class mops2() : public dog
{
get_fat()
}
class greyhound1() : public dog
{
run()
}
class specialdog() : public dog
{
run_fast()
}
now we want to extent _some_ dogs to know how to barf()
for barf() we need some unctions of animal() (not all)
barf() { breath_in(); OpenMouth(); dosomething(); }
How can we add barf() to some (eg. 20 different dogs, and also some wolfs) without changing parent class structure?
class greyhound1() : public dog
{
run()
barf();
}
class specialdog() : public dog
{
run_fast()
barf();
}
class greywolf() : public wolf
{
barf();
}
and next step: we have not only barf() we have 20 new extends for these aimals.
It would mean: add these 20 functions to each animal seperately?
|
|
|
|
|
If I understood the question, the best method is using macro at header in derived classes and implementation in those cpp side (these must be different right?).
|
|
|
|
|
yes, they are different or use one member in this functions that is diffrent.
The functions to add itself are same to all, but refer to prior defined methods, functions or class members
macros is the WORST madhog (method) ever.
I know this because im now in task to remove all these mass of macros (1 - 10 pages long)
not debugable, now intllisense, you wont find anything.
in addition the advantage of OOD /OOP has been destroyed with these macros because a lot of not used things were copied because the developer didn´t know whats in there anymore (stupid copying)
Ther must be a smarter better way, hopefully
|
|
|
|
|
In my (otherwise) high DPI aware MFC application, I use a ribbon bar as the primary interface. I've provided high resolution (48x48) image strips, but when displaying on a high DPI (4k) monitor, these are not used.
I know I can trap a message when the DPI changes, and use this to rescale UI items (I do this for a few owner drawn aspects already to increase the font size), is there any way I can force CMFCRibbonBar to use the High DPI images?
Thanks,
Paul
|
|
|
|
|
Can i somehow get Version of Internet Explorer with mfc?
Have anybody some code example?
|
|
|
|
|
|
Thank you. that helped me.
|
|
|
|
|
The Free Compiler package offered by Microsoft, appears not to include MFC. Any ideas as to get access to MFC.
Regards,
Bram
Bram van Kampen
|
|
|
|
|
Google is your friend: MFC MBCS DLL Add-on[^]
If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack.
--Winston Churchill
|
|
|
|
|
Thanks,
It only suggests what I should have done at Install Time!
Tried again
a five hour re- install did not offer this option!
Bram van Kampen
|
|
|
|
|
MFC is (and was) only included with full Visual Studio versions.
So you have to install a full version (e.g. the free Community version) if you need MFC support.
|
|
|
|
|
Well MFC is Crucial to me,
How do I do that.
Thanks,
Bram van Kampen
|
|
|
|
|
|
MFC is included in Visual Studio 2015 community edition which is free.
MFC and ATL[^]
You can create MFC or ATL programs with Visual Studio Community Edition or higher. If you do not select these components when you first install Visual Studio, you will be prompted to install them the first time you attempt to create or open an MFC or ATL project.
The link to download VS2015 community is right there for free.
Visual Studio Community 2015 with Update 3 - Free
Downloads | Visual Studio[^]
In vino veritas
|
|
|
|
|
Well Guys
Got It!! Took me a While
Thanks!
Now I have to learn the Interface!
Bram van Kampen
|
|
|
|
|
Hello there. I am trying to encode some audio to mp3 format using libavcodec. This small utility was working fine untill lately. Now it has started giving me this weird runtime access violation reading location exception. I am showing following code to give you an idea
int ret = avcodec_encode_audio2(mp3_codec_context, &pkt, frame, &got_output);
When I debugged...I can see that none of the specified arguments are NULL . So, how do I know what is wrong and where ? Thanks for any input.
|
|
|
|
|
Well,
Were the Working Dll's Upgraded recently. Because it worked in the past, but no longer now, that is a very distinct possibility.
Regards,
Bram.
Bram van Kampen
|
|
|
|
|
An access violation is not only thrown when a memory pointer is NULL . Often NULL pointers are even allowed as arguments.
In your case you have to check the members of the passed structures. See the documentation for the used function: FFmpeg: Encoding[^]. There is information about the structure members and links to the structure type descriptions. Note that you must not only check the buffer pointer members but also the size members and probably others. An access violation may for example occur when the size member indicates a size larger than the real buffer size.
The above link indicates also that the function is deprecated. If you have upgraded to a new FFmpeg version, consider to use replacement functions.
|
|
|
|
|
You have pointers to structures AVPacket and AVFrame and got_output
You may have
1.) Changed the structures
2.) Changed the compiler settings for packing of structures. Making the structure not what the DLL expects
You sort of say get_output is an int but that isn't what the documentation says.
Finally you have a return error in ret .... what does it return? Things like invalid parameter will tell you more.
In vino veritas
|
|
|
|
|
im my textbook , i was told that you daclare an array as follows:
type var[size];
where size is constant and cannot be changed later.
but if i run this :
int a[2];
a[3]=10;
cout<<a[3]<<endl;
it does not give any error and prints:
10
how is this possible.. because the size of the array was 2!! ??
please help me understand.
|
|
|
|