KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q120926: Visual C++ Vers 2.0 README.WRI, Part 10 Miscellaneous Notes

Article: Q120926
Product(s): Microsoft C Compiler
Version(s): winnt:2.0
Operating System(s): 
Keyword(s): 
Last Modified: 22-JUL-2001

-------------------------------------------------------------------------------
The information in this article applies to:

- Microsoft Visual C++, 32-bit Editions, version 2.0, on platform(s):
   - the hardware: Intel x86 
-------------------------------------------------------------------------------

SUMMARY
=======

The following is based on the Visual C++ version 2.0 README.WRI file:

Link Libraries for MFC Projects
-------------------------------

With the Microsoft Foundation Class Library (MFC) version 3.0 in Visual C++
version 2.0, it is no longer necessary to specify standard libraries for MFC
applications. The MFC header files now generate /defaultlib directives to link
the correct variant of the MFC library, and to link WINDOWS.H and other system
header files as necessary.

Having standard Link Input files specified in the MFC .MAK files does not usually
cause a problem. However, if you change from "Use MFC in a Static Library" (the
default setting) to "Use MFC in a Shared Dll (mfc30(d).dll)" (in the Microsoft
Foundation Classes box on the General tab of the Project Settings dialog box),
you will get link errors such as the following:

  

  mfc30d.lib (MFC30D.DLL) :
      error LNK2005: ?messageMap@CWinApp@@1UAFX_MSGMAP@@B (protected:
         static
      struct AFX_MSGMAP const CWinApp::messageMap) already defined in
      nafxcwd.lib(appcore.obj)

The multiple definition of MFC objects occurs because the MFC header files issue
a /defaultlib directive to link MFC30(d).LIB; but NAFXCW(d).LIB is still in the
Link Input list.

To avoid this problem, remove all libraries from the Object/Library Modules box
of the Input category on the Link tab of the Project Settings dialog box.

Converting Visual C++  Version 1.5 Non-MFC Sample Programs
----------------------------------------------------------

Converting applications developed with Visual C++ versions 1.0 or 1.5 may not
automatically add the appropriate library files to the linker command line. For
example, the SORTDEMO sample is not an MFC project and is not marked as an MFC
project in the corresponding Visual C++ version 1.5 makefile. However, after
Visual C++ version 2.0 converts the project, it is marked as an MFC project and
no Windows libraries are included on the linker command line. This causes
unresolved externals when the project is built. To work around this problem,
choose "Not Using MFC" in the General tab of the Project Settings dialog.

MFCANS32 and MFCUIX32 Sample Directories
----------------------------------------

There are two DLLs that are internal to the Microsoft Foundation Class
Library[ASCII 146]s OLE implementation: MFCUIx32.DLL and MFCANS32.DLL. Most OLE
applications must ship these two DLLs. See the REDISTRB.WRI file in the
\MSVC20\REDIST subdirectory for more information on these binary files.

Source code for both of these DLLs is provided in the
\MSVC20\SAMPLES\MFC\MFCUIX32 and \MSVC20\SAMPLES\MFC\MFCANS32 subdirectories.
The source is provided to help debug your application. See the MAKEFILE for each
of these DLLs for information on building the debug version.

Adding ToolTips to Your Application
-----------------------------------

ToolTips are not documented in the Books Online manuals. Each toolbar button with
a ToolTip maps to a menu resource ID name. To prepare your application for using
ToolTips, use the menu editor to select the command to which the desired toolbar
button is mapped, and expose the Property Page with ALT+ENTER. In the Prompt:
field, enter the text string that should appear on the status bar when the menu
command is selected. To create the ToolTip text, enter "\n" at the end of the
Status Bar prompt, followed by the desired ToolTip text. An example for the
File-New toolbar button could be:

Prompt: Creates a new document\nNew source file

Any application generated by AppWizard follows this convention and can be used to
demonstrate and understand the feature.

The string editor can also be used to create the Prompt: string, but it is more
direct and easier to use the menu editor.

Multithread Programming
-----------------------

If the value of a variable can be modified by another thread or by the operating
system and your program depends on this behavior, you should declare the
variable as volatile. Without the volatile keyword, the optimizing compiler may
enregister a copy of this variable, leading to unexpected behavior.

Double Quotation Marks in Makefiles
-----------------------------------

Use of double quotation marks (") as part of a target name is not supported (as
in: MyTarget "TARGET").

Makefiles containing double quotation marks within a target name may be
unrecognizable to the development environment.

64-bit Integers
---------------

In addition to the __int8, __int16, and __int32 "sized integer" support
documented in the C Language Reference and C++ Language Reference, this Visual
C++ version 2.0 release provides support for 64-bit integers. To declare a
64-bit integer, use the __int64 keyword.

Using printf and scanf with 64-bit Integers
-------------------------------------------

You can use the __int64 data type with the printf and scanf function families.

A printf format specification, which consists of optional and required fields,
has the following form:

  %[flags] [width] [.precision] [{h | l | I64 | L}]type

A scanf format specification, which also consists of optional and required
fields, has the form:

  %[*] [width] [{h | l | I64 | L}]type

The I64 optional prefix to the type specifier indicates that the corresponding
argument is a 64-bit integer. To specify _int64, you can use the size prefix I64
with the type specifier d, i, o, u, x, or X. The type prefix I64 is a Microsoft
extension and is not ANSI-compatible. For more information, see printf and scanf
in the Run-Time Library Reference.

Writing 32-bit ODBC Applications
--------------------------------

An update to ODBC version 2.0 is required to build ODBC applications for
DBCS-enabled versions of Windows NT (including Windows NT/Japanese) and Windows
95. At the time Visual C++ version 2.0 was released, an update to ODBC version
2.0 was not available. The retail version will be distributed on the Microsoft
Developer Network Development Library Level 2 CD-ROM when it is available.

ODBC Classes and Threads
------------------------

Because the Microsoft Foundation Class libraries that utilize ODBC cannot ensure
that all ODBC components and drivers are completely thread aware, these classes
are not thread-safe.

Additional query words: 2.00 quote quotes

======================================================================
Keywords          :  
Technology        : kbVCsearch kbAudDeveloper kbVC32bitSearch
Version           : winnt:2.0

=============================================================================

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.