資源簡介
真正的可同時讀取多個變量的BCB版OPC開源程序,不調用第三方開發dll。
除了可以學習OPC技術外,還可額外學習listview、防止程序啟動兩次、限制文本框只能輸入數字、讀取注冊表、使用回調函數等
為了防止有人懷疑我的程序不能編譯或運行,連同exe文件一起打包。
很適合入門級學習!

代碼片段和文件信息
//?DataCallbackSink.cpp?:?Implementation?of?CDataCallbackSink
#include?“DataCallbackSink.h“
/////////////////////////////////////////////////////////////////////////////
//?CDataCallbackSink
HRESULT?STDMETHODCALLTYPE?CDataCallbackSink::OnDataChange(
??????/*?[in]?*/?DWORD?dwTransid
??????/*?[in]?*/?OPCHANDLE?hGroup
??????/*?[in]?*/?HRESULT?hrMasterquality
??????/*?[in]?*/?HRESULT?hrMastererror
??????/*?[in]?*/?DWORD?dwCount
??????/*?[size_is][in]?*/?OPCHANDLE?__RPC_FAR?*phClientItems
??????/*?[size_is][in]?*/?VARIANT?__RPC_FAR?*pvValues
??????/*?[size_is][in]?*/?WORD?__RPC_FAR?*pwQualities
??????/*?[size_is][in]?*/?FILETIME?__RPC_FAR?*pftTimeStamps
??????/*?[size_is][in]?*/?HRESULT?__RPC_FAR?*pErrors)
{
???if?(FEvDataChange?!=?NULL)
???FEvDataChange(dwTransid?hGroup?hrMasterquality?hrMastererror
????????????????????dwCount?phClientItems?pvValues?pwQualities
????????????????????pftTimeStamps?pErrors);
???return?S_OK;
}
HRESULT?STDMETHODCALLTYPE?CDataCallbackSink::OnReadComplete(
??????/*?[in]?*/?DWORD?dwTransid
??????/*?[in]?*/?OPCHANDLE?hGroup
??????/*?[in]?*/?HRESULT?hrMasterquality
??????/*?[in]?*/?HRESULT?hrMastererror
??????/*?[in]?*/?DWORD?dwCount
??????/*?[size_is][in]?*/?OPCHANDLE?__RPC_FAR?*phClientItems
??????/*?[size_is][in]?*/?VARIANT?__RPC_FAR?*pvValues
??????/*?[size_is][in]?*/?WORD?__RPC_FAR?*pwQualities
??????/*?[size_is][in]?*/?FILETIME?__RPC_FAR?*pftTimeStamps
??????/*?[size_is][in]?*/?HRESULT?__RPC_FAR?*pErrors)
{
???if?(FEvReadComplete?!=?NULL)
???FEvReadComplete(dwTransid?hGroup?hrMasterquality?hrMastererror
??????????????????????dwCount?phClientItems?pvValues?pwQualities
??????????????????????pftTimeStamps?pErrors);
???return?S_OK;
}
HRESULT?STDMETHODCALLTYPE?CDataCallbackSink::OnWriteComplete(
??????/*?[in]?*/?DWORD?dwTransid
??????/*?[in]?*/?OPCHANDLE?hGroup
??????/*?[in]?*/?HRESULT?hrMastererr
??????/*?[in]?*/?DWORD?dwCount
??????/*?[size_is][in]?*/?OPCHANDLE?__RPC_FAR?*pClienthandles
??????/*?[size_is][in]?*/?HRESULT?__RPC_FAR?*pErrors)
{
???if?(FEvWriteComplete?!=?NULL)
???FEvWriteComplete(dwTransid?hGroup?hrMastererr?dwCount
???????????????????????pClienthandles?pErrors);
???return?S_OK;
}
HRESULT?STDMETHODCALLTYPE?CDataCallbackSink::OnCancelComplete(
??????/*?[in]?*/?DWORD?dwTransid
??????/*?[in]?*/?OPCHANDLE?hGroup)
{
???if?(FEvCancelComplete?!=?NULL)
???FEvCancelComplete(dwTransid?hGroup);
???return?S_OK;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????3140??2011-07-07?15:59??OPClient.res
?????文件???????1032??2002-09-11?08:28??OPClient.tlb
?????文件???????2174??2002-09-11?08:28??OPClient_TLB.cpp
?????文件???????3683??2002-09-11?08:28??OPClient_TLB.h
?????文件???????2306??2011-07-09?16:05??多余的話.txt
?????文件??????12545??2011-07-09?15:48??bin\COPCClient.cpp
?????文件?????675328??2011-07-07?16:53??bin\OPClient.exe
?????文件??????15734??1998-10-01?14:19??opc\OPCCOMN.H
?????文件???????1179??1998-10-01?14:19??opc\Opccomn_i.c
?????文件??????93689??1998-10-14?12:15??opc\OPCDA.H
?????文件???????2167??1998-10-14?12:15??opc\Opcda_i.c
?????文件???????4441??1998-09-29?10:27??opc\OpcError.h
?????文件???????5238??2002-09-11?08:33??CustomSinks.h
?????文件???????2518??2000-03-14?11:50??DataCallbackSink.cpp
?????文件???????5115??2011-07-04?08:52??DataCallbackSink.h
?????文件????????436??2011-07-04?08:17??deltemp.bat
?????文件??????23785??2011-07-07?16:05??Main.cpp
?????文件???????2389??2011-07-09?15:44??Main.dfm
?????文件???????5776??2011-07-07?10:40??Main.h
?????文件???????9532??2011-07-09?15:47??OPClient.bpr
?????文件????????970??2011-07-09?15:46??OPClient.cpp
?????目錄??????????0??2011-07-09?16:06??bin
?????目錄??????????0??2011-07-02?09:22??opc
-----------?---------??----------?-----??----
???????????????873177????????????????????23
評論
共有 條評論