com_testclass_com.cpp
来自「MATLAB7.0课本所有程序清单,共37章,特别适合初学者,可以帮助节省大量时」· C++ 代码 · 共 79 行
CPP
79 行
#include "com_testclass_com.hpp"
#ifdef __cplusplus
extern "C" {
#endif
extern const unsigned char __MCC_com_test_public_data[];
extern const char *__MCC_com_test_name_data;
extern const char *__MCC_com_test_root_data;
extern const unsigned char __MCC_com_test_session_data[];
extern const char *__MCC_com_test_matlabpath_data[];
extern const int __MCC_com_test_matlabpath_data_count;
extern const char *__MCC_com_test_mcr_runtime_options[];
extern const int __MCC_com_test_mcr_runtime_option_count;
extern const char *__MCC_com_test_mcr_application_options[];
extern const int __MCC_com_test_mcr_application_option_count;
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
static void mlxEvent_test_event(int nlhs, mxArray *plhs[],
int nrhs, mxArray *prhs[])
{
g_EventMap.invokeA(mclGetActiveID(), "event_test", nrhs, prhs);
}
#ifdef __cplusplus
}
#endif
Ccom_testclass::Ccom_testclass()
{
if (!mclInitializeComponentInstance(&m_hinst, __MCC_com_test_public_data,
__MCC_com_test_name_data,
__MCC_com_test_root_data,
__MCC_com_test_session_data,
__MCC_com_test_matlabpath_data,
__MCC_com_test_matlabpath_data_count,
__MCC_com_test_mcr_runtime_options,
__MCC_com_test_mcr_runtime_option_count,
true, COMObject, LibTarget,
g_Module.getPath(), NULL, NULL))
Error("Could not create MCR instance");
if (!mclRegisterExternalFunction(m_hinst, "event_event_test_2e010447", mlxEvent_test_event))
Error("Error registering event functions");
RegisterListener();
}
Ccom_testclass::~Ccom_testclass()
{
UnregisterListener();
if (m_hinst)
mclTerminateInstance(&m_hinst);
}
HRESULT __stdcall Ccom_testclass::plot_test() {
return( CallComFcn( "plot_test", 0, 0, 0 ) );
}
HRESULT __stdcall Ccom_testclass::property_test(/* [in] */ long nargout,
/* [in,out] */ VARIANT* result) {
return( CallComFcn( "property_test", (int) nargout, 1, 0, result ) );
}
HRESULT __stdcall Ccom_testclass::get_A(/* [out, retval] */ VARIANT* A) {
return( GetProperty( "A", A ) );
}
HRESULT __stdcall Ccom_testclass::put_A(/* [in] */ VARIANT A) {
return( PutProperty( "A", &A ) );
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?