473,406 Members | 2,217 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Regarding a project in VC++

lifeisgreat20009
I have just started learning VC++
We have seen how to make a simple applications such as a dialog box or making split windows and displaying Hello World ! etc.....
We have seen how MFC creates lot of source code all by itself and have to just make minor changes and additions.........
I was just curious to try some of the applications freely available on internet....
I downloaded some of the applications such as a simple screensaver, a bitmap displayer, an alarm application , etc.................

But when I saw the files of the applications, I just couldnt understand them as there was no comments, no explanation etc....
I mean ofcourse I am familiar with C/C++ etc......
But with MFC its diff....
The thing is that when I open the source files of a particular application then how will I know that what lines of code have been generated by MFC and what lines of code has been written by the user ??????
Aug 13 '08 #1
4 1383
weaknessforcats
9,208 Expert Mod 8TB
I assume you know that MFC is very obsolete and poorly designed. It's just a crude wrapper for Win32. I makes only the classic windows which aren't used that much anymore.

Some oddities:
1) the entire MFC application executes inside the default constructor of a global object whose type s CWinApp. There is a main but it is a null function.
2) there are no virtual functions. Because the hierarchy is 9 levels deep in places, the memory occupied by the VTBLs was considered way too big. So virtual functions were outlawed and a MESSAGE_MAP macro was invented. Here you get to code the VTBL stuff manually. Neat.
3) there is poor encapsulation, many classes like CString, expose their private data variables while others just have public data
4) Microsoft has never upgraded this product. It's still at version 1.0 when it was relaesed for Windows95.

Currently, most windowing code is written using ATL or .NET.

If you have a choice, I recommend you abandon learning this.
Aug 13 '08 #2
Studlyami
464 Expert 256MB
Microsoft has never upgraded this product. It's still at version 1.0 when it was relaesed for Windows95.
Not entirely true. They made some minor changes to MFC when VS2005 came out. With 2008 they said they have added/updated the MFC libraries quite a bit. I haven't got a chance to use the updated library yet, but here is Microsoft page about some of the updates. I'm sure all of the other flaws are still there, but they did upgrade the library. Also ATL uses CStrings and I believe (may be wrong) it is the same class as the one used in MFC. If you want to work on window apps I would work with C# to start and move on from there. There are still a fair amount of companies that have old software that uses MFC and you can still get a job doing MFC programming, but they are disappearing fast so don't rely on it.

I'm not quite sure what you mean what code was generated by MFC. On an initial project MFC generates some files. Then you can have MFC add code into the project for you by using some different wizards, but it adds very little code. For example if you double click a button on a dialog it automatically adds the button to the message map and generates the function call for you. This takes <1 min of code to do manually. It would be hard to tell if the user type the code manually or if MFC generated the code. Maybe I'm understanding you wrong. Could you could point to an example?
Aug 13 '08 #3
Not entirely true. They made some minor changes to MFC when VS2005 came out. With 2008 they said they have added/updated the MFC libraries quite a bit. I haven't got a chance to use the updated library yet, but here is Microsoft page about some of the updates. I'm sure all of the other flaws are still there, but they did upgrade the library. Also ATL uses CStrings and I believe (may be wrong) it is the same class as the one used in MFC. If you want to work on window apps I would work with C# to start and move on from there. There are still a fair amount of companies that have old software that uses MFC and you can still get a job doing MFC programming, but they are disappearing fast so don't rely on it.

I'm not quite sure what you mean what code was generated by MFC. On an initial project MFC generates some files. Then you can have MFC add code into the project for you by using some different wizards, but it adds very little code. For example if you double click a button on a dialog it automatically adds the button to the message map and generates the function call for you. This takes <1 min of code to do manually. It would be hard to tell if the user type the code manually or if MFC generated the code. Maybe I'm understanding you wrong. Could you could point to an example?

As I have told you I am just a beginner to VC++...I am a college student and I HAVE to develop a project using MFC .....
Our lecturer has asked us to download any MFC based application , study it and explain it to the external examiner...
Plz have a look at the image below.......
Green Arrow is pointing to my running application and red arrow is ponting to the code.......





now in this code which I got from internet , how would I know that which lines of code have been generated by MFC's wizards and what lines of code has the developer written by himself ?????
I mean what would I explain to the examiner ???
Our teacher said that we dont have to explain the code line by line....
As there are no comments in the code so I am not able to make out that what would I say to the examiner that which are those lines of code that have been added manually ?????
I mean what would I tell him that which are those function or func calls that have automatically been included by MFC wizards and which are the ones that I have manually typed ????
Aug 14 '08 #4
Studlyami
464 Expert 256MB
This would depend if the examiner was a programmer or your average joe which knows nothing about programming.

In either case as far as MFC generated code goes I would explain which files are created by default and what they do. Then i wouldn't mention items which may have been added by a wizard (unless this was a specific requirement). I would break down the code into functionality. What file does what and how it works. I would spend a lot of focus on the message map and how the MFC controls are used. These are the key elements of the program.

EX: looking at the screen shot you provided there is a couple of buttons (how does he capture button clicks and what does the function do).
There are a couple of spin controls (again look at what he captures for the spin control and explain the what the function does when he captures the message)
Looks like there is a bitmap on the dialog what does he use to draw it.
Notice that the maximize is missing on the menu bar. Where does he remove that capability and how?
The icon and title to the window is different. Locate and state where he does that.
Then you can describe how he handles the time and how the program detects when the alarm goes off. When the alarm goes off it probably plays a sound file, locate that portion of the code and state how he handles those portions.

*NOTE* that is just an example based on limited information about the assignment, but from what you said thats how i would approach it.
Aug 15 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Kanaiya | last post by:
how to use c# dll into visual c++ project. With regards, Gangani Kanaiya.
8
by: Paul | last post by:
Hi all may I know how to use C# DLL inside my VC++ Project ? Thanks in advance.
11
by: Raghavendra Mudugal | last post by:
Hello Everybody, We are creating a new project on Virtual Private Networking (VPN), and it is decided to use VC++. I actually want to know that is can be achived by VC#.NET or not. You all know...
2
by: kalyan. | last post by:
hello, i am working on WMA SDK. i got the SDK from Microsoft under source development agreement . The SDK has the project of WMA 9.1 built in VC 7.1 As i dont have VC 7 i found a tool to convert...
3
by: Cl?udio | last post by:
Hello, With the advent of all work being performed regarding the WS-* standards, some of them already implemented in the .NET platform with the release of WS 2.0. Since my Web Services platform...
0
by: Vijay | last post by:
I m trying hard to create an activeX control that will be having an datagrid control in VC++ 6.0. My Approach: I am creating a project of type MFC ActiveX control wizard. Adding a dialog to the...
0
by: parekh | last post by:
Hi All , I am facing a problem wherein my VB project is not recognizing a change in the argument list of a method ( the method itself being declared and defined in another VC++ project and it...
1
by: Art | last post by:
I have to use Windows Forms(Managed C++) and also existing VC6 backend static libraries(MFC) in my GUI Application Can anybody suggest me which template in VS2005 is more appropriate for this...
6
by: =?Utf-8?B?S3VlaXNoaW9uZyBUdQ==?= | last post by:
Is there a way to convert a VC++ MFC project into a VC++ .NET project? If yes, how do I do it?
0
by: tirumalab | last post by:
HI there, I was trying to call a C# smartdevice dll from VC++ pocket PC console application both were developed using VS.NET 2005. i've registered the dll with the registry and created the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.