Basic MFC problems - Newbie.

Hi! Everybody.
My problems are as follows:

1). "Shared or Statically Linked MFC?"

While making a MFC application using the App Wizard, in the 5th step (Visual C++ 5.0), it asks ::
=====
How would you like to you the MFC library?
1). As a shared DLL?
2). As a statically linked library?
=====

What are these options and how can they affect the development of my project? Also when can I use them (i.e. are there any restrictions on when can I use one method over the other and vice-versa).

2). While studying the code, I came across the following lines::
======
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
======
While studying the Documentation, I learned that in Visual C++ _MSC_VER = 1100. That's fine. But what I could not understand is the explanation for the line #pragma once -> Specifies that the file, in which the pragma resides, will be included (opened) only once by the complier in a build.
What does this mean? And why are these lines included in the header files for the application? What if I change the source code for the header files?

3). What do these lines in the resource script mean?
=====
#if !defined (AFX_RESOURCE_DLL) || defined (AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif // _WIN32
[other program lines]
#endif
=====

4). Let's imagine that I create a Dialog based application using the MFC AppWizard named MFCSample.
It creates the following files:
MFCSample.cpp, MFCSample.h
MFCSampleDlg.cpp. MFCSampleDlg.h
stdafx.cpp. stdafx.h
Resource.h, MFCSample.rc
MFCSample.rc2, MFCSample.ico
ReadMe.txt

In MFCSampleDlg.h file we are referencing an identifier
enum {IDD = IDD_MFCSAMPLE_DIALOG} ;
defined in resource.h but we are not including this file in the MFCSampleDlg.h whereas the opposite is happening in MFCSample.h file

5). Upon seeing the documentation for WS_EX_APPWINDOW extended Window Style, it says that this style forces top-level window to be minimized. What does this mean?

===============================================
Thanks in advance.
NoviceAndGoodAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JPMartineauCommented:
1) Regarding the statically or dynamically linked MFC: if you choose static link, the MFC lib will be linked to your project (increasing its size). If you choose dynamic link library, the application will require the mfc DLLs
(MSVCRT.dll, etc.). I am a strong supporter of dynamic linking, since I often create many MFC apps (which would be much larger!), but both have their benifits.

2) Sorry, can't help you here. I've always kinda ignored this... I figure it's somekind of backward compatibility stuff...

3) This is used to specify which version of the resources you are using. When you create a resource (Dialog or String table), you have the choice of defining it to be English, French, etc.

Your application actually only uses one of those (You can re-compile to make a french or italian version)

4) The line
enum {IDD = IDD_MFCSAMPLE_DIALOG};
is enclosed in a block:
// Dialog Data
      //{{AFX_DATA(CDialogEditGame)
      enum { IDD = IDD_MFCSAMPLE_DIALOG };
      ...
      //}}AFX_DATA

I figure that the MFC mechanisms [AFX_DATA(CDialogEditGame)] include the resources somewhere.

5) This actually means that a window with this Window Style will be visible in the taskbar when it (the window) is visible. Therefore, it is usually the main application window that has that style

Hope I helped you understand a bit more...

JPM
0
JPMartineauCommented:
sorry, forgot to check "Answer"

1) Regarding the statically or dynamically linked MFC: if you choose static link, the MFC lib will be linked to your project (increasing its size). If you choose dynamic link library, the application will require the mfc DLLs
(MSVCRT.dll, etc.). I am a strong supporter of dynamic linking, since I often create many MFC apps (which would be much larger!), but both have their benifits.

2) Sorry, can't help you here. I've always kinda ignored this... I figure it's somekind of backward compatibility stuff...

3) This is used to specify which version of the resources you are using. When you create a resource (Dialog or String table), you have the choice of defining it to be English, French, etc.

Your application actually only uses one of those (You can re-compile to make a french or italian version)

4) The line
enum {IDD = IDD_MFCSAMPLE_DIALOG};
is enclosed in a block:
// Dialog Data
//{{AFX_DATA(CDialogEditGame)
enum { IDD = IDD_MFCSAMPLE_DIALOG };
....
//}}AFX_DATA

I figure that the MFC mechanisms [AFX_DATA(CDialogEditGame)] include the resources somewhere.

5) This actually means that a window with this Window Style will be visible in the taskbar when it (the window) is visible. Therefore, it is usually the main application window that has that style

Hope I helped you understand a bit more...

JPM
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
akalmaniCommented:
Hi !!
 I agree with the answers that are given and its just an extension to question 3 and 4

3) The language option is for the localisation. U can have the resources which has all the languages in one DLL and load only the particular language resource depending upon which language u have set for application's thread.

4)There are 2 separate compilers for Visual C++. One which compiles the code and other is the Resource compiler. The resource.h is included for both the Code compilation and the reource compilation.  Both the .obj(Code compiler output) and .res(Resource compiler output) are linked by the linker to build the final .exe. For more information u read the "Inside Visual C++ " by David Kruglinski
The enum ID is the Dialog ID.

Hope this helped u
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

NoviceAndGoodAuthor Commented:
Dear JPM,
             Thanks for the answer. Could you also tell me the difference between selecting the Debug mode, Relaese mode, and All Configurations mode as stated in the project settings dialog. Also how can these affect the development of my project.

Thanks.
0
JPMartineauCommented:
There are 2 modes when you compile an app: Debug and Release. You can add as much as you like, though.

Basically, these different configurations define how the application will be built:

Debug:
This is the mode in which you develop your application. The optimisations are turned off, the debug info helps you to debug, some functions are added (ASSERT(), TRACE(), etc...)

Release:
This is the mode which you use to ship your product: code is optimized, no debug info is included, basically, it is smaller & faster, but you can't really debug it.

When you select debug mode, you see/set the settings that are specific to the debug mode. When you select the release mode, you edit the settings that are specific to the release mode. If you select configurations, you can edit settings that are common to all (debug & release) configurations.

Nothing prevents you to add other configurations...  It could be useful to have a mode that is based on the release mode but with the debug info turned on... But for most cases, the 2 defaults are enough...
0
mikeblasCommented:
JPMartineau> the application will require the mfc DLLs (MSVCRT.dll, etc.).

MSVCRT.DLL is not an MFC DLL.

..B ekiM
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.