解压用inole2.exe - d;帮助在:http://support.microsoft.com/kb/113255
Updates to Inside OLE 2 Book and Sample Code, January 1994
Pre-Release Win32 versions (through Chapter 2)
This file lists describe bugs found in the sample code of the
book Inside OLE 2 and corrections for those problems. Updated
code is found on Compuserve, Internet, and the MSDN CD (this also
contains the book text).
There are three sections to this file:
Compiler Errors: Changes to the OLE 2 SDK that caused
compiler errors with original Inside OLE 2
samples. Also some considerations for
different compilers.
Bug Fixes: Other changes to the source code to fix
a few major and a number of minor problems.
Other Topics: List of typographical errors in the book
text (MSDN CD version includes most
corrections already, but do double-check)
and other topics of interest, such as Win32
version information.
NOTE: To operate properly with OLE 2.01 after updating the sources
to compile it is necessary to rebuild an OLE 2.01 version of the
OLE2UI library for the Inside OLE 2 samples. Build a library named
"BOOKUI.DLL" according to the instructions in the SDK. With this
new file replace the INOLE2\BUILD\BOOKUI.DLL file included with the
book. A new version of the library is included with this revision
of the samples.
Please send additional bug reports and problems to the author at
kraigb@microsft.com on Internet. CompuServe users must prefix the
address with ">INTERNET:"
---------------------------
Section 1: Compiler Errors
---------------------------
The sample code of the book Inside OLE 2 was originally written
for the OLE 2.00 libraries. The OLE 2.01 libraries included
a few minor changes that cause compilation errors with the original
book samples.
1. Errors concerning IViewObject::Draw. The OLE 2.01 SDK
changed the prototype of IViewObject::Draw from using
"const LPRECTL" to "LPCRECTL." This affects HCOSMO and
Polyline samples of chapter 11 and Poltilne sample of
chapter 16, causing them to fail compiling.
To correct the error, replace all occurances of
"const LPRECTL" in declaration of CImpIViewObject::Draw
to "LPCRECTL" to match OLE 2.01. This occurs in the
HCOSMO.H and IVIEWOBJ.CPP files of HCOSMO in chapter 11,
and the POLYLINE.H and IVIEWOBJ.CPP files of Polyline in
chapters 11 and 16. Note that there are also affected
files in the INTERFAC directory, IVIEWOBJ.H and IVIEWOBJ.CPP,
although these will not show in compilations.
2. Errors concerning OleUIAddVerbMenu in Patron samples of
chapters 9, 12, 13, 14, and 15.
The OLE 2.01 UI library added a parameter to this function,
an added "idVerbMax" that indicates the largest number the
container allows for a verb menu item identifier. This
new parameter occurs immediately after the "idVerbMin" parameter.
In the Patron directories of chapters 9, 12, 13, 14, and 15
in the files PAGE.CPP and TENANT.CPP, the parameter IDM_VERBMAX
is added after the IDM_VERBMIN parameter (both are defined
in resource.h). The functions affected are CTenant::AddVerbMenu
(TENANT.CPP) and CPage::FQueryObjectSelected (PAGE.CPP).
3. Errors concerning OleGetObjectDescriptorFromOleObject affecting
Patron samples in chapters 9, 12, 13, 14, and 15.
The OLE 2.01 UI library added a parameter to the end of
this function: an LPSIZEL that contains the extents of the
object. The OLE 2.00 code appeared as follows:
stm.hGlobal=OleStdGetObjectDescriptorDataFromOleObject
(m_pIOleObject, NULL, m_fe.dwAspect, ptl);
The corrections for OLE 2.01 require the declaration and
initialization of a new SIZEL variable for the last parameter:
//Declare new variable
SIZEL szl;
...
//Initialze
SETSIZEL(szl, (10*(m_rcl.right-m_rcl.left))
, (10 * (m_rcl.bottom-m_rcl.top)));
//Add to parameter list.
stm.hGlobal=OleStdGetObjectDescriptorDataFromOleObject
(m_pIOleObject, NULL, m_fe.dwAspect, ptl, &szl);
This correctly computes the size of the object in question
and stores those extents in szl and in the object descriptor.
The changes affect the function CTenant::CopyEmbeddedObject
in chapters 9, 12, 13, 14, and 15. The function is found
in all the TENANT.CPP files in the PATRON directories
of these chapters. Note that it also affects the function
CTenant::CopyLinkedObject.in chapters 12, 13, 14, and 15,
4. Errors concerning IDS_CLOSE in Cosmo samples of chapters 10, 13,
14, and 16. The OLE2UI library of OLE 2.01 declared an IDS_CLOSE
symbol that conflicts with one of the same name declared in Cosmo's
RESOURCE.H file.
To correct the problem the IDS_CLOSE in RESOURCE.H is renamed
to "IDS_CLOSE2" and occurances of that symbol in COSMO.RC are
changed to match. This affects these two files in chapters
10, 13, 14, and 16.
5. Errors concerning GETICON.H in Patron samples of chapters
14 and 15. This file was necessary to include in container
applications that supports the Convert dialog in OLE 2.00.
The OLE 2.01 SDK removed the dependency on this file, so it
no longer has to be included. Therefore the #include statement
in the TENANT.CPP files of Patron in chapters 14 and 15
have been commented out.
To correct the problem, the line "#include <geticon.h>"
is commented out at the top of the TENANT.CPP files of
Patron in chapters 14 and 15.
6. Linker errors on Windows NT hosted development environments
concerning the CLASSLIB library. A filename in the FILES.LST
of CLASSLIB has an extra character causing it to appear as a
long filename, which on a Windows NT system is valid but does
not exist.
The first file in FILES.LST is changed from "cstrtable.obj"
to "cstrtabl.obj" to correct the problem, that is, remove the
extra 'e'.
7. The function declarations for LibMain and WEP in all DLLs
are slightly incorrect and have been updated. These can
ause compiler errors on non-Microsoft compilers. LibMain should
return an int (not a HANDLE) and take an HINSTANCE as the first
parameter (not a HANDLE either). WEP should return an int rather
than void. WEP should always return a zero to provide some return
value although that value is not used.
---------------------------------
Section 2: Sample Code Bug Fixes
---------------------------------
1. GP Fault with Patron sample during Activate As,
chapters 14 and 15.
The problem lies in the function CTenant::Close with the fReopen
flag. When this function determines that there are no references
to the tenant IStorage, it normally resets the internal state of
the tenant to defaults, including setting the member m_pIStorage
to NULL. However, if fReopen is TRUE, this NULL assignment is
skipped.
The crash occurs when m_pIStorage is left non-NULL but the
storage itself has been destroyed. Thus m_pIStorage is an
invalid pointer.
To correct this problem it is necessary to insure that the
m_pIStorage variable is set to NULL any time the actual
reference count on it is zero
A condition in the function CTenant::Close in TENANT.CPP of
both chapters is removed to correct the problem:
The lines:
if (!fReopen)
m_pIStorage=NULL;
are replaced with just:
m_pIStorage=NULL;
The fReopen flag was used in an attempt to provide some