Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Visual C++ and MFC Fundamentals Chapter 21: Tree and List Controls


AfxMessageBox("Invalid Number");
Number2 = 0.00;
}

Result = Number1 + Number2;

m_Result.Format("%.2f", Result);
UpdateData(FALSE);
}


  1. Test the application


22.4 Win32 DLL..................................................................................................


22.4.1..Introduction..........................................................................................


A Win32 DLL is a library that can be made available to programs that run on a Microsoft
Windows computer. As a normal library, it is made of functions and/or other resources
grouped in a file. The DLL abbreviation stands for Dynamic Link Library. This means
that, as opposed to a static library, a DLL allows the programmer to decide on when and
how other applications will be linked to this type of library. For example, a DLL allows
difference applications to use its library as they see fit and as necessary. In fact,
applications created on different programming environments can use functions or
resources stored in one particular DLL. For this reason, an application dynamically links
to the library.

You create a DLL like any other application, as a project. This project must contain at
least one file. From your experience, you probably know that each C++ program contains
the main() function and each Win32 application contains a WinMain() function. These
are referred to as entry-points because the compiler always looks for these functions as
the starting point of an application. In the same way, a Win32 DLL must contain an entry
point function. The most regularly used function as the entry point is called DllMain.
Unlike a C++ program that uses main() and unlike a Win32 application that uses
WinMain(), a DLL can have a different function as the entry-point but it must have an
entry point. When building your DLL, you will need to communicate your entry-point to
the compiler.

When creating the DLL, you must provide a way for external applications to access the
functions or resources included in the DLL. There are two main ways you will do this:
using a statement that indicates that a particular function will be exported, or by creating
an additional specially configured file that will accompany the DLL.
Free download pdf