Click to open or copy the Stoclien project files.
Click to open or copy the Include files (required).
Click to open or copy the Library files (required).
Note To build and run this sample, you must first build the Stoserve sample.
The principal focus of the Stoclien sample is how the client uses structured storage and how it directs a server component to use this storage. The programming of structured storage services is shown in the sample.
The Stoclien sample introduces a simple drawing application. The user can use a mouse or tablet device to do free-form drawing in the client window. The color and width of the electronic ink can be chosen, and the drawings can be saved in files.
The functionality is externally similar to Scribble tutorial samples in Visual C++. The difference in the Stoclien/Stoserve samples is an internal architecture based on OLE technology. A clear architectural distinction is kept between COM client and COM server. A COPaper COM object encapsulates only the server-based storage of the drawing paper data: no graphical user interface (GUI) behavior is provided on the server side. All GUI behavior is isolated in the client. The data management and storage features of COPaper objects are available only through an COM custom interface, IPaper.
Stoclien can load and save its drawings in the structured storage of OLE compound files.
The Stoclien sample creates and uses the connectable COPaper COM object that is provided as the CLSID_DllPaper component in the Stoserve server. The Stoclien client creates a COPaper object and controls it through the IPaper interface that the object exposes. Stoclien obtains drawing data from the user and graphically represents it in a window that it manages. Stoclien uses COPaper's IPaper interface to save the drawing data in COPaper and to direct file storage operations on this data.
Stoclien cooperates with the COPaper object to load and save COPaper's drawing data. Stoclien obtains an IStorage interface for the storage object in a compound file. In its load and save operations, Stoclien passes a pointer to this IStorage interface to COPaper in the server. COPaper uses the provided IStorage to create streams in the storage. COPaper can then use the standard IStream interface for reading and writing the drawing data it manages.
COPaper only manages the drawing data; it performs no GUI actions. Stoclien provides the GUI for the drawing application. It encapsulates this in a central CGuiPaper object.
Stoclien also implements the custom IPaperSink interface in a COPaperSink COM object and connects this interface to an appropriate connection point in the server's COPaper object. COPaper uses the connected IPaperSink interface to send notifications back to Stoclien. The normal GUI repainting of COPaper's drawing data is done in Stoclien using COPaper's connectable object technology.
See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.
This sample uses the following keywords:
_tsplitpath; addref; advise; ansitouc; asksave; beginpaint; cguipaper; checkmenuitem; choosecolor; cimpipapersink; clearwin; cmainwindow; cocreateinstance; cofreeunusedlibraries; coinitialize; connectpapersink; copapersink; couninitialize; cpapfile; create; createpen; defined; defwindowproc; delete_pointer; deleteobject; disconnectpapersink; dispatchmessage; domenu; drawoff; drawon; endpaint; erase; erased; errorbox; fileexist; fillrect; findconnectionpoint; getclassbrush; getclientrect; getconnectionpoint; getdc; gethwnd; getlasterror; getmenu; getmenustate; getmessage; getmodulefilename; getopenfilename; getsavefilename; getstockobject; getsystemmetrics; getusername; initapplication; initinstance; initpaper; inkcolor; inkdraw; inksaving; inkstart; inkstop; inkwidth; lineto; load; loadaccelerators; loadcursor; loaded; loadicon; loadimage; loadstring; loadstringa; lock; locked; lstrcat; lstrcpy; makefamilypath; makeintresource; messagebox; messageboxa; movetoex; open; paintwin; pickcolor; postmessage; postquitmessage; queryinterface; readhelp; readsource; readtutorial; redraw; registerclassex; release; release_interface; releasecapture; resize; resized; rgb; save; saveas; saved; selectobject; setcapture; setcursor; setwindowpos; setwindowtext; showdialog; showwindow; stdmethodimp_; stgcreatedocfile; stgisstoragefile; stgopenstorage; style; succeeded; text; translateaccelerator; translatemessage; unadvise; unicodeok; unlock; unlocked; updatewindow; windowproc; winmain