atlmod.h

来自「VC++串口通信设。本书详细说明讲解了在VC++环境下编写串口通信得过程。值得一」· C头文件 代码 · 共 72 行

H
72
字号
#ifndef ATLMOD_H
#define ATLMOD_H

//
// Set the module class correctly, depending on whether we are an
// in-process or local server
//

#ifdef USE_ATL_INPROC

   // Set our module class type
   typedef CComModule QueATLModule;

#endif

#ifdef USE_ATL_LOCAL

   // Check for double inclusion
   #ifdef USE_ATL_INPROC
      #error Specify USE_ATL_INPROC or USE_ATL_LOCAL, but not both.
   #endif

   //
   // This is a local server. Unlock needs to be overriden
   // so that the server can shut itself down when the server
   // lock count reaches zero
   //

   class CExeModule : public CComModule
   {
   public:

      // Ctor and dtor
      CExeModule()
      {
         // Set our thread id
       	ulThreadID = GetCurrentThreadId();
      }

      // Overridden methods
      LONG Unlock()
      {
         // Unlock ourself
         LONG lLockCount = CComModule::Unlock();

         // Was that the last one?
         if (!lLockCount)
         {
            // Yep! Send our suicide message
            PostThreadMessage(ulThreadID, WM_QUIT, 0, 0);
         }

         return lLockCount;
      }

   private:

	   ULONG ulThreadID;
   };

   // Set our module class type
   typedef CExeModule QueATLModule;

#endif

// Declare the external module instance
extern QueATLModule _Module;


#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?