Inproc Object Custom Interface in Apartment Model Client

ID: Q137629


The information in this article applies to:
  • Microsoft 32-bit OLE libraries, used with:
    • Microsoft Windows NT, versions 3.51, 4.0
    • Microsoft Windows 95
    • Microsoft Windows 2000


SUMMARY

Single threaded inproc objects (not marked with a ThreadingModel value), must provide marshaling code for any custom interfaces that they may implement.


MORE INFORMATION

An OLE inproc object that is not marked with the ThreadingModel value in the system registry is considered single threaded.

When an apartment model threaded client creates instances of this inproc object in its different threads, OLE cannot load the objects into those threads. This is because the object is single threaded and is not designed for multithreaded access by a client. Instead, OLE will instantiate the object in the main apartment (thread) of the client. (The main apartment is the thread that first called Co/OleIntialize.) The object will be marshaled to the other threads of the client that require use of it. This marshaling requires the inproc object to provide marshaling code for any custom interfaces it may implement. (The MIDL compiler can be used to generate marshaling code.)

If this inproc object doesn't provide marshaling code for its custom interfaces, it can be used only by single threaded clients or by clients that use the object only from the main apartment.

An object that is marked ThreadingModel=Apartment or ThreadingModel=Both is apartment model-aware. When an apartment model threaded client creates instances of this inproc object in its different threads, each instance will be instantiated in the respective apartments. Consequently the object need not provide marshaling code for any custom interfaces that it may implement.

Additional query words: 4.00 CreateThread 32 bit

Keywords : kbole kbInprocSvr kbNTOS351 kbNTOS400 kbWinOS2000 kbWinOS95 kbGrpCom kbDSupport LeTwoArc
Version : :
Platform : NT WINDOWS
Issue type :


Last Reviewed: October 26, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.