Message map handler names: Visual C++ 6 code writes plain names
(ON_COMMAND(ID_X, OnX)), later code writes member pointers
(ON_COMMAND(ID_X, &CMyView::OnX)). Standard C++ has no expression
that accepts both. clang-retro's compiler has a preprocessor builtin
for it (__starts_with_ampersand), so with it the maps take either
form, mixed as code likes, with nothing to set (message maps, dispatch
and event sink maps, DHTML event maps). With other compilers the
second form needs _AFX_MSGMAP_MEMBER_POINTERS defined before
afxwin.h.
An ISAPI parse map's ITS_ string gives the number of a command's
arguments; each argument is read as its parameter's own C++ type.
The memory diagnostics track the blocks DEBUG_NEW makes and, in a
debug build, CObject-derived objects. They do not track every
allocation, as Visual C++'s debug heap does. The library replaces the
global operator delete to free its blocks. When MinGW's libstdc++
links its own delete first, only objects are tracked
(_AfxTracksAllBlocks says which). A tracked block must be freed by
the module that made it.
min and max are function templates rather than macros (MinGW-w64
defines the macros for C only). NOMINMAX turns them off.
Floating bars are tool windows, so the system draws their captions,
and they resize with the system's sizing border.
Wine's rich edit control draws an
embedded object from its data rather than through IViewObject, and
writes only the object's picture into rich text, so there a saved
object comes back as a picture.
Wine's oledlg ends a cancelled Insert Object dialog with OLEUI_FALSE,
which DoModal reports as IDABORT, and its Links dialog does nothing
yet.
Wine's rich edit control does not implement EM_FORMATRANGE yet, so
under Wine a CRichEditView prints blank pages; Windows prints them.
A dispatch map entry calls its member function through a template
made from the function's own type, not through assembly that pushes
the arguments, so the function's parameter types must be the ones its
VTS_ string describes (as they must in MFC) and it must not be
overloaded. Drag scrolling starts as soon as the pointer is in the
inset, without waiting nScrollDelay. A connection point's cookie is
the sink's interface pointer.
The extended control's own properties are Name, Object, Parent and
Left, Top, Width, Height, Visible and ID (in the container window's
pixels, with DISPIDs of this library's, AFX_DISPID_EXT_*); Parent is
the container window's IDispatch when it has automation. Data binding
uses an OLE DB data source's default data member (with IRowPosition,
or else the rowset's first row), and a cursor's current row; a field
is set as soon as its bound property changes (with a cursor, as an
update of its own unless one is going on). ON_DSCNOTIFY hears of
every step of a cursor's changes, but of an OLE DB data source's only
once something is bound to it, and then only of the steps the rowset
tells of.
Windowless controls are drawn after the container's own painting,
in the order they were made. A drag over one goes to the drop target
it gives (IOleInPlaceObjectWindowless::GetDropTarget, which
COleControl answers with GetWindowlessDropTarget); when the
container's window is no drop target, the container makes it one as
such a control is activated.
A regular DLL runs in the program's message loop, so its CWinApp's
OnIdle and PreTranslateMessage are not called (as with Visual C++
MFC), and the temporary window objects it makes are freed when the
DLL unloads. With mfc.dll, the DLL's module state holds its
CWinApp, instance and resource handles, window classes, handle maps
and OLE factories and object count; the program's run-time class list
(CRuntimeClass::FromName) and AfxGetThread are shared with it.
The shared library is one DLL, with the database, OLE and network
classes that Visual C++ puts in DLLs of their own, so it imports
odbc32, wininet, ws2_32, oledlg and urlmon whatever the
program uses. Each module keeps its own C runtime state where the C
library is linked statically (picolibc): a FILE* or errno belongs
to the module that has it.
An extension DLL's classes and resources are found while it is
loaded; AfxTermExtensionModule takes its classes out of the list
CRuntimeClass::FromName searches. AFX_EXTENSION_MODULE's
pFirstSharedClass and pFirstSharedFactory stay NULL: the classes and
OLE factories go into the program's lists as the DLL loads.
The gopher classes call WinINet's gopher functions, which Internet
Explorer 7 and later removed and Wine does not have, so they are not
tested; neither is https, which needs a server with a certificate.
CInternetSession's status callback finds its session through the
handle's parent (INTERNET_OPTION_PARENT_HANDLE), or is the only
session with the callback on.
A DHTML event map holds its own class's entries only; a
CMultiPageDHtmlDialog uses the class's map and the page's embedded
map together. A handler gets the element whose event it handles (for
the document's events, the element where the event happened). A
DHTML_EVENT_AXCONTROL handler's parameters are read as their C++
types (as a dispatch map's are), so it must not be overloaded. A URL
map entry matches the page's whole URL or its last part.
CHtmlEditView's editing command map is searched before its message
map, and after the class's own entries CHtmlEditView's (the Edit
menu's commands) apply. CHtmlEditDoc saves through the page's
IPersistFile, or else writes its text in UTF-8.
Wine's OleCreatePropertyFrame (as of Wine 9) never calls
IPropertyPage::Apply, so under Wine the OK and Apply buttons of a
control's property frame do not change the control; Windows applies
the pages.
A control's binary stream (IPersistStreamInit, IPersistStorage, DLGINIT
data) and its property bag entries are the ones Visual C++ MFC
writes: the tests load a stream that MFC 4.2 saved and save it back
byte for byte. Fonts, pictures and other objects in the stream carry
their own data, so a font saved on another system may name the face
that system used.
COleDocument's "Contents" stream and its "Embedding N" storages are
laid out as Visual C++ MFC lays them out, for compound and flat
files. An item's record holds three fixed values whose meaning is not
known; they are written as Visual C++ MFC writes them for embedded and
static items and ignored when loading. Wine's
OleCreateStaticFromData makes objects without IOleObject, so static
items cannot be created under Wine.
Under Wine, a container's OLERENDER_DRAW cache never takes a picture
from a local server, so such objects draw blank; OLERENDER_FORMAT
with CF_METAFILEPICT works. Wine has no REGCLS_SINGLEUSE, so a
single-instance COleObjectFactory revokes itself once it has made
its object. Wine's object handler calls InitNew again when it runs
an object it created, even after a save, so a container should clone
such an object rather than run it again. Menus and clipboard data do
not cross processes under Wine, so in-place activation is tested
with the container and server in one process. There Wine gives the
container the server's own object rather than OLE's handler, and
COleClientItem::Draw then draws from the object's metafile.
The stock property pages are built in memory rather than from
resources. Each lists its kind of property from the objects' type
information, or, for an object without any, from the stock names
(BackColor, ForeColor, BorderColor, FillColor, MaskColor; Font;
Picture, MouseIcon, Icon) whose values are of the kind. The system
has its own pages for their CLSIDs; where it has none, as under Wine,
COleControl::OnProperties registers these for its property frame
while the frame is up. A container's own property frame gets the
system's pages only. CPicturePropPage::LoadPictureFile is what Browse
uses, for programs and tests that pick the file themselves.
A DocObject container keeps its in-place menu's fourth group (after
the third separator, usually Help) in the shared menu, and
COleDocIPFrameWnd puts the object's Help popup, the first popup of its
in-place menu's third group, at the top of it. The whole Help menu
then counts as the object's group 5, so its commands, the
container's included, go to the object's window. Wine's oledlg has no
Change Source, Object Properties or Server Busy dialogs, so tests call
the interfaces those dialogs use rather than the dialogs, and Wine
has no OleCreateLinkToFile.
A DocObject's IPrint prints its document's first view, as File Print
does, to the container's printer. GetPageInfo knows the pages only
when the view's OnPreparePrinting sets the last page. Printing to a
file takes the file's name from a TYMED_FILE pstgmOptions.
COleDocObjectItem::DoDefaultPrinting prints the whole object through
IPrint to the container's printer, or else through its Print command
(OLECMDID_PRINT).
The running object table holds a stand-in for a document or a linked
item, which hands out the object's interfaces, so that the table does
not keep open a document a link opened; asking it for IUnknown gives
the stand-in. Wine's composite monikers bind only through the running
object table, so under Wine a link binds to an item whose document is
not open only when the item moniker is bound with the file's at its
left, and Wine's OleCreateLink and OleQueryLinkFromData are stubs
(CanPasteLink looks for Link Source itself).
Sockets take IPv6 as later versions of MFC do: make the socket with
Socket(nType, lEvent, 0, AF_INET6), after which the string forms of
Bind, Connect and SendTo take IPv6 addresses and host names, and
GetPeerNameEx, GetSockNameEx, ReceiveFromEx and SendToEx give and
take either family. Create makes IPv4 sockets. Host names need
getaddrinfo (Windows XP and later); earlier systems take numeric
IPv6 addresses only. CAsyncSocket::FromHandle returns
only sockets attached in the calling thread, and NULL for others,
rather than making a temporary object.
CRecordset keeps the rows it has fetched and writes changes with
UPDATE, INSERT and DELETE statements that match the record by the
values it read, rather than with positioned cursors, so it works with
any driver. A dynaset (or dynamic recordset) asks the driver for a
keyset-driven cursor and reads each record again as it moves to it,
so other users' changes and deletions show; records they add show
after Requery, in a dynamic recordset too. With a driver that has no
keyset-driven cursors, a dynaset behaves like a snapshot. A stored procedure's output
and input/output parameters (outputParam, inoutParam) reach
their members once FlushResultSet has gone past the last result set,
or as it opens when the procedure has none.
The DAO classes drive the engine through its Unicode interfaces in
ANSI programs too. As with Visual C++, text in their variants is
VT_BSTRT there (ANSI bytes in the BSTR), so it is converted on the
way in and out.
llvm-rc (and llvm-windres, which uses it) has no TOOLBAR
statement yet; write toolbar resources as raw resource type 241, as
tests/sditest.rc does.
CImage::SetTransparentColor takes an index into the color table for
an indexed image, as with Visual C++, and an RGB value (a COLORREF)
for any other image.
CTaskDialog on a system without the task dialog shows a message box
rather than asserting.
CFileDialog asks for the Vista dialog when it runs: where Windows has
none (XP), or a hook or template is set, it shows the classic one, and
the customization members return E_NOTIMPL. CFolderPickerDialog falls
back to SHBrowseForFolder there. The portable layer has the Vista
dialog too: its own file dialog with the program's added controls in a
panel below the standard ones.