Home |  | Products |  | Consulting |  | Industries |  | News |  | About IBM

| Search
| OpenDoc |
| Download |
| Library |
|  | IBM Worldwide |
| OpenDoc > Library > Listing 3. Code snippets from smpshpin.cpp and smpdspm.def smpshpin.cpp and smpdspm.def contribute to the implementation of a shell plug-in that monitors messages passed through the OpenDoc dispatcher and then relays them to PMPrintf. Complete versions of these files are shipped with OpenDoc for OS/2.
    // smpshpin.cpp
    #ifndef _SHPLUGIN_
    #include
    #endif
    ...
    extern "C" {
    APIRET APIENTRY MyShellPlugInInstallProc( Environment*,
                                 ODDraft*,
                                 ODShellPlugInActionCodes*);
    }

    APIRET APIENTRY MyShellPlugInInstallProc( Environment* ev,
                        ODDraft* draft,
                    ODShellPlugInActionCodes* action)
    {
        ODSession* session =
        draft->GetDocument(ev)->GetContainer(ev) \\ continued
             ->GetStorageSystem(ev)->GetSession(ev);

        ODDispatcher* dispatcher = session->GetDispatcher(ev);

        ODDispatchModule* dspmod = new SampleDispatchMonitor;
        // This call instantiates a monitor which is
        // implemented separately

        dspmod->InitDispatchModule(ev, session);
        // This call initializes the monitor

         ...
    }
    ============================================================
    (Name of file:  SMPDSPM.DEF)

    LIBRARY cntnrprt INITINSTANCE
    DESCRIPTION 'Sample Shell Plug-In Class Library'
    PROTMODE
    DATA MULTIPLE NONSHARED LOADONCALL
    EXPORTS
        ODShellPlugInInstallProc = MyShellPlugInInstallProc
    ============================================================
Privacy |  | Legal |  | Contact |