NCDDE服务连接DDE封装的API,ddehelper

NCDDE服务连接DDE封装的API,ddehelper.可以连接西门子840d数控机床,使用ncdde方式。


//

//  DDEapi.h
//
// This software was developed by U.S. Government employees as part of
// their official duties and is not subject to copyright. No warranty implied 
// or intended.Any questions or comments mailto:John.Michaloski@nist.gov


/*
    Exported DDE Capabilities
*/
#pragma once


//#include <atlstr.h>
//HRESULT printFile(CString filename, CString filepath, CString filetitle);
#include <string>
#include <map>
#include <vector>
#include <ddeml.h>


class DDEAdapter
{
public:
DDEAdapter();
int Init();
void Quit();
int Connect(LPSTR app, LPSTR topic);  // conversation
void Disconnect();
bool IsConnected();


int GetData(LPSTR lpszDataName,std::string & data);
 
//HDDEDATA CALLBACK DDECallback(UINT uType, UINT uFmt, HCONV hconv, HSZ hszTopic, HSZ hszItem, HDDEDATA hdata, DWORD dwData1, DWORD dwData2);
static HDDEDATA CALLBACK DDEMyCallback(UINT uType, UINT uFmt, HCONV hconv, HSZ hszTopic, HSZ hszItem, HDDEDATA hdata, DWORD dwData1, DWORD dwData2);


//int ExecCmd(LPSTR app, LPSTR lpszCmd);
PTSTR GetTextData( HDDEDATA hData) ;
std::string DDERequest(std::string item);
void DDEAyncExecute(DWORD idInst, char* szCommand);
void DDEPoke(DWORD idInst, char* szItem, char* szData);
std::string DDEErrorMessage(UINT err);


std::string DdeAyncRequest(std::string item);


int DDEAdapter::TryRequest(std::string item, int format, int timeout,  std::string &data);




//
std::map<std::string,std::string> values;
HCONV hConv;
DWORD dwDDEInst ;
HINSTANCE hInst;
char Message[256];
std::string szItem1;
HSZ DDEServerName;
HSZ DDETopicEvaluate;
HSZ hszTopic;
HSZ hszApp;
HSZ hszItem ;
DWORD hTransaction;
std::vector<HCONVLIST> vars;




//# define ServerName "ncdde|"
//# define TopicName "machineswitch"


};


__declspec(selectany)    DDEAdapter ddeAdapter;


下载地址:看评论。


http://download.csdn.net/detail/dacong/9793020


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值