VC中开发ACTIVE控件,用ATL开发和MFC ACTIVE 向导开发,为什么用ATL开发后生成的文件不是.ocx的呢?谁有在VC下用ATL开发active控件的资料,请发给我!

解决方案 »

  1.   

    ATL开发的是Com对象,扩展名是.dll或.exe。
      

  2.   

    生成文件类型并不重要,不信你把ocx改为dll,然后重新注册,使用起来一样。
    在编译设置里,你也可以输出为dll,这有什么关系?
      

  3.   

    只要支持COM就行了,扩展名用什么并不重要
      

  4.   

    谢谢大家的回复,我再请教个问题,如何在asp的程序里,调用ocx控件?
      

  5.   

    ADO就是一个ActiveX
    ASP里面用ADO的示例到处都是
      

  6.   

    MFC的ACTIVE开发是他把Active控件所需要的接口都跟你封装好了,你不需要了解Active控件需要哪些接口支持。
    ATL开发一般是开发简单Com组件,你要拿他来开发Active控件那可能就要自己加那些Active所需要的接口了。
    好像都是用MFC来开发Active组件。
      

  7.   

    这个是在MSDN上找到的,给控件加上license
    To add support for licensing with ControlWizard when you create your control project On the File menu, click New.
    In the New dialog box, click the Projects tab.
    Click MFC ActiveX ControlWizard.
    In the Project Name box, enter a project name. In the Location box, specify the project’s directory. Select either Create New Workspace or Add to Current Workspace (if you select this option, also specify the project of which this subproject will be a dependent). In the Platforms box, select a platform. 
    A directory for the new project is added to the currently specified workspace directory structure. ControlWizard uses the name that you specify in the Project Name box to derive default names for most of the files and classes it creates for the control project.Click OK to continue the wizard.
    On the first ControlWizard page, Step 1, specify any options you want. To specify licensing support, select the Yes, please option under the question Would you like the controls in this project to have a runtime license?
    On the remaining ControlWizard pages, select any other options for your project.
    Click Finish to confirm your project choices. 
    The New Project Information dialog box appears.Click OK to have ControlWizard generate the ActiveX control framework.三个函数
    VerifyUserLicense 
    Verifies that the control allows design-time usage by checking the system for the presence of the control license file. This function is called by the framework as part of processing IClassFactory2::GetLicInfo and IClassFactory::CreateInstanceLic.GetLicenseKey 
    Requests a unique key from the control DLL. This key is embedded in the container application and used later, in conjunction with VerifyLicenseKey, to create an instance of the control. This function is called by the framework as part of processing IClassFactory2::RequestLicKey.VerifyLicenseKey 
    Verifies that the embedded key and the control’s unique key are the same. This allows the container to create an instance of the control for its use. This function is called by the framework as part of processing IClassFactory2::CreateInstanceLic and can be overridden to provide customized verification of the license key. The default implementation performs a string comparison. For more information, see Customizing the Licensing of an ActiveX Control, later in this article.