⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 server.cpp

📁 Direct Oracle Access 非常好的Oracle数据库直接访问组件包 支持个版本的Delphi及C++ Builder 有源码
💻 CPP
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include <atl\atlvcl.h>
#include "ServerCPPDM.h"
USERES("Server.res");
USEFORM("ServerUnit.cpp", MainForm);
USETLB("Server.tlb");
USEUNIT("Server_TLB.cpp");
USEFORM("ServerCPPDM.cpp", RemoteCPPDM); /* TDataModule: DesignClass */ /* RemoteCPPDM: CoClass */
USEUNIT("Server_ATL.cpp");
//---------------------------------------------------------------------------
void __fastcall InitAtlServer(void);

// NOTE: You may derive a class from TComModule and use it as your server's
//       module object. (i.e. Assign an instance of that class to _Module).
//       However, you must *NOT* change the name _Module.
//
TComModule _ProjectModule(InitAtlServer);
TComModule &_Module = _ProjectModule;

// The ATL Object map holds an array of _ATL_OBJMAP_ENTRY structures that
// described the objects of your OLE server. The MAP is handed to your
// project's CComModule-derived _Module object via the Init method.
//
BEGIN_OBJECT_MAP(ObjectMap)
  OBJECT_ENTRY(CLSID_RemoteCPPDM, TRemoteCPPDMImpl)
END_OBJECT_MAP()
//---------------------------------------------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
    try
    {
        Application->Initialize();
        // Prevent the MainForm from showing
        Application->ShowMainForm = false;
        Application->CreateForm(__classid(TMainForm), &MainForm);
        Application->Run();
    }
    catch (Exception &exception)
    {
        Application->ShowException(&exception);
    }
    return 0;
}
//---------------------------------------------------------------------------
void __fastcall InitAtlServer(void)
{
  if (SaveInitProc)
    reinterpret_cast<TProcedure>(SaveInitProc)();
  _Module.Init(ObjectMap, (HINSTANCE)HInstance);
  _Module.m_ThreadID = GetCurrentThreadId();
  _Module.m_bAutomationServer = true;
  _Module.DoFileAndObjectRegistration();
  AddTerminateProc(AutomationTerminateProc);
}

//---------------------------------------------------------------------------

⌨️ 快捷键说明

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