I have an ActiveX control that installed on my machine, and can be added from PowerPoint via:
Developers->Controls->More Controls->"My control".
I want the user to be able to add the ActiveX via Custom button on the Ribbon.
I successfully added a button to my custom Ribbon (VSTO). but I can't find a way to make this button adding "My Control" to the slide.
I also successfully added an Excel sheet by calling:
Shapes.AddOLEObject(1, 1, 100, 100, "Excel.Sheet", "", MsoTriState.msoFalse, "", 0, "", MsoTriState.msoFalse);
but I can't fint the appropriate way to add my custom ActiveX.
What am I doing wrong?
How can I load this ActiveX from C#?
After two days of searching an answer I found the trick:
the problem is that you need a specific string that recognize the ActiveX control.
what I did is:
open Word and on the developers ribbon record a macro (this option not exists in powerpoint) of mouse clicks
add your control (Controls->More Controls->"My control")
stop recording macro.
view the macro's VBA created (click edit macro) you can find a
string like "myControlLib.myControlctrl.1"
this is the string needed by the Shapes.AddOLEObject(...) as class name.
Microsoft have a utility called OLE/COM Object viewer. You can use it to find the ProgID (the string used to add ActiveX controls in PowerPoint) along with pretty much everything else you'll want to know about your control. Have a look at:
http://msdn.microsoft.com/en-us/library/d0kh9f4c.aspx
Related
I am developing simple active x control with VB6 . i am putting debug.print in control initialized event to test how it is initialized . I am using new vb form (for testing activex), to put ActiveX control and watching intermediate window for debug print , but nothing happen but MsgBOX function work ok. why debug.print is not working when method is called ? in container form It is mentioned in visual basic 6 secrets book but not working in my case
The problem is that you are not running your ActiveX control (OCX) within the same Visual Basic Group (VBG) so the control cannot access the debug/immediate window for the parent form application.
The solution is to load your form project and add click "File->Add Project" and select your existing ActiveX control project. Now when you debug you will see the messages from the OCX when you debug your form. In fact, you'll be able to step through all of the ActiveX code in a single debug session with one IDE loaded so it will accelerate your development when making changes to the control.
I have been searched about creating input dialog in windows form using visual c++ but I didn't found useful resource
Is there any exist function do this task ?
I know how to create an empty dialog but how I can add text box and buttons ?
Form ^ dlg1 = gcnew Form();
dlg1->ShowDialog();
No. You have to design a dialog with a field for information entry, put it up and retrieve the information entered.
Yes, actually. Just use a standard VBScript InputBox, which can be used in C++ via the IActiveScript interface. See my answer to a similar question for the full code example:
https://stackoverflow.com/a/52808263
It will automatically resize the dialog to the contents you specify in the arguments, so don't worry about creating your own dialog. Microsoft made one for you, so why not just use it? :)
I've just built an MS Outlook Add In using Visual Studio and Office 2010. I've installed it ok on 4 machines, but one user is getting the following error -
Error found in Custom UI XML of "...."
...
...
Failed to find Office control by ID
Everyone is running Windows 7 and Outlook 2010 - not sure why this person is having a problem. Can anyone suggest how to diagnose this?
For those having similar issues, you don't have to remove any add-in.
What is happening is: Outlook will try to load all ribbons (found in your ribbon xml) into any window the user goes to. Then it'll complain about not finding ID x or y.
Just make sure your GetCustomUI method in Ribbon.cs does not load the entire ribbon XML at once but rather loads it per fragment.
If you're not sure what IDs you need to target, use a breakpoint in GetCustomUI then start Outlook, surf different views (main, new email, new appointment, calendar...etc) in order to gather the IDs for the views wherein you need to show you add-in.
In my case, I needed Microsoft.Outlook.Explorer, Microsoft.Outlook.Mail.Compose and Microsoft.Outlook.Appointment.
Therefore I changed my GetCustomUI to:
public string GetCustomUI(string ribbonID)
{
switch (ribbonID)
{
case "Microsoft.Outlook.Explorer":
return GetResourceText("MyAddin.RibbonsForOutlookExplorer.xml");
case "Microsoft.Outlook.Mail.Compose":
return GetResourceText("MyAddin.RibbonForOutlookMailCompose.xml");
case "Microsoft.Outlook.Appointment":
return GetResourceText("MyAddin.RibbonForOutlookAppointment.xml");
default:
return null;
}
}
Of course, I had to break down my Ribbon.xml into the three XML files mentioned above. The result: Outlook will ONLY load the fragment needed for a given screen (appointment, new email ...) and will not complain about "not finding an ID on screen X or Y".
Finally, for those who are not sure why some users get that error while others don't: it's because of "Show add-in user interface errors" option (in Options -> Advanced). If that is unchecked then Outlook will ignore the malformed ribbon XML errors. If it checked, users will get related errors about your add-in (if any exists) and also about other add-ins.
If it works for everyone except one user. As #Brijesh Mishra mentioned check if the user has got any other addin and if he is having own quick access tool bar customized.
If he has got any of this then, remove the other addins and try to install or reset the quick access tool bar customization.
For all of you that use a Designer-based VSTO plugin, and not the XML solution.
I searched all the web for this problem, but only found XML-based solutions.
There's nothing for Visual Designer on the web, because in this case you don't have to override the "GetCustomUI" method.
Ribbons designed by using the Visual Designer return a RibbonManager by default.
This RibbonManager object represents all Ribbon (Visual Designer) items in the project and is automatically handled in background through the active window inspector.
So you don't have to write any special code to handle different windows.
To configure it correctly you just have to:
Add one extra Visual Designer Ribbon for every window the user goes to
in the Ribbon Object go under "RibbonType", open the checkbox list an only activate the corresponding window, where the ribbon should appear.
If there is more than one window checked in the list, Outlook trys to insert the ribbon in all the marked windows. Even if the corresponding window is currently not opened. That's the reason, why the error "Failed to find control ID" appears.
the actual fix for me was to separate the ribbon XML files containing the customUI and redirecting to the correct one in the GetCustomUI method (implemented using Office.IRibbonExtensibility)
in example:
public string GetCustomUI(string RibbonID)
{
switch (RibbonID)
{
case "Microsoft.Outlook.Mail.Read":
return GetResourceText("namespace.type1.xml");
case "Microsoft.Outlook.Mail.Compose":
return GetResourceText("namespace.type2.xml");
default:
return null;
}
}
I am trying to automatically click a PictureBox control from an old VB6 application using AutoIt. Window Info finds a control with class ThunderRT6PictureBoxDC and ID 15, and AutoIt successfully hides it if I run...
ControlHide($class, "", "[ID:15]")
However, when I try to click it using:
ControlClick($class, "", "[ID:15]")
...nothing happens - and #error is unset.
Clicking using MouseClick with the control coordinates works, but then I have to make sure that the window isn't covered by anything.
Does anyone know why nothing happens, and what I can do to workaround without resorting to MouseClick?
I don't know AutoIt, but possibly this is because the control is a PictureBox rather than a button, so Windows doesn't support the concept of a "click" on this control. Can't think of any alternative workaround.
I've programmed an add-in for VS2010, one of the code-lines from this add-in is:
Command command = commands.AddNamedCommand2(
_addInInstance, "MyAddIn", "MyAddIn",
"bladiebla", true, 59, ref contextGUIDS,
(int)vsCommandStatus.vsCommandStatusSupported
+ (int)vsCommandStatus.vsCommandStatusEnabled,
(int)vsCommandStyle.vsCommandStylePictAndText,
vsCommandControlType.vsCommandControlTypeButton);
The number 59 is the code of the icon to use.
Somehow when you use the number 59, a smiley appears as icon. Some testing did show that 47 shows an eraser, and 58 shows a x2-sign.
One question is where those icons come from?
Another question is how to add my own icon.
I tried:
var bitmap = new Bitmap(#"c:\myicon.ico");
and replace the number 59 with the bitmap object (this should be possible because the parameter for that function requests an object. But this did not work.
Look at my bookmarks, these references should be of use to you:
For information about how to find the ID numbers for standard icons, see Listing Button Faces in the Command Bar for the Microsoft Office System on the MSDN Web site.
How to: Change the Default Icon for an Add-In
ref: http://msdn.microsoft.com/en-us/library/ms165626(v=VS.100).aspx
How to: Display a Custom Icon on the Add-In Button
ref: http://msdn.microsoft.com/en-us/library/ms228771.aspx