ActiveX control programs are modular programs designed to give a specific type of functionality to a parent application. For example, you can create a control such as a button for use in a dialog, or toolbar for use in a Web page.
After you have created your project, you can view the files created in Solution Explorer. For more information about the files the wizard creates for your project, see the project-generated file ReadMe.txt. For more information about the file types, see File Types Created for Visual Studio C++ projects.
After you have created your project, you can use the code wizards to add functions, variables, events, properties, and methods. For more information about customizing your ActiveX control, see MFC ActiveX Controls.
It must implement a bunch of interfaces, key ones are IOleObject and IOleWindow. The kind of interfaces that allows it to do the required negotiations with an ActiveX host and create a visible window. The Winforms Control class is your best bet to create one.
This assigns the ProgID, and also defines that the interface exposed should be 'AutoDual' - this crufts up a default interface for you from all public, non-static members of the class. If this isn't what you want, use one of the other options.
The RegisterClass function is attributed with ComRegisterFunction - this static method will be called when the assembly is registered for COM Interop. All I do here is add the 'Control' keyword to the registry, plus add in the CodeBase entry.
CodeBase is interesting - not only for .NET controls. It defines a URL path to where the code can be found, which could be an assembly on disk as in this instance, or a remote assembly on a web server somewhere. When the runtime attempts to create the control, it will probe this URL and download the control as necessary. This is very useful when testing .NET components, as the usual caveat of residing in the same directory (etc) as the .EXE does not apply.
I have a module that creates a modeless dialog containing an ActiveX control. This module was part of an MFC EXE application and the creation of the dialog worked fine. Recently, I moved the module out into an ATL/COM server and copied the dialog resource from the EXE into the COM server. When trying to create the modeless dialog using CDialog::Create() an error happens.
I debugged into CDialog::Create and noticed that it fails in ::CreateDialogIndirect() which returns NULL and GetLastError returns 0. I changed the "No Fail Create" flag to True in the dialog resource properties and I get more details into the error. The problem happens in the dialog's DoDataExchange() within the DDX_Control macro. This calls into the CDataExchange::PrepareCtrl() with the control's resource ID as follows:
I had exactly the same problem. In my case the problem turned out to be that I hadn't called AfxEnableControlContainer(). I added a call to that in my app's InitInstance member function and it fixed the problem.
Had a similar problem just the other day. Copied a control from one dialog resource to another. As it happened, you can't just copy an ActiveX control from one dialog to another the way you do with other MFC controls. For an ActiveX control the rc file contains a DLGINIT section. For example I have a form with an IE WebBrowser control:
e.g. if you create a dialog instance of CDialogExExample by virtual function CDialogExExample::Create(CONTROL_ID, ..), while the CONTROL_ID is inconstant with the IDD_EXAMPLE(enum IDD = IDD_EXAMPLE;) in CDialogExExample header file....then one could add control fails always.
making sure you have the correct ID. The error you are getting might be a result of copying and pasting code from another header file of a previously created control / dialog without updating this ID.
Trying to use an ActiveX control I added to my CVI project. I use the ActiveX Controller Wizard to create an ActiveX control. Then I tried using one of the ActiveX control functions but it requires I get an Object Handle. The ActiveX Control Help says I can get the Object Handle by using GetObjHandleFromActiveXCtrl or an ActiveX method or property. I looked through all the functions my ActiveX control has and could not find anything that would get an Object Handle. The GetObjHandleFromActiveXCtrl function requires a panel handle which my project does not have or use. Any suggestions on what to do next?
But inside this other page : NI explains some changes in Windows Media Player, and why I have problems to recreate an old example (my WMP version is 9), and that I have to use setURL function instead of the previous setFileName function.
I have a third party ActiveX Control that I want to package up in a msi so it can be deployed and registered via Group Policy. The goal being I don't want the end user to have to click through and install the ActiveX control in IE.I have the Cab file which contains (2) ocx files, (1) inf file, and (1) dll.How do I know get these installed and registered as an ActiveX in IE?
What you're asking for is completely feasible. The "how" you do it, basically, is to learn to use an MSI authoring tool, determine where the files need to go on the hard drive, determine what needs to go into the registry, and build an MSI file that does what you want.
There is an absolutely wonderful WiX tutorial maintained by Gbor DEK JAHN. If you're looking to build a silent installer w/ no UI then there is a lot of this tutorial that you don't really need to learn, but it's still great stuff.
The snapshot-based package builders suffer from the problem of picking up unrelated changes to the snapshot computer during software installation and can create really messy packages. I will sometimes use a snapshot tool to get a "feel" for what an installer does, but I always build my production packages by-hand.
The non-snapshot-based systems are usually just graphical IDEs for the MSI schema (and some general WiX XML source files that are "compiled" with WiX), allowing you to drag and drop, etc, to create packages.
Whtever you do, gaining some knowledge about how the Windows Installer works will give you the best chance of building good packages. Microsoft's documentation is a bit dense, but there's a lot of good stuff in there. In the end, I've found that trial-and-error has been the best way to get familiar with the nuances of Windows Installer.
I haven't tried this, but I would have concerns about how an automated deployment of an ActiveX control would interact with Internet Explorer security. My gut feeling is "not very well". I'd be more inclined to configure policies to trust either the site using the control (if you're satisfied that it's safe to do so) or the control itself (which could be a little fiddly) and let the control come down in the normal manner.
An ActiveX control is a software component that integrates into and extends the functionality of any host application that supports ActiveX controls, such as C++Builder, Delphi, Visual Basic, Internet Explorer, and Mozilla Firefox. ActiveX controls implement a particular set of interfaces that allow this integration.
For example, Delphi comes with several ActiveX controls, including charting, spreadsheet, and graphics controls. You can add these controls to the Tool Palette in the IDE, and then use them like any standard VCL component, dropping them on forms and setting their properties using the Object Inspector.
An ActiveX control can also be tested by adding a reference to the ActiveX control in an HTML file, which can then be viewed with ActiveX-enabled Web browsers. See Creating a Windows VCL ActiveX Active Form.
Creating ActiveX controls using Delphi is very similar to creating ordinary controls or forms. This differs markedly from creating other COM objects (see Creating Simple COM Servers - Overview, where you first define the object's interface and then complete the implementation. To create ActiveX controls (other than Active Forms), you reverse this process, starting with the implementation of a VCL control, and then generating the interface and type library once the control is written. When creating Active Forms, the interface and type library are created at the same time as your form, and then you use the form designer to implement the form. Type libraries are now stored in a proprietary format, the RIDL File.
The completed ActiveX control consists of a VCL control that provides the underlying implementation, a COM object that wraps the VCL control, and a type library that lists the COM object's properties, methods, and events. For details, see Elements of an ActiveX Control.
I created a macro to create command buttons on sheet 1 of my worksheet. The created buttons using oleobject and class type: forms.commandbutton1, creates an object with no properties on the sheet (i.e. if you right click on it excel thinks it's an object and not a control.) Is there a way to create it as a control?
[SIZE="2"][center]Merge Or Convert Excel Trading Add-ins For Excel Convert Excel Into Web Pages Convert Databases Including Excel Business Spreadsheets Build Automatic Trading Models in Excel [/SIZE][/center]
Software developers have used ActiveX controls on their web pages to add advanced functionality to the web experience. With my migration from a Visual Basic 6 world to a Microsoft .NET C# world, I had some questions as to how I could create an ActiveX control with. NET. After some research, I found out that the solution is really quite simple. Create a Windows control project in Visual Studio .NET and expose an interface to the COM world.
Once the project is created, delete the Class1.cs file from your project as it will not be necessary. Next, add a User Control to the project by right-clicking on the project in your solution explorer, choosing Add, then User Control. Name your user control myControl.
c80f0f1006