I'm trying to get a list of clsid's for COM objects so that when I try to use an object, I know what the clsid is for the tag.
Thanks
Tom Magaro
Try the program "OLE-COM Object Viewer" that ships with the Windows SDK (you'll find it from the start menu). That shows you all the com objects that are registered on the system. It's a little limited though as you don't seem to be able to search within it. You can also use Regedit to do any searching as most COM objects have entries in the registry.
Related
While migration of old application, which built on VC6.0 framework. I am getting below error message when I tried to open Dialog box from Resource View windows.
The ActiveX control 6262D3A0-531B-11CF-91F6-C2863C338E30', is not registered on this computer. Register the control and try again.
Please suggest step to open the dialog. (Dialog having ActiveX control, which is absolute in latest window OS i.e. Window 10/11)
I tried to find ActiveX components on MS site, but no luck.
Two possibilities come to mind after you have ruled out that this is a standard Microsoft component:
It might be that this is a 3rd party component someone once bought. Look for an .ocx that might be present in the project files in a 3rd party folder. It could help, if you disclose the relevant lines in the resource file, so people have the chance to identify the component and with some luck tell you where you could get it.
There is a chance that this is a custom-made component: Look for a subproject and build it.
In any case register the component before use, for example regsvr32.exe path\to\your\component\the_comp.ocx. (On a 64-bit Windows, you might want to use C:\Windows\SysWOW64\regsvr32.exe, suppose this is a x86 project.)
I am trying to do basically what it says in the title: I have created a class library (dll) using .NET 6.0 and I would like to add that as a reference in an Excel/Access VBA document. I diligently followed the steps here:
https://learn.microsoft.com/en-us/dotnet/core/native-interop/expose-components-to-com
No matter what I try, I cannot add the resulting dll as a reference in Excel. I just keep getting the message: 'Can't add reference to the specified file'.
A bit more info: I am able to create the Assembly.comhost.dll file, and I think I have done everything correctly, but no joy.
This is rather frustrating, as doing this in .NET Framework is but a click of a couple of checkboxes. In .NET Core (.NET 6) It seems to be a bit of a nightmare. Also, being able to create a tlb from the dll was always a perfect confirmation that you would be able to add your reference in Excel.
ANY help is most welcome!
Thanks!
in the tutorial you hav ementioned, ther is a topic "Register the COM host for COM". here a file named "ProjectName.comhost.dll" is used to register the assembly to the registry as a COM type library.
After doing this, i could the assembly in VBS with the fowing conde:
set projectObject = CreateObject("ProjectNamespace.ProjectClass")
newValue = projectObject.ComputeNewValue("abc")
Right now, I was not able to establish a reference to that type library in my Excel 2016, but the code sample works in VBA as well.
I could also in VBA
Set projectObject = CreateObject("COMServer.Server")
MsgBox projectObject.ComputePi()
with this repository : https://github.com/dotnet/samples/tree/main/core/extensions/COMServerDemo
But that works only with Registered COM not with RegFree COM (Go check README).
Not every component is a suitable candidate for use under Reg-Free COM. A component is not considered suitable if any of the following are true:
The component is an out-of-process (ActiveX EXE) server. Only DLLs
are supported.
The component is a system component or part of the operating system,
such as XML, Data Access, Internet Explorer, or DirectX® components.
For example, you should not attempt to isolate components such as
Microsoft XML (MSXml.dll) or Microsoft Internet Controls
(SHDocVw.dll). These components are either part of the operating
system, or can be installed with a separate redistributable package.
The component is part of an application, such as Microsoft Office.
For example, you should not attempt to isolate components such as the
Microsoft Word Object Model or Microsoft Excel Object Model. These
two components are part of Office and can only be used on a machine
that has the full Office product installed on it.
The component is intended for use as an add-in or a snap-in, such as
an Office add-in or a control in a Web browser. Such components
typically require some kind of registration scheme defined by the
hosting environment that is beyond the scope of the manifest itself.
The other problem is an arbitrary application may not be designed to
recognize isolated components, as it probably doesn't have a way to
reference your component through a manifest.
The component manages a shared physical or virtual system resource.
For example, it could manage some kind of data connection shared
between multiple applications or a device driver for a print spooler.
Source : https://social.msdn.microsoft.com/Forums/en-US/cc08575d-3506-4a0f-a9e2-f23c2162ad38/using-net-excel-addin-with-registrationfree-com?forum=innovateonoffice
But I couldn't find a way to add it in Excel as a reference.
QTP doesn't recognize item when I disable some add-ins which was checked when I added them in to the repository
Note: I actually selected all the add in's when I added the objects into repository - .Net, JAVA, Oracle, Siebel, SAP, Web Services, Silverlight, ActiveX(I know I am a Noob). When I just select Web right now and run the script, it's unable to recognize the object and when I add the object again(with only Web checked), it's being added as a new object and is being recognized when I run it.
So my question is what is the relationship of an object with respect to add in? How does it go on to affect the property of the same object?
Add-Ins are Collections of Pre-Defined Object Types
The add-in contains built-in property sets for a specific group of related UI objects. This helps QTP identify the runtime objects more effectively for a specific type of application.
For instance, it's quite predictable that browser-based applications will be using the standard HTML elements, so the basic web objects (i.e. Page, Frame, WebButton, WebList) have already been defined in advance inside the Web add-in.
The Evil in Enabling All Add-Ins
Most likely, you're facing the issue because all add-ins were enabled during recording. QTP had the option to choose from any of the pre-defined objects in all of those add-ins as it sees fit. You could have ended up with an object repository that's a hybrid of object types found in multiple add-ins.
We faced this similar issue before where a web button (i.e. html input type="button") was recorded as a SAPWebButton. That's because all add-ins were enabled during recording and no one noticed. It worked fine until we disabled all other add-ins, except for the Web add-in. Since the Web add-in only knows about a WebButton not a SAPWebButton, this resulted into identification problems.
Prevention and Fix
The correct approach is to decide which add-in is most appropriate for your application type before recording, enable it and disable the rest.
You will have to manually update the problematic object via Update Run Mode. If there's too much, you'd be better off recording from scratch.
I'm working under windows Server 2008 :S
with restricted user not administrator.
using Visual Studio 2010
I try to run write this code
ApplicationClass app = new ApplicationClass();
Workbook book = app.Workbooks.Open("");
Worksheet sheet = (Worksheet)book.Worksheets[1];
Picture pict = sheet.Pictures(pictureName) as Picture;
Pictures() method not exist in sheet object !
But
When I try this code under windows 7 with Administrator user
The Picture() method is exist and every thing is OK
I wonder, if there is some thing with interop and windows security ?
If you visit the MSDN page for this, I can see two issues:
http://msdn.microsoft.com/en-us/library/microsoft.office.tools.excel.worksheet.pictures.aspx
This API supports the Visual Studio infrastructure and is not intended to be used directly from your code.
Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
It seems the reason is indeed a restricted user. Is there a reason you are using this API since documentation suggests that it should not be used directly. Perhaps you are missing a wrapper.
Hello previously i was using VC++ 6.0 and MFC where i used Microsoft Communication Control 6.0 for serial communication its fine.But now i am using vc++.net 2003 and MFC, i added Microsoft Communication Control (MSComm1) but in class view there is no CMSComm class will creating . But in VC++ 6.0 if i add the this ActiveX Control.The CMSComm class will created by default where i can call member functions like SetPortOpen() , GetPortOpen() .
so any body tell me how to insert the MScomm control along with class.
Thanks in Advance
You may be having problems because this Microsoft update set the ActiveX killbit on the control. It will no longer function. MS suggests that we use a newer version of the control or the API.
EDIT: I did this with VC# and am not sure if the steps are the same with VC++. I need to install it and try it before providing a better response.
Since serial port support wasn't added to .Net until version 2.0 I had to do the same thing for .Net 1.1 apps. In my project I added a reference to MSCommLib and added the MS Communications Control, version 6.0, to my toolbox. After dragging one onto the form I was able to program against it. You should also have a reference to AxMSCommLib, AxInterop.MSCommLib.dll (COM interop not port).
Sorry, I opened the project and can't find a way to add it to the Class View, but once you have a reference and create a variable like "private AxMSCommLib.AxMSComm com;" you can use the intellisense to see the methods and members of the object.
You can also see these with the Object Browser. If you have the reference set, open the object browser and then click on AxMSComm. All of the members should be listed in the pane to the right side. There isn't much help for how to use each of the members here.