Running the Sample C# Solution

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  Programmers' Reference > ActiveX Integration > ActiveX Integration Examples > C# >

Running the Sample C# Solution

The sample Visual Studio solution available in the folder <ApplicationFolder>\Examples\ActiveX\C# illustrates how to consume the XMLSpy ActiveX controls. Before attempting to build and run this solution, note the following steps:

 

Step 1: Check the prerequisites

Visual Studio 2010 or later is required to open the sample solution. For the complete list of prerequisites, see Prerequisites.

 

Step 2: Copy the sample to a directory where you have write permissions

To avoid running Visual Studio as an Administrator, copy the source code to a directory where you have write permissions, instead of running it from the default location.

 

Step 3: Check and set all required control properties

The sample application contains one instance of XMLSpyControlDocument and one instance of XMLSpyControlPlaceHolder controls. Double-check that the following properties of these controls are set as shown in the table below:

 

 

Control name

Property

Property value

XMLSpyControl

IntegrationLevel

ICActiveXIntegrationOnDocumentLevel

XPathDialog

PlaceholderWindowID

16

 

 

Here is how you can view or set the properties of an ActiveX control:

 

1.Open the MDIMain.cs form in the designer window.

 

Note:On 64-bit Windows, it may be necessary to change the build configuration of the Visual Studio solution to "x86" before opening the designer window. If you need to build the sample as a 64-bit application, see Prerequisites.

 

ax_build_config_01

 

2.Open the Document Outline window of Visual Studio (On the View menu, click Other Windows | Document Outline).

 

ax_doc_outline_xmlspy

 

 

3.Click an ActiveX control in the Document Outline window, and edit its required property in the Properties window, for example:

 

ax_properties_xmlspy

 

Step 4: Set the build platform

Create a build platform configuration that matches the platform under which you want to build (x86, x64). Here is how you can create the build configuration:

 

a.Right-click the solution in Visual Studio, and select Configuration Manager.
b.Under Active solution platform, select New... and then select the x86 or x64 configuration (in this example, x86).

ax_vs_build_platform

 

You are now ready to build and run the solution in Visual Studio. Remember to build using the configuration that matches your target platform (x86, x64); otherwise, runtime errors might occur.

 

On running the sample, the main MDI Frame window is created and contains an editing window with an empty XML document and a XPath Dialog window of XMLSpy at the bottom. Use File | Open to open any XML file from the XMLSpy examples folder. The file is loaded and displayed. After you load the document, you can start using the XPath dialog. Note that you may need to slightly drag the lower-right corner of the form to cause the dialog to redraw itself and display its contents.


© 2019 Altova GmbH