The information in this article applies to:
SUMMARYMFC and Other LibrariesCoexistence of Visual C++ 4.2 and 5.0 MORE INFORMATIONCoexistence of Visual C++ 4.2 and 5.0The Visual C++ 4.2 and 5.0 library DLLs have the same names. Setup for Visual C++ 5.0 will overwrite your 4.2 system files. Debug information has changed in Visual C++ 5.0 and is not compatible with the Visual C++ 4.2 debugger. Because of this, the Visual C++ 4.2 debugger will not be able to step into the source code of the Microsoft Visual C++ 5.0 MFC or CRT debug libraries. This issue will not affect Visual C++ 4.0 or 4.1 users and does not affect your ability to debug your own source code.Affected files: Standard C Run-TimeWorkaroundsMSVCRTd.DLLMFC
None of these workarounds allows debugging of Release Builds with 4.2 debugger. NOTE: to MFC42b (patch) customers. If you need to recreate the patched MFC DLLs, we have provided the MFC4.2B patch (MFC42B.EXE ) in the \DevStudio\Vc\Debug directory. This directory is on the disc that includes "Microsoft Visual C++" on the label. (Disc 1 if you purchased Visual C++; Disc 3 if you purchased Visual Studio.) You can patch the MFC files by copying them into a temporary directory and running the patch on them. You can ignore the errors about missing files. The Visual C++ 5.0 files will not otherwise affect the operation of Visual C++ 4.2. Under no circumstances do we recommend replacing the new versions of mfc42.dll, mfc42u.dll, and msvcrt.dll with the versions from 4.2 as you may break other applications dependent on the new versions of these DLL's. The Visual C++ 5.0 Developer Studio will not run with the Visual C++ 4.2 version of mfc42.dll. Visual Basic 5.0 Controls in Visual C++ 5.0Below is a list of Visual Basic 5.0 controls provided for your use. Please be aware that many of these controls contain interfaces and behavior that are supported only in Visual Basic 5.0 container applications and are not supported by MFC container applications.If you have any problems with these controls, please report them at the Web site http://www.microsoft.com/VisualCSupport/report/. Please note that the controls that shipped with Visual C++ 4.0 and have replacements in Visual C++ 5.0 will no longer be supported by Microsoft's technical support. The Visual C++ Component Gallery displays all the controls registered on your system. Many of your controls may not have been tested with Visual C++. If you encounter problems with a non-Microsoft control, we encourage you to check with the control vendor for more information.
Incomplete Documentation for CWnd::RepositionBarsThe documentation for CWnd::RepositionBars is missing the parameter bStretch. The prototype should read:
bStretch indicates whether the bar should be stretched to the size of the
frame.
I/O Streams Now Exist in the "std" NamespacePer Section 27 of the new ANSI draft, streams are now defined within the std namespace. This means that any program that uses I/O streams must reference the streams within the scope of std.For example, the following sample will fail to compile, because cout is defined in the std namespace, unless the third line is uncommented:
Example Code in the CArchive::MapObject Member Function is IncorrectIn the section SubItem.cpp of the code, nonexistent overloaded CDocument operators (<< and >>) are used in two places. This code section should be replaced with the following code:
ATL Registrar Fails to Insert Keys Starting with Curly BraceThe ATL registrar does not correctly interpret two consecutive key names that both start with a curly brace ({). For example, the second "Implemented Categories" key name fails in the following registry script (rgs):
Workaround
Break out each key name as shown in this example:
Some ATL Object Stock Properties Must Be Initialized Before Use in Visual Basic 5.0 ContainersVisual Basic 5.0 expects all stock properties that are IUnknown-based (such as MousePointer, Picture, and Font) to contain a valid IUnknown pointer. Otherwise, Visual Basic will never allow the user to change the property. For example, if you have a stock Font property that you never fill in with a valid Font, Visual Basic will display the Font as being NULL, and will never allow the user to select a new Font through the Visual Basic property window.To avoid this problem, make sure your IUnknown-based stock properties have a valid value other than NULL before inserting your object into a Visual Basic container. There are many ways to do this, for example, get the ambient Font off the container and use that as your stock Font property. ATL.DLL Replaces REGISTER.DLLRegister.dll, which shipped with Visual C++ Beta 1, has been replaced with Atl.dll. To use the new DLL with your existing ATL projects you will simply need to rebuild them.ATL Font and Picture Properties May Require Changes to the IDL File To make a Font or Picture property work in some containers, the interface definition must be declared within the library section of the .idl file. You must cut the interface declarations from the .idl file and paste them into the library section of the same file. In addition, the import line for ocidl.idl needs to be commented out. For example, the ATL Object Wizard generates the following .idl file for MyCtl with a Font property:
The corrected version of this .idl file is shown below:
ON_WM_SETTINGCHANGEThe windows message map entry ON_WM_SETTINGCHANGE corresponds to the MFC member function with this prototype:
Parameters
uFlags When the system sends the message as a result of a SystemParametersInfo call, this parameter is a flag that indicates the system parameter that was changed. For a list of values, see the SystemParametersInfo function in the Win32 Programmers Reference. When an application sends the message, this parameter must be 0. lpszSection Points to a string that specifies the name of the section that has changed. (The string does not include the square brackets that enclose the section name.) Remarks The framework calls OnSettingChange for all top-level windows when the Win32 SystemParametersInfo function changes a system-wide setting. An application should send the message to all top-level windows when it makes changes to system parameters, and Windows will send the message if the user changes settings via the Control Panel. The ON_WM_SETTINGCHANGE message is similar to the ON_WM_WININICHANGE message, with the following difference:
See Also SystemParametersInfo and WM_SETTINGCHANGE in the Win32 Programmers Reference, and ON_WININICHANGE and CWnd::OnWinIniChange in the MFC Reference. TN024 Doesn't Identify all Custom MFC Resource TypesMFC Technote TN024, titled "MFC-Defined Messages and Resources", states that:There is currently only one MFC private resource format defined, RT_DLGINIT.This statement should read: Currently, MFC defines two private resource formats: RT_DLGINIT and RT_TOOLBAR. The Default Toolbar Supplied by Appwizard is Based on an rt_toolbar Custom Resource that was Introduced in MFC 4.0.You can edit this resource with the toolbar editor.MFC DAO Classes will Work with Either DAO 3.0 or DAO 3.5However the MFC DAO classes have not been designed to take advantage of any new DAO 3.5 features, including ODBCDirect.Using DAO with a Secure DatabaseIf you are writing a program that uses Data Access Objects (DAO) to access a secure database, you will receive an error if you use CDaoRecordset because MFC does not prompt the user for a user name and password. To find out how to call DAO directly to implement DAO security features, such as changing user passwords, see Technical Note 054 in the Microsoft Foundation Class Reference. The title is "TN054: Calling DAO Directly While Using MFC DAO Classes."The Hewlett Packard Standard Template LibraryVisual C++ 5.0 ships a complete, fully supported C++ Standard Run-time Library, that includes the Microsoft implementation of the Standard Template Library.Setup Installs the New C++ Standard Run-time Library with the Other Run-time LibrariesNote The Hewlett Packard Standard Template Library that shipped with Visual C++ 4.0 does not ship with Visual C++ 5.0. Microsoft does not provide technical support for the Hewlett Packard version of the Standard Template Library.Incorrect Information in the " _spawn, _wspawn Functions" TopicIn the topic titled "_spawn, _wspawn Functions", a table in the Remarks section has wrong information. The table is labeled "Generic-Text Routine Mappings." The far right column of the table, which has the heading "_UNICODE Defined," should list all the _wspawn functions instead of the spawn functions. When the _UNICODE flag is defined, the wide-character (_w) versions of the functions are used.MFC Loads Wrong Resource in Extension .dllThe wrong resource is loaded when CBitmap::LoadBitmap, CMenu::LoadMenu, CString::LoadString or any other MFC resource-loading function is called in an MFC extension .dll (AFXDLL). In some cases, a resource in the application is loaded instead of the appropriate resource in the extension .dll.When a resource in the application or another extension .dll gets loaded instead of a resource in the current extension .dll, the cause is usually improper resource management. An MFC application and all of its extension DLLs are one global chain of resources. If there are multiple resources with the same ID value in any of the modules in the chain, MFC uses the first resource it finds with the desired ID value. The first resource is often found in the application, which is searched before any of the extension DLLs. Change the ID values of any conflicting resources so they are unique in both the application and any extension .dll that the application uses. These values are stored in the Resource.h file for each project and can be modified in the Resource Editor or in Developer Studio with the Resource Symbols command. To ensure that modules do not use conflicting symbol values, reserve different ranges of ID values for each module in the 1 through 0x6FFFF range. Set the _APS_NEXT_RESOURCE_VALUE definition in the Resource.h file for each module to the low end of that module's range before creating any resources. The Resource Editor uses this symbol to determine the ID value of the next resource created. This technique is documented in MFC Technical Note 35 and in the DLLHUSK sample included with Visual C++. In .exe or .dll files that link to MFC dynamically, MFC resource-loading functions call AfxFindResourceHandle to obtain the handle of the module where a resource is located. AfxFindResourceHandle searches for resources by type and symbol value in:
Each extension .dll creates, initializes, and then passes a CDynLinkLibrary object to AfxInitExtensionModule that places the .dll in the resource chain. AfxTermExtensionModule removes the .dll from the chain when the .dll is detached from the application. A benefit of this design is that MFC automatically locates a resource for an application or extension .dll, even if that resource is located in a distant extension .dll or the application itself. All resources in the process are chained, so ID values are passed between DLLs and the application and the proper resources are loaded. A disadvantage is that there are no duplicate ID values between any of the extension DLLs or the application that uses them. To set the default location where AfxFindResourceHandle first checks for a resource, use AfxSetResourceHandle. Because AfxFindResourceHandle first checks the handle set by AfxSetResourceHandle, it can be used to circumvent the chain and load a resource from one particular .dll or application. The resource handle is restored to its original value immediately after loading the resources. The current default resource handle is found with AfxGetResourceHandle. The DLLHUSK sample included with Visual C++ also illustrates this technique. In Testdll2.cpp, CListOutputFrame::Create sets the resource handle to the module handle stored in the AFX_EXTENSION_MODULE structure extension .dll. This structure is initialized with the module handle when it is passed to the CDynLinkLibrary constructor in InitTestDLL2. For information on:
Call _findclose After Using _findfirst or _findnextYou must call _findclose after you are finished using either the _findfirst or _findnext function. This will free up resources used by these functions in your application._wgetcwd and _getcwdThe documentation for _getcwd and _wgetcwd should describe the second parameter (maxlen) as follows:maxlen Maximum length of path in characters- char for _getcwd and wchar_t_wtmpnam The documentation for _wtmpnam should include the following: If string is not NULL, it is assumed to point to an array of at least Incorrect Use of TZ Environment VariableThe online documentation for the _tzset function incorrectly defines the time bias for the TZ environment variable parameter (tzn) as being the "offset from UTC." It should define it as being the "offset from local time to UTC." The example for German time zone should be:
Using the _popen Function with a Windows ProgramThe _popen function, from the C Runtime Library, returns an invalid file handle if used in a Windows program which causes the program to hang indefinitely. It works properly in a Console application.To create a Windows application that redirects input and output, read the section "Creating a Child Process that Redirects Input and Output" in the Win32 SDK. C Runtime _expand Function Returns NULL Upon FailureThe _expand function returns NULL when an error is detected during operation. This may happen when there is sufficient memory. The current documentation implies that failures occur only when there is insufficient memory to expand the memory block. This is incorrect. For example, when _expand is used to shrink a memory block, it might detect a corruption in the small block heap or an invalid block pointer, and returns NULL.Format Specification Not Supported in COleDateTime and COleDateTimeSpan ClassesThe description of the member function Format in both the COleDateTime and the COleDateTimeSpan erroneously states that you can use the %D format specification to display the number of days. Neither COleDateTime::Format nor COleDateTimeSpan::Format support that format specification.IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadStringPtr, IsBadWritePtr, and Access ViolationsA handled exception will occur inside of these functions if the specified memory region is not accessible to the process when these functions attempt to access it. If the code is being executed under a debugger, and the debugger is configured to get first chance at handling exceptions, the debugger will trap the access violation and stop program execution. At this point you can simply continue execution in the debugger and these functions will return the appropriate value. This behavior can help you find potential access violations in your code.ATL IPropertyPageImpl::Help is implemented incorrectly.In most cases, if you are using property pages, you should override IPropertyPage::Help and return E_NOTIMPL. This will cause the container to use information returned from GetPageInfo. You can also provide your own alternative implementation of this function if necessary.
Keywords : kbGenInfo kbVC LibIss vc50rel |
Last Reviewed: June 25, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |