I am writing a VC++ MFC dialog based app which requires Microsoft MapPoint embedding in it. To do this I'm using MS VC++ .NET 2003 and MapPoint Europe 2006 to do this but am having problems as when I select "Insert ActiveX Control" no MapPoint control appears in the list of options. I have tried manually registering mappointcontrol.ocx with regsvr32 which appears to succeed but still the control doesn't appear on the list.
Can anyone suggest what I am doing wrong here, and any possible solutions.
Thanks
Ian
Have you tried using the ActiveX control test container? Is it in the list of controls? How about using the register button in the test container?
Also check the registry to see if it is registered. You should have an entry in HKEY-CLASSES-ROOT\controlName that has a CLSID element that points to a UUID. That UUID should also be in HKEY-CLASSES-ROOT\CLSID\uuid and have a LocalServer32 entry that points to the DLL and ProgID that points back to controlName.
I have now got the Mappoint control working but in a slightly different way. The control does appear on the list of controls the test container can use. I have tried reregistering it and unregistering it but still it doesn't appear on the list of controls when I try a "Insert ActiveX Control". However if I use "Add/Remove Toolbox Items" I can add it to the toolbox and then drag it into my app where it works fine. I'm not sure why this method works but it does and I can get on with my coding.
Many thanks for all your help with this.
Related
I am trying to use Kitware ActiViz.NET. I have installed it using nuget.
But I can't seem to find RenderWindowControl on the toolbox. I have been trying to add it manually this way:
invoke "Choose Items..."
and in the following dialog click on button "Browse...",
navigate to your ActiViz.NET installation folder, browse to /bin
folder, select "Kitware.VTK.dll".
Click OK.
Now you should see in your ToolBox a new control named RenderWindowControl.
But I get "The file "C:\programfiles\activiz.net 5.8.0 Opensource Eddition\bin\kitware.vtk.DLL" is not valid".
I have tried to add the control in the code rether than the designer,and got this exception:
Could not load file or assembly 'Kitware.VTK, Version=5.8.0.607, Culture=neutral, PublicKeyToken=995c7fb9db2c1b44' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Has anyone had this problem before?
Any ideas?
For the design mode you would need to use the 32Bit version, because VS is running on 32Bit and can only load 32Bit controls.
So you could use for design time the 32Bit version and for build/release switch to the 64bit version.
But you can also add the RenderWindowControl manually.
Of course the designer will be unable to display this, so it would be
necessary to comment it out, before switching to the designer
Open your designer file e.g. Form1.Designer.cs and add the control like
private RenderWindowControl myRenderWindowControl;
private void InitalizeComponent()
{
//all other controls added by the designer
myRenderWindowControl = new RenderWindowControl();
myRenderWindowControl.SetBounds(0,0,640,480);
this.Controls.Add(this.myRenderWindowControl);
}
Adding VTK's RenderWindowControl to WPF is a little more complicated.
Assuming you installed a 64 bit VTK package, the following steps worked for me.
https://learn.microsoft.com/en-us/dotnet/framework/wpf/advanced/walkthrough-hosting-a-windows-forms-control-in-wpf
Add Project References to WindowsFormsIntegration and System.Windows.Forms
Draw a Grid on the Designer Form.
In Properties Dialog, Give it a name, then
Double Click the Loaded event.
In the loaded event handler add the code.
// Create the interop host control.
System.Windows.Forms.Integration.WindowsFormsHost host =
new System.Windows.Forms.Integration.WindowsFormsHost();
myRenderWindowControl = new RenderWindowControl();
myRenderWindowControl.SetBounds(0, 0, 30, 30); // not too big in case it disappears.
// Assign the control as the host control's child.
host.Child = myRenderWindowControl;
this.VTKGrid.Children.Add(host);
I am trying to automate WPF application (WPF with 3rd party devexpress) using coded UI (VS 2012) in my local machine (Windows server 2008 R2).
I am facing issues while identifying controls under dynamically generated content of the window. I've Tried different hierarchical levels to hit the control,But i am
still not able to hit the control.
Till some level I am getting the handle, but after I am not getting the handle.
My application is complex hierarchically structured with combining winforms and WPF.
I've Tried to use coded UI record and play feature to generate the UI Map and used the same structure to identify the controls. It worked while debugging line by line but it's failing while running.
e.g. Below is one hierarchy,
List item
Dashboard
Dash_Grid
LayoutManager
LayoutGroup
LayoutPanel -->Till this level I am able to get the handle and lower I am not able to hit the control
Container
Navtop
Nav_Grid
TileLayoutControl
........(all tiles)
This issue is not only with one page. I am having the same problem with all the pages.So this is blocking our automation.
Please can any one help me on this?
Try this two possible solutions:
Use the devexpress extension for codedui to identify and locate dexExpress controls:
https://www.devexpress.com/products/net/controls/winforms/coded-ui/
Dont replicate the elaborate hierarchy of your app when identifying controls but instead select the main controls in the hierarchy and use them to set your search properties. this is especially important for dynamically created content where the hierarchy is constantly changing.
in your example:
var List_item = new WpfListItem(parent);
List_item.SearchProperties.. = some search properties
and than set your control's parent to that top list item and ignore the midlle men:
var Container = new UITestControl(List_item);
where UITestControl should be replaced with the controls actuall type.
I have created an ActiveX control in VC++ 2012 using ATL. I would like to add a Font property and benefit from the stock property page that displays a font picker.
I have created a new control that has such a stock property using the control wizard. I've modified my code to reflect what I need to do to add the stock property. (I now implement ISpecifyPropertyPages; I have the relevant PROP_ENTRY_TYPE and PROP_PAGE entries in the property map) but when I attempt to display the property editor in the designer I get a 'Not Registered' type error.
I have ATL dynamically linked which, as I understand things, means I shouldn't need to link to any external DLL for ATL. However, where are the stock property pages implemented? Could it be that I don't have them, and need to register them somehow?
The problem you are perhaps facing is that stock property pages are hosted by MSSTKPRP.DLL and this component is not necessarily present/installed in Windows and is readily available. I would suggest not using stock property page and implement your own to avoid the troubling dependency.
See also:
Is there a x64 version of MsStkPrp.dll
Redistributing ATL and OLE DB Templates - at the bottom
So, I am playing around with ActiveX and C# and ways how both of them can work together. the thing is I have hit the wall right in the beginning with mentioned error. Steps I have followed:
In VS2010 I selected MFC ActiveX Control project. Then I added a method "SHORT Multiply( SHORT a, SHORT b);" by clicking the Add method option in the menu that pops when you right click _DProjectname under ProjectnameLib in solution explorer. The code for the method is as follows:
SHORT CSampleProgramActivex01Ctrl::Multiply(SHORT a, SHORT b)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
// TODO: Add your dispatch handler code here
return ( a * b);
}
Now I have created a simple C# console application that references the generated COM file and when I try to use the method, the application stops with the above mentioned error. I have searched the error on the internet but no clear solution is mentioned. Any help appreciated. If you guys want clarification, let me know.
I don't know whether this is considered as solving the problem or not but I found a workaround:
First instead of C# console application, I created C# windows form application. After creating the form, I have added the whole ocx as component in the toolbox. You do this by right-clicking the Toolbox types in Toolbox menu. In the new menu, you click Choose Items. This pops up new menu and in that select the COM tab and in that check your COM component and the COM component will be added to the Toolbox menu. Now drag and drop the component on the menu and you should be good to go.
This seems to be workaround that everybody is following. Not neat but that is the norm I think.
look at here: How to use an OLE control as an automation server in Visual C++
http://support.microsoft.com/kb/146120/en-us
I have already asked the same question but in regards with MDI Application design. Now just for R&D purpose so that we can go with 2 solutions to our user. Can somebody plz help me out...
We are developing an OutLook Style Application using C# Winforms. In that application we are using Microsoft Table Control. Which is what we need to show our UI. In the left hand pane we have menu and in the right hand we are displaying our UserControl. Like CustomerManager. This UserControl is doing Adding, Updating, Deleting ect etc but we want to put the common action buttons, Like Add,Delete,Save on the top toolbar.
So far so good, Now what we need to acheve is regardless of UserControl. What ever UserControl is loaded in the MainForm's TableControl. When the save button is clicked it should process the data on that UserControl. Obviously we will write the logic of the Save Action on each UserControl.
Please help...
Regards
Shanx
I may advice you the Krypton Toolkit. You will write an Outlook style app in seconds.
For all who ended up here like me in search of a free toolkit: As Vulkanino suggested to use Krypton, I loooked it up.
This is now open source Freeware and can be found unter: Krypton Toolkit
Create a Base user control that contains your Add, Delete, Save methods and events. Then create every other functional control that inherits from the Base control.
When you action the main toolbar buttons, you can safely cast each user control in your given container, to the Base user control.
Some MSDN links you might want to read up on:
http://msdn.microsoft.com/en-us/library/44a9ty12(VS.80).aspx
http://msdn.microsoft.com/en-us/library/ms173149(VS.80).aspx