应用程序用OCX组件,该如何处理

应用程序用OCX组件
用VC开发一个应用程序,里面需要使用别人提供的OCX组件,以前没有做过ACTIVEX方面的开发,应该怎么调用这个OCX也不知道怎么做,有那位有这方面的经验,请把大致的步骤说一下,或者有例子的给一个小例子最好。

请这方面的高手不吝赐教!

------解决方案--------------------
There are 2 ways of importing an ActiveX control into a Visual C++ MFC application: 

1) By allowing the Class Wizard to generate wrapper classes for each one of the components contained inside the ActiveX. This is done automatically when you assign a member variable to the object. 

2) By using the #import directive as follows: 

In your precompiled header (STDAFX.H) 


// DEFINITION of COM wrappers
#import "sfxbar.dll" no_namespace no_implementation
#import "Cfx4032.ocx" no_namespace no_implementation
In your implementation (STDAFX.CPP) 


// IMPLEMENTATION of COM wrappers
#import "sfxbar.dll" no_namespace implementation_only
#import "Cfx4032.ocx" no_namespace implementation_only

------解决方案--------------------
VC6吗?Project->Add To Project->Components and Controls
楼上讲的也行,不过添加到窗体上时要自己写相应的代码,不能使用拖拽的方式
------解决方案--------------------
CoInitialize(NULL); 
short st = 2; 
short st1; 
// Declare the Interface Pointer for your Visual Basic object. Here, 
// _Class1Ptr is the Smart pointer wrapper class representing the 
// default interface of the Visual Basic object. 
 
_Class1Ptr ptr; 
// Create an instance of your Visual Basic object, here 
// __uuidof(Class1) gets the CLSID of your Visual Basic object. 
 
ptr.CreateInstance(__uuidof(Class1)); 
st1 = ptr->MyVBFunction(&st); 

catch(_com_error &e) 

bstrDesc = e.Description(); 
 

CoUninitialize(); 

------解决方案--------------------
从vc编译器中导入对应的ocx控件,编译器会生产对应的包装类等....
------解决方案--------------------
探讨
从vc编译器中导入对应的ocx控件,编译器会生产对应的包装类等....