Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Visual C++ and MFC Fundamentals Chapter 3: Windows Resources


3.1.2 Converting a Resource Identifier.........................................................


An identifier is a constant integer whose name usually starts with ID. Although in Win32
programming you usually can use the name of a resource as a string, in MFC
applications, resources are usually referred to by their identifier. To make an identifier
name (considered a string) recognizable to an MFC (or Win32) function, you use a macro
called MAKEINTERESOURCE. Its syntax is:

LPTSTR MAKEINTRESOURCE(WORD IDentifier);

This macro takes the identifier of the resource and returns a string that is given to the
function that called it.

In the strict sense, after creating the resource file, it must be compiled to create a new file
that has the extension .res. Fortunately, Visual C++ automatically compiles the file and
links it to the application.

Practical Learning: Creating an Application



  1. Start Microsoft Visual Studio or Microsoft Visual C++

  2. Create a new Win32 Project named Resources

  3. Click OK and specify the Windows Application as an Empty Project

Free download pdf