龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > 软件开发 > VC开发 >

精通VC与MATLAB联合编程――综合举例二[组图](3)

时间:2009-12-30 15:42来源:未知 作者:admin 点击:
分享到:
6、调用代码: if(FAILED(CoInitialize(NULL)))//COM初始化{MessageBox("Error");}ISJHSJY *pclass=NULL;HRESULT hr=CoCreateInstance(CLSID_SJHSJY,NULL, CLSCTX_ALL, IID_ISJHSJY, (void **)pclass);if(S

6、调用代码:

if(FAILED(CoInitialize(NULL)))//COM初始化{MessageBox("Error");}ISJHSJY *pclass=NULL;HRESULT hr=CoCreateInstance(CLSID_SJHSJY,NULL, CLSCTX_ALL, IID_ISJHSJY, (void **)&pclass);if(SUCCEEDED(hr)){long int u=6;HRESULT hr1=pclass->sjhsjy(u,&w1,&b1,&w2,&b2,&et,&a2,PP,TTT,me,eg,lr,P2,T2,S1);//函数调用   if(!SUCCEEDED(hr1)){MessageBox("请输入正确数据");return;}//函数调用失败   if(SUCCEEDED(hr1))   {   memcpy(W1,w1.parray->pvData,420*sizeof(double));//将Variant型结果数据转换成double型   memcpy(W2,w2.parray->pvData,240*sizeof(double));   memcpy(B1,b1.parray->pvData,60*sizeof(double));   memcpy(B2,b2.parray->pvData,4*sizeof(double));   memcpy(ET,et.parray->pvData,4*sizeof(double));   memcpy(A2,a2.parray->pvData,4*sizeof(double));      m_edit7.Format("%f %f %f %f ",ET[0],ET[1],ET[2],ET[3]);   }}else {MessageBox("COM组件调用失败!","提示",MB_ICONHAND);exit(0);}//COM组件调用失败pclass->Release();CoUninitialize();//结束COM7、程序运行结果:


图3

精彩图集

赞助商链接