Building .NET Applications Using the 64-bit Engine

You can configure Visual Studio to build a .NET application using the 64-bit engine for an existing project or a new project.

Code Samples

The STK Engine code samples that ship with the STK 32-bit install can be used with both the 32-bit and 64-bit versions of STK. The Visual Studio solutions have both x86 and x64 configurations. Based on the configuration you select, the examples use the corresponding version of STK Engine. If you try to use a configuration for which the corresponding version of engine is not installed on your machine, the following message is displayed at startup:

If you get this message, please make sure you selected the correct configuration for the version of STK/STK Engine installed.

Existing Project

To use the 64-bit version of STK Engine in your Visual Studio C# or VB.NET project, select the configuration to Any CPU, and then rebuild your application. If the Any CPU configuration is not already available in your solution:

  1. Go to the Configuration Manager (by clicking on the last option as shown below).
  2. In the Configuration Manager click on the <New…> option as shown below.
  3. Then in the New Solution Platform dialog, select Any CPU for the new platform and copy the settings from x86.
  4. At this point select the Any CPU configuration, rebuild and run your application. The application will start as a 64-bit application. To double check bring up task manager: the “*32” suffix after the process name is no longer there, confirming that this is a 64-bit process.
  5. Behind the scene, Windows selects the correct version of the STK Engine components based on the running application. If the application is running as 32-bit, the 32-bit engine DLLs are automatically loaded. If it is a 64-bit application, the 64-bit engine DLLs are selected automatically.

New Project

With STK 32-bit Installed

If the STK 32-bit version is installed side by side with the 64-bit version, creating a new project is similar to the steps used for the 32-bit application. You can follow the steps described in the existing 32-bit tutorials. Then switch the build configuration to Any CPU as indicated above.

Without STK 32-bit Installed

It is a little bit more complicated if the 32-bit version of STK is not installed. In this case, dragging and dropping an STK Engine control from the Visual Studio toolbox is not going to work. Basically, Visual Studio is a 32-bit application, and the designer cannot use 64-bit controls (this issue is described on MSDN KB963017 – see http://support.microsoft.com/kb/963017 ). So if you still want to use the designer, you must install the 32-bit version of STK Engine. Another workaround is to skip the toolbox/designer and instantiate the controls manually yourself in code.

For example:

  1. Look at the code for the globe control:
  2. private AxAGI.STKX.AxAgUiAxVOCntrl axAgUiAxVOCntrl1;
    
          private void InitializeComponent()
            {
                System.ComponentModel.ComponentResourceManager resources = new 
                                 System.ComponentModel.ComponentResourceManager(typeof(Form1));
                this.axAgUiAxVOCntrl1 = new AxAGI.STKX.AxAgUiAxVOCntrl();
                ((System.ComponentModel.ISupportInitialize)(this.axAgUiAxVOCntrl1)).BeginInit();
                this.SuspendLayout();
                // 
                // axAgUiAxVOCntrl1
                // 
                this.axAgUiAxVOCntrl1.Dock = System.Windows.Forms.DockStyle.Fill;
                this.axAgUiAxVOCntrl1.Enabled = true;
                this.axAgUiAxVOCntrl1.Location = new System.Drawing.Point(0, 0);
                this.axAgUiAxVOCntrl1.Name = "axAgUiAxVOCntrl1";
                this.axAgUiAxVOCntrl1.OcxState = ((System.Windows.Forms.AxHost.State) 
                                       (resources.GetObject("axAgUiAxVOCntrl1.OcxState")));
                this.axAgUiAxVOCntrl1.Size = new System.Drawing.Size(427, 342);
                this.axAgUiAxVOCntrl1.TabIndex = 0;
          ... 
    
    
  3. Now go back to the form design page. You will be able to use the designer to lay out the control and access its properties.
  4. Use the same approach can be use for the other STK Engine controls.

STK Programming Interface 11.0.1