Newbie about MFC

Dec 16, 2014 at 2:28pm
I am reading a program (MFC) and there is a lot of .cpp and .h files. I can't find where the code starts.
Normally, in C, it is main function and the code will do the first command in the main.
However, there is not main function here. (I can't find it)
Could you tell me how can I find out where the code is done first and to understand the program what should I learn?
I just know basic C and C++.
Dec 16, 2014 at 3:34pm
You probably want to look at CMainFrame::OnCreate() method and <Your application name>::InitInstance().
If you create an MFC project, stick a couple of break points in those methods and run you might see how the UI gets created.
If you have the sample pack:
http://msdn.microsoft.com/en-us/library/bb983962(v=vs.90).aspx

it's useful to have a look at some of those.
Dec 16, 2014 at 4:28pm
That was exactly the most important of quite a laundry list of negatives I had about MFC when I attempted to learn it many years ago, and the experience completely soured me on any type of class framework encapsulation of the Windows Api.
Dec 16, 2014 at 4:53pm
Thanks!
I have just looked at CMainFrame::OnCreate() and they are complex to me. The code has no comment.
Actually, at present I don't need to understand how the UI is built. It is an image processing software and I want to understand where the imaging process starts.
I can't find a main file.
Hope you could help me.
Dec 17, 2014 at 10:28am
Sounds like you dont need to know about the MFC side of things at all then.
Clearly, I've no idea where your image processing code starts though i'm afraid.
Dec 20, 2014 at 5:28am
I am reading the book Visual C++ and MFC Programming. It is interesting.
I am a bit confused. For example, when I write an MFC software for image processing.
When I click the START button, it opens a window to browse to the image for processing. After the image loaded, it is processed by some algorithm.
How can I find where the code for the image processing?
In C, the code should go right after image loading in main{} function but in MFC programming I don't know how can I find one and the order operation of events.
Dec 22, 2014 at 8:54am
Find the event handler code for your START button and trace the code path from there. That should be in the dialog class.
Topic archived. No new replies allowed.