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

📄 opcda_o.cpp

📁 使用OPCST开发的进程外OPCDA服务器
💻 CPP
字号:
// opcda_o.cpp : Defines the class behaviors for the application.
//

#include "stdafx.h"
#include "opcda_o.h"
#include "opcda_oDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#include "opcst_x.h"

#include <time.h>

/////////////////////////////////////////////////////////////////////////////
// COpcda_oApp
extern HINSTANCE hInstance;//模块实例

SOPCRegisterInfo OPCRegInfo =	//OPC DA系统注册表信息
{
	"OPC Server of Out process" ,
		"OPCDA.Outprocess(vc)" ,

	{ 0x4dd30130, 0xc9a7, 0x11d4, 	{0xbe, 	0xf5, 	0x2d, 	0x0, 	0xda, 	0x20, 	0xdb,	0x5c} }
	
};



BEGIN_MESSAGE_MAP(COpcda_oApp, CWinApp)
	//{{AFX_MSG_MAP(COpcda_oApp)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG
	ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// COpcda_oApp construction

COpcda_oApp::COpcda_oApp()
{
	// TODO: add construction code here,
	// Place all significant initialization in InitInstance
}

/////////////////////////////////////////////////////////////////////////////
// The one and only COpcda_oApp object

COpcda_oApp theApp;

/////////////////////////////////////////////////////////////////////////////
// COpcda_oApp initialization



BOOL COpcda_oApp::InitInstance()
{
	// Standard initialization
	// If you are not using these features and wish to reduce the size
	//  of your final executable, you should remove from the following
	//  the specific initialization routines you do not need.
///////////////////////////////////////////////
	InitDeviceBuffer();
	hInstance = AfxGetApp()->m_hInstance;
	InitParm();
	InitOPCServer(hInstance, &OPCServerInfo , 
		&OPCRegInfo,  &VendorInfo, ReadVariant,WriteVariant);
	
	
	if(S_OK != EXE_StartServer())
	{
		AfxMessageBox("StartOPCServer failed");
		return false;
	}
	LoadDeviceTag();

///////////////////////////////////////////////

	COpcda_oDlg dlg;
	m_pMainWnd = &dlg;
	int nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with OK
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with Cancel
	}
///停止服务器
	EXE_StopServer();

	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}

⌨️ 快捷键说明

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