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

📄 unit1.h

📁 用C++ 实现的OPC SERVER的原代码
💻 H
字号:
//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------

#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Atl\atlbase.h>

# include "opcda_i.c"
# include "opcda.h"
# include "opccomn_i.c"
# include "opccomn.h"





//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// IDE-managed Components
        TButton *Button1;
        TEdit *Edit1;
        TButton *Button2;
        TEdit *Edit2;
        TListBox *ListBox1;
        void __fastcall Button1Click(TObject *Sender);
        void __fastcall FormShow(TObject *Sender);
        void __fastcall Button2Click(TObject *Sender);
        void __fastcall FormDestroy(TObject *Sender);
        void __fastcall ListBox1Click(TObject *Sender);
      
     

private:
  CComPtr<IMalloc> m_ptrMalloc;   // Task allocator
   VARIANT_BOOL m_vbActive;    // If the component is active or not
   CComBSTR m_bstrServer;     // Server Prog ID
   CComPtr<IOPCServer> m_ptrServer;   // The OPC server
  // CComPtr<IUnknown> m_ptrBrowse;
   IOPCBrowseServerAddressSpace *m_ptrBrowse;   // BrowseServerAddressSpace
   CComBSTR m_bstrItem;          // Item flat identifier
   DWORD        m_hItem;                 // Item Handle
   DWORD	m_hGroup;           // Handle of the OPC group
   DWORD	m_dwRate;        // Group parameters (see OPC doc):
   float	m_fDeadBand;
   CComPtr<IUnknown> m_ptrGroup;    // The group itself, referenced by an IUnknown interface pointer:
   CComPtr<IOPCItemMgt> ptrItMgm;
   CComPtr<IOPCSyncIO> m_ptrSyncIO;   // IOPCSyncIO interface of the group
   CComPtr<IOPCAsyncIO2> m_ptrAsyncIO;    // IOPCAsyncIO2 interface of the group
   DWORD m_dwID; // Used as Transaction ID     // IAsyncIO2 parameters
   DWORD m_dwCancelID; // The cancel id for asynchronous operations
   HRESULT *phResult ;
     void __fastcall ConnectToServer();
     void __fastcall GetItems();
     void __fastcall ConnectToItem();
public:
         __fastcall TForm1(TComponent* Owner);
	// User declarations
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
 

⌨️ 快捷键说明

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