FAQ Database Discussion Community


How to determine ActiveX control interface has function in client application

com
We are using a 3rd party ActiveX control in our application, recently as per our request they have added new function in ActiveX control interface and we are trying to access those function in our application. Due to some reason there are chances where we can not deploy our 3rd...

Creating Com Error 80004005

windows,com,foxpro
Im trying to run FoxPro in Windows 2012, I have registered the dll using regsvr32 When i try to run the app using the dll, i got this Error: Creating an instance of the COM component with CLSID {F6C4F46E-58A4-4774-802F-1CF9E64376B0} from the IClassFactory failed due to the following error: 80004005. Trace:...

Using VB.net Collection class via COM returns error: “Class doesn't support automation”

vb.net,com
I have an existing VB.net class library which has a public property with a type of VB's Collection class. I'm exposing the class library as a COM-object to be able to use it in Progress. When I access the Collection-property with an integer index (e.g. comObj.OutputCol.Item(1)) it works fine, but...

Executing cscript using IActiveScript with C++

c++,com,cscript,iactivescript
I'm trying to execute a script using cscript with IActiveScriptParse and ParseScriptText but for some reason I get an error: E_UNEXPECTED. This article has helped me a lot. I'm using its getEngineGuid function in my code. The code below is what I've tried. It prints: -2147418113 -2147418113 Meaning activeScriptParse->ParseScriptText returns...

Ensure that process started by COM connection is killed

python,python-2.7,com,win32com,minitab
I'm automating Minitab 17 using Python's win32com library, and while all of commands execute correctly, I can't seem to get the process started by the Minitab process to exit when my script ends. My structure looks like from myapi import get_data import pythoncom from win32com.client import gencache def process_data(data): #...

COM registration for a 64-bit application

c#,.net,com,64bit,registry
I am creating an Installer for a 64-bit application that uses a third-party SDK. This SDK requires COM registration and seems to have some conflicting instructions so I'd like to find out best practices regarding the follows: To achieve registry-free activation (for the COM DLLs which support them), I am...

FileDescriptora Missing Characters

c#,winforms,com,outlook,clipboard
I am using the code found here to drag-drop .msg files directly from outlook. The FileDescriptorA class is implemented like this: [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] public sealed class FILEDESCRIPTORA { public uint dwFlags; public Guid clsid; public SIZEL sizel; public POINTL pointl; public uint dwFileAttributes; public System.Runtime.InteropServices.ComTypes.FILETIME ftCreationTime; public System.Runtime.InteropServices.ComTypes.FILETIME...

Can I have a COM interface in a service to be called from Windows Script Host?

c++,com,mfc,jscript,wsh
My goal is to create a COM interface in my Windows local service, written with C++/MFC, whose methods could be called from a Windows Script Host JScript code running under a logged in interactive user account. For instance, if I have a test.js that can be started with credentials of...

Running a function in DLL(.net) in PHP - Nothing seems to work

php,asp.net,.net,dll,com
Ok, I have gone through almost every question, PHP Manual and post around this issue all over the internet. Nothing seems to help. I'm working on a project that needs me to authenticate (or at least be able to lookup the UID for) different users in my organisation on an...

Call IConnectionPoint::Advise cause a crash

c++,com,rpc
In my project, I wrote a component which will be called in a service(COM server). There is another process will get this component's interface and register a callback interface through connection point. So the service could use the callback interface to do some feedback. But I found that when I...

Visual Studio causing embedded assembly manifest to be ignored while debugging

visual-studio,visual-studio-2013,com,registration-free-com
My .NET client application has a dependancy on another assembly. This dependancy is declared in an app.manifest file: app.manifest <?xml version="1.0" encoding="utf-8"?> <asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <assemblyIdentity version="1.0.0.0" name="Contoso.Frobber.Admin"/> <!-- We have a dependancy on Grobber -->...

How can a dialog become responsive while waiting for a call to DoModal() to return?

winapi,com,mfc,modal-dialog
A button on a dialog causes a child dialog to be created, and displayed modally. e.g: void ParentDialog::OnButton() { ChildDialog dlg; int ret = dlg.DoModal(); } The parent dialog is initially unresponsive as expected. But, the child dialog also makes COM calls to a server module, which causes the server...

python win32com “PumpWaitingMessages()” processing

python,python-3.x,com,win32com
I use Python 3.4. I have a program that provide an integration with COM module in Windows, by win32com package. To process messages from this module I use the pythoncom.PumpWaitingMessages() method in the infinite while loop. But python infinite loop makes 100% CPU core load (as shown in Windows Task...

How to modify Registry Value owned by System

c++,windows,winapi,com,registry
I'm trying to change registry value, and I receive this error code as result(Error code 1: Incorrect function.). I receive this error code inside, ModifyValue as result of RegSetValueEx. The method is defined in: utils.h Could someone help me ? I have uploaded the code on GitHub: https://github.com/mariopavlov/C/tree/master/RegistryManipulations Thank you...

Why is the generated wrapper for property type selecting this interface?

.net,com,rcw
When I ask Visual Studio to generate runtime callable wrappers for my COM components, it is selecting a strange type to wrap a certain interface property. This is a summarized type library for component A: // Generated .IDL file (by the OLE/COM Object Viewer) // // typelib filename: prodist.sts.dll [...

Why .NET MailAddress' class properties are readonly

c#,com,default-constructor,mailaddress
I want to inherit from MailAddress class to make a COM visible class, but MailAddress does not have a parameterless constructor, and COM doesn't have a mechanism to pass arguments to a constructor. https://msdn.microsoft.com/en-us/library/system.net.mail.mailaddress%28v=vs.110%29.aspx so, i have to create a class like this, thinking about in just create it and...

Media Foundation set video capture frame rate using PROPVARIANT structure

c++,windows,com,ms-media-foundation
I'm writing a media foundation application where I need to set the capture frame rate for a video device. The function I'm writing is something like: bool SetRequestedFrameRate(const size_t requestedFramesPerSecond); where I pass a user-defined integer as the frame rate parameter. I'm following the code snippet on https://msdn.microsoft.com/en-us/library/windows/desktop/ff485859(v=vs.85).aspx : PROPVARIANT...

C# COM-Interop dll for C++ COM dll doesn't work between 2 solutions

c#,c++,.net,com,interop
I am trying to reuse an interop DLL that compiled in one project on another, and it doesn't work. I'll elaborate: I compile the C++ COM DLL native_com_object.dll In the same solution I have a C# project called LocalComClient.dll that generates Interop.native_com_objectLib.dll to use the C++ native_com_object.dll. Last, I have...

LaunchAdvancedAssociationUI in C# -> Element not found on Windows 8

c#,windows-8,com,com-interop
I'm trying to set up a way to manage file associations for my program in C#. I already set the correct values in the registry with WiX, and found a wrapper for ApplicationAssociationRegistrationUI which should allow me to open the GUI to set file associations. But it doesn't work. I...

How to make make a .NET.COM object to be apartment-threaded?

c#,.net,multithreading,com,com-interop
.NET objects are free-threaded by default. If marshaled to another thread via COM, they always get marshaled to themselves, regardless of whether the creator thread was STA or not, and regardless of their ThreadingModel registry value. I suspect, they aggregate the Free Threaded Marshaler (more details about COM threading could...

In an Asynchronous Pluggable Protocol thread - how can this be associated/resolved to a particular COM object implementing ::SetSite()?

multithreading,com,bho,pluggableprotocol
In IE11, multiple threads will fire into the APP when visiting a site such as www.yahoo.com - and only a very small subset of those threads can be associated with the browser window (by querying the service provider, et cetera) that was passed through in the ::SetSite() call when the...

Debugging a .NET COM DLL loaded by unmanaged C++ binary in Visual Studio

c++,.net,visual-studio-2010,com,interop
I'm using VS2010. I have an unmanaged EXE written in C++ that's using a .NET COM component which is also part of the same solution. I know that the COM object was created successfully because CoCreateInstance returned without an error. Yet, the component symbols aren't loaded (I can also notice...

ArcObjects ExcelWorkspaceFactory Won't Release Excel File

c#,com,arcobjects
I'm working with ArcObjects to set up a batch import from xls and csv files into a geodatabase. That part works fine, but after the import, I want to delete the file. This, however, doesn't work, because the file is still open. None of the interfaces being used descend from...

Akka.net actors in STA

c#,com,ms-word,sta,akka.net
I need to convert thousands of ms office documents in different formats into one common format. To get things faster i would parallelize it using akka.net for. The WordSaveAsActor should: run in Single-Threaded Appartment hold the Word Application instance make COM calls on this instance, like SaveAs(..) with paths from...

VSTO: manipulating COM objects (“one dot good, two dots bad”)

c#,excel,vba,com,vsto
Coming from an Excel VBA background I would frequently write code such as: Range("myRange").Offset(0, 1).Resize(1, ccData).EntireColumn.Delete I'm now moving to VSTO, and have been reading about RCW counters, etc., and the need to explicitly release COM objects. The basic advice seems to be: don't chain together references to Excel objects...

Unable to use C# COM object from Perl

c#,perl,com,ole
I'm trying to create a C# COM Object to be used in a Perl script (As far as I understand COM is the best way to go). Here is the C# code: using System.Runtime.InteropServices; namespace ExampleCom { [Guid("EAA4976A-45C3-4BC5-BC0B-E474F4C3C83F")] public interface IComClass { } [Guid("7BD20046-DF8C-44A6-8F6B-687FAA26FA71")] [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] public interface IComClassEvents { }...

Can I force collection for objects of certain type only?

c#,.net,com,garbage-collection,rcw
I have a problem with RCWs not being timely collected. I think of periodically force-starting garbage collection from inside code. However I'm not sure if that will have some undesired slowdown. I'm not actually interested in collecting all objects, I only need RCWs collected and they all have System.__ComObject type....

Windows Forms WebBrowser control error on .net 4.0 framework

c#,.net,com,.net-4.0,winforms-interop
I have a fatal error thrown from my c# code where I have customized forms web browser to support browser autocomplete functionality. The exception gets thrown only on .net 4.0 framework, when we try to obtain the WebBrowserSite COM interfaces. error thrown at _baseIDocHostUiHandler = (WebBrowserNativeMethods.IDocHostUIHandler) Marshal.GetTypedObjectForIUnknown(_unkInnerAggregated, typeof (WebBrowserNativeMethods.IDocHostUIHandler)); Code:...

Fatal error on Custom WebBrowser (winforms) code

c#,winforms,com,webbrowser-control
Getting a fatal exception on the CustomWebBrowser (winforms) code. “The runtime has encountered a fatal error. The address of the error was at 0x6c9a60c6, on thread 0xf94. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user...

Component services. programmatically add component with specific user credentials. vb.net

vb.net,com,comadmin
I am trying to add components to com services in a vb.net app. I have gotten everything working as it should apart from assigning a user role to the component. The component cant be accessed without this specified role. Below is my code for adding the object, I keep getting...

How to unregister Python COM server

python,windows,vba,dll,com
I'm developing a very simple COM server for educational purpose. I can get it to work but every time i have to change anything (code/logic) , i have to delete every instance of the COM Server Name in the regedit.exe under various headings till it disappears from the PythonWin >>...

How do I invoke the MIDL compiler to generate a .TLB file (type library) from an .IDL file?

winapi,com,idl,type-library,midl
I am struggling with something seemingly super-simple: I'd like to use the MIDL compiler to generate a type library (.tlb file) from a .idl file. However, I just can't get MIDL to generate a .tlb file. This is my Foo.idl: import "unknwn.idl"; [object, uuid(400075B9-4BD6-45A5-B8B7-9DA0CF7B9B13)] interface IFoo : IUnknown { HRESULT...

Why CoCreateInstance can't create an instance of my component?

c++,com
I am learning COM through the book "Inside COM" of Dale Rogerson. I try to register my component in the registry and then through this info create an instance of my component in the code of my client. But I see ::FormatMessage function writes this: Class not registered. So, ::CoCreateInstance...

Converting a vb.net dictionary to a vba dictionary

vb.net,vba,excel-vba,dictionary,com
I was pleased to find that I could call structs that I had set up in vb.net straight into excel vba - using COM visible and registering using regasm.exe. I am struggling to do the same with a dictionary created in vb.net. I found this link which suggested that the...

Open array declaration lost when regenerating interop.dll with tlbimp.exe from type-lib

c#,com,tlbimp
I need to regenerate the interop.dll from a type-library. Therefore I fired up TlbImp.exe" foo.tlb /out:interop.dll But in contrast to the original interop.dll, I found out with the object browser (see below) void SetNodeArr(int Size, FOO_NODE[] pArray) // original interop.dll that the open array for the method-parameter for SetNodeArr is...

Defining STA: “single thread affinity” or “single threaded apartment”; and how they relate

c#,wpf,winforms,com,sta
I'm working with WPF and am reading through materials on STA. Two questions: 1) STA is defined as standing for both "single thread affinity" and "single threaded apartment" by different articles. This says the former: https://msdn.microsoft.com/en-us/library/ms750441(v=vs.110).aspx This says the latter: https://msdn.microsoft.com/en-us/library/ms742522(v=vs.110).aspx Which is it, or can STA refer to either...

How To Reference a Com Object in a WCF Service

wcf,silverlight,com
I need to reference a Com DLL from within a Silverlight program. Since this is not allowed, I created a wcf service and put my reference to the Com in it. This idea seems to work fine when I ran my wcf service from my local machine but when I...

Retrieving session ID from COM method

powershell,com,powershell-v3.0
I have a method named GoLogon in a COM object named BS.Logon which requires 5 parameters: Username Password ApplicationID XMLRoot IPAddress This method logins to the web server with the username, password, and other details, and returns the session ID. I have written the Powershell script to call the method...

Fill form with Javascript code in browsers addressbar

javascript,com
I want to ease the users experience on a external partner website by giving him a copy/paste line to prefill the form with the data from our database. TASK: Fill form with javascript in Browsers ADRESS BAR (Firefox/chrome mandatory) There is a COM (MS) extension and i can't find any...

COM Class on a destination machine

c#,.net,com,vb6
I followed this http://support.microsoft.com/kb/817248 tutorial to make a .NET COM class for my vb6 project to be able to access. I added it through references but what it adds is the testproj.tlb file and not the testproj.dll. It works fine on my development machine. However I took the compiled .exe...

WordPerfect COM Automation Error

c#-4.0,com,wordperfect
In c# .Net 4.0 I am attempting to automate WordPerfect. To do this I add a reference in my project to the wpwin14.tlb file that lives in the WordPerfect program folder. That has the effect of creating the COM interfaces within my project. Next I should be able to write...

How to add a static method into ATL object?

visual-c++,com,static-methods,atl,dllexport
I am trying to write a simple COM/ATL DLL following the link http://www.codeproject.com/Articles/505791/Writing-Simple-COM-ATL-DLL-for-VS, but it does not mention how to add a static method to ATL object. Can I add a static method to ATL object? Thanks and best regards! ...

Writing UTF-8 strings to Word using PHP/COM

php,utf-8,com,ms-word
I'm trying to generate a Word document using data from a MySQL database using PHP/COM. If the data from the database is simple ASCII text (ex. "hello"), it displays correctly in the Word document. If the data contains non-ASCII (multi-byte) characters (ex. "Māori"), they display correctly, but have "funny" characters...

What's the appropriate place to call CoInitialize/CoUninitialize across DLL's?

delphi,dll,com,ado
I'm implementing a DLL containing a shared ADO Connection by using the ConnectionObject property of TADOConnection and passing it across DLL boundaries into other instances of TADOConnection. I need to make sure COM is initialized, so I need to call CoInitialize / CoUninitialize. Currently it's in the context of a...

Win8's Spell Checking API sends null as out param

c++,windows-8,com,atl,spell-checking
I am implementing a Windows 8 Spell Checking COM service in C++ without ATL, but when Windows' msspellcheckinghost.exe calls my ISpellCheckProviderFactory::SupportedLanguages() it passes nullptr as the out param, to which I naturally return E_POINTER ... which results in a fail and an event log message of: Failed instantiating third-party spellchecking...

Convert argument exception to HRESULT?

c#,.net,com
I am developing a Microsoft .NET assembly to be consumed by Microsoft .NET and COM components. I am writing managed code and must indicate when incorrect arguments are specified for methods within the class. I need to return control back to COM componments with the proper error when an argument...

ICallFactory with 32-bit and 64-bit type libraries side by side

windows,winapi,com,registry,typelib
I have a in-proc COM server for which I want to build 32-bit and 64-bit versions. I can do this with no problem. However, I am encountering some issues when both versions are registered. I am not using ATL. In my DllRegisterServer function, I am using RegisterTypeLibForUser. I am acquiring...

Outlook COM: Invoke OpenSharedItem via late binding

c#,com,outlook,late-binding
The returned type of namespaceObjType is a System.__ComObject and it's impossible to call InvokeMember("OpenSharedItem", ...) on it. How do you need to call this method with the late binding technique? The only difference I see is that the returned object type of the Session property is only an interface instead...

If DLL's in C++ don't support binary encapsulation, when is it ever right to use them?

c#,c++,dll,com
So I'm reading up on COM's and DLL's, and it seems as though, that if I'm ever to update the implementation of the DLL (if the needed memory exceeds the old need), I need to recompile the program using the DLL with the updated DLL. So I'm just wondering, when...

CoCreateInstance of OLE control failed

visual-studio-2012,com,activex
I inherited a visual studio 6 project that uses Thorlab activex controls. The project used to run on windows XP a couple of years ago and I have managed to import it and build it in VS2012. The problem is, when I try to run the exe file, I get...

How to find Excel labeled Cell

excel,excel-vba,com
This is what I have: 1) an Excel sheet where cells are labeled (named Edit: in the "Name box"). 2) a COM connection to the Excel sheet. Now, how can I retrieve the value of the cell using the label of the cell? Example: mySheet.Cells(1,5).TEXT Would yield the value of...

Advantage of std::wstring over CComBSTR

com,atl
There are some questions talked about conversion between std::wstring and CComBSTR, like this one, but what' the advantage of each one over the other if both are available in a project?

Why does this operation break when turned into a function (AutoHotKey/AHK)

function,com,macros,ms-office,autohotkey
The following operation works correcting inside AHK. It replaces the word ted with the word tom inside an open word document. Working Code ; Word Constants vbTrue := -1 wdReplaceNone := 0 wdFindContinue := 1 return #IfWinActive, ahk_exe WINWORD.EXE ^7:: try oWord := ComObjActive("Word.Application") catch return FindText := "ted" ReplaceWith...

Is it safe to cast a IDispatch* into an IUnknown*, without using QueryInterface, for interprocess COM objects?

c++,com,atl,dcom,dangling-pointer
When dealing with interprocess COM objects, is it safe to cast a IDispatch* into an IUnknown*, without using QueryInterface ? Here our IDispatch object comes from an other process OtherProcess.exe. And a colleague of mine says that I should call QueryInterface on the IDispatch so as to get an IUnknown....

Call C# .Net DLL in delphi 7 [duplicate]

c#,delphi,dll,com,delphi-7
This question already has an answer here: How to Create DLL in C# and call in Delphi XE6 1 answer Anyone know how can I create a C# dll which can be called in Delphi 7 program? I do that through the ComVisibleAttribute but delphi program takes error. C#...

VARIANT structure (COM) seems to have no member [on hold]

c++,com,directshow,visual-studio-2015,variant
Using Visual Studio 2015 RC and the Windows SDK 7.1 with this simple DirectShow code (C++ with COM) #include <dshow.h> #include <iostream> int main () { CoInitialize(nullptr); ICreateDevEnum* devEnum = nullptr; CoCreateInstance( CLSID_SystemClock, NULL, CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, reinterpret_cast<void**>(devEnum) ); IEnumMoniker* monikerEnum = nullptr; devEnum->CreateClassEnumerator( CLSID_VideoInputDeviceCategory, &monikerEnum, 0 ); IMoniker* moniker =...

Copy COM object by Value in .NET

.net,com
I have a project which references few com objects in a list (for each). I need to copy one object within the loop and compare it with the second one in iteration. I'm not sure how to copy a com object by value. Please help. Thanks.

I need to create a C# based COM Server for consumption in VBScript

c#,.net,vbscript,com
I am creating a COM server .dll in C# (.NET 3.0 - external requirement). Some clients work well with it but others do not. Specifically, I'm having problems getting VBScript to like it. There are two primary components: a. an interface b. an implementation object they both have their own...

What is the equivalent c# type for char point in C

c#,c,com
What is the equivalent C# parameter type to be used for below C com function? For the signature below I'm getting the error: This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match...

Invoke marshalled COM interface multiple times

javascript,javascript-events,com,event-handling,activex
I am writing a COM object for JavaScript consumption. JavaScript code is turn runs in an hosted WebBrowserControl. I need to fire some events from COM object to JavaScript, the excellent guide to which at Dr. Dobbs e.g. I have following in my *.idl IJSCallback { void Listen(IDispatch* pJSMethod); }...

Use Office Interop on ASP.net MVC6 website

com,ms-word,office-interop,asp.net-mvc-6
I want to generate word documents from my ASP.net MVC 6 website. I've implemented several ways to generate a document in a POC : DocX, NetOffice, OpenXml, COM Interop objects. I was seduced by it. I made a Console App to test and it works. But, with ASP.net MVC6, we...

How to properly finish Internet Explorer that's launched from Powershell?

internet-explorer,powershell,com
There was a set of recently asked questions about doing something with Internet Explorer via Powershell. All of them contain codes to launch IE from Powershell as an object, via $ie=new-object -comobject InternetExplorer.Application. The problem is, the proper way of closing IE that consists of calling $ie.quit() does not work...

Why is System.IO.Path (a class with only static members) COM visible?

.net,com
Why is System.IO.Path COM visible when it contains only static members and fields? [ComVisibleAttribute(true)] public static class Path I was under the impression that one cannot call static member functions of a COM object (and additionally, that the class would need a default constructor which Path does not have). Also...

What circumstances other than “await” will allow synchronous code to be interrupted

c#,com,async-await,activex,rcw
I recently came across a strange bug in my async code. I was calling a blocking method on a COM control, which appeared to allow my async continuations to run while it was blocking. Consider example code (illustrative purposes only) public async void Main() { //assume some single threaded dispatcher....

How to get name of the com object control in .Net?

.net,com
I am accessing a COM object in a .net application. I want to get the Name of this COM object supplied at the design time. I have googled and understood that the way to get the name is through GetTypeInfo api. But I am not sure how to use it....

How to integrate Excel =RTD() function in python

python,excel,com,real-time
I am using a real-time-data from a proprietary application which provides real time weather data. All I know know from the data is, it provides a link to import to excel as: =RTD("4cast.wetter",,"city","parameter") This parameter includes Temperature, Humidity, Wind speed, Rain fall etc. I tried reading the support link provided...

Making an async COM call — do I have to create my own P/S?

c++,winapi,com,ole-automation
I have a custom interface defined in a type library and implemented in my code. I have not created my own proxy/stub. I have successfully marshaled the interface pointer from my main thread (STA) to a background thread (STA), in my case using IGlobalInterfaceTable. From that background thread, I want...

Why will Excel com object not release from memory if I check it for null?

c#,excel,com
I've inherited an existing app to maintain and have hit a snag: it won't release the Excel object from memory once it is completed. I've pulled out the relevant code here. It is a method which creates an Excel workbook using COM Interop: using System.Runtime.InteropServices; using Excel = Microsoft.Office.Interop.Excel; ......

How to check if a COM object still exists

.net,com,ms-office,vsto
I basically understand how managed RCW objects wrap COM objects in .NET. My question is what happens when the COM object ceases to exist. I know that the RCW object increases the reference count so the COM object should not be released as long as the RCW object is alive....

How to detect if a dll is a COM dll

.net,com
This question is a little different than How to determine if DLL is COM or .NET?, in that I want to simply identify if a dll needs to be registered as part of a deployment tool. So it might be any kind of com dll, .net or otherwise. It may...

Why is IMarshall Interface queried on IUserNotificationCallback COM object?

c++,winapi,com,notifications,msdn
Use of IUserNotification2 from Microsoft I'm using IUserNotification2 to show a notification to the software user. I use the existing implementation from microsoft, see here. (Note, I removed the standard headers and simplified a bit). #include <Shobjidl.h> //IUserNotification2 interface header void NotifyUser(const std::wstring &title, const std::wstring &text){ if (!SUCCEEDED(CoInitializeEx(nullptr, COINIT_MULTITHREADED)))...

Value is null when passed as parameter

excel,powershell,com
I'm working on reading from an excel spreadsheet to mass format some text. When I do something like the following, everything works fine. Function Read-From-Excel { Param( [string]$fileName, [string]$sheetName="Sheet1" ) $excelObject = New-Object -ComObject Excel.Application $excelObject.Visible = $FALSE $excelBook = $excelObject.Workbooks.Open($fileName) $excelSheet = $excelBook.Sheets.Item($sheetName) $intRowMax = ($excelSheet.UsedRange.Rows).count $col = 1...

C++ COM object as property

c++,com
I need a object of my library and especially as a property because I need it in my methods. It works if I declare it as a local variable: #import "...\library.tlb" int _tmain(int argc, _TCHAR* argv[]) { CoInitialize(NULL); RobstepRemoteLibraryCSharp::IRobstepPtr interf(__uuidof(RobstepRemoteLibraryCSharp::Robstep)); std::wcout << interf->Test() << std::endl; interf->ConnectToPlattform("192.168.0.1"); } This works and...

Two simple COM IDL syntax questions: is there a way to specify the threading model, and do I need void to say “no arguments”?

com,idl,midl
Two simple COM IDL file questions I can't seem to find answers for, even with searching MSDN and the general internet: Is there an interface attribute which lets me specify my interface is to be implemented by STA objects only, or is this a detail for my documentation alone? I...

What is required in Delphi 2007 to use Variant arrays?

delphi,com,delphi-2007,variant
I'm a newbie in Delphi, using Delphi 2007. I am learning things related to COM programming, in order to make a basic plugin to a program called Retail Pro. I have a little of background in .NET (C#, ASP), NetBeans (Java, JSF) and PHP. Anyway, I'm following this intro tutorial...

Event in MSXML2.XMLHTTP

c#,vbscript,com
Does anyone know how MSXML2.XMLHTTP implement its event like onreadystatechange?Since I need construct a COM component with C# which will raise a event, but the client which use vbscript to call this COM object does not support WScript.CreateObject, so I can't handle the COM event. But I find that MSXML2.XMLHTTP's...

Why is the COM interface contract immutable?

c++,com
I've googled quite a bit, and found it weird that no one cared to explain why COM interfaces are immutable. I suppose that the reason you're unable to remove any methods from a COM interface, is because a client relying on that interface, would encounter an error, which isn't good....

ComErrorException 'Class Not Registered'

c#,unit-testing,com,integration-testing,merge-replication
I'm trying to write a integration(unit) test that calls an object from SQLServer Replication dll. When it tries to instanciate the object MergeSynchronizationAgent i get an exception: '{Class Not Registered}' -2147221164 I tried switching the platform to x86 but that didn't work. The exact dll is Microsoft.SQLServer.Replication.dll. Any help is...

Creating a Managed C++ interface to use in C#

c#,.net,com,c++-cli,dcom
We have a collection of Native C++ business rules wrapped in C++/CLI and then by a C# layer so we can expose it via DCOM. The Native C++ business rules are in a DLL and are easily invoked in C++/CLI which is in a COM visible DLL. We then add...

How to tell type of indexing used from debugger

visual-studio-2010,debugging,com,envdte
Following shows a C# console application stopped at a breakpoint. The sln variable is of type Solution2. From research, I determined that the Projects item in the solution uses 1-based indexing, so that's how I retrieve the only project in the Visual Studio solution (the line where the breakpoint is):...

QTP AOM Model Intellience Not Working

vbscript,com,automation,qtp
I want to use QTP AOM(Automation Object Model) using vbscript. I use VbsEdit to develop this script but I did not get any intellience from this editor even I also try this from excel developer window. There also intellence assistance is not available. I need this because if it is...

Possible consequences of duplicate ProgId for different classes

c#,.net,windows,com
In a software I'm maintaining I've observed COM classes marked with identical [ProgId]s. AFAIK the ProgId is a human readable identifier for a component and it should map 1-to-1 with the component's CLSID. So I'm wondering: Is there any good reason to have the same ProgId for different classes? What...

COM : convert 'const GUID*' to const wchar_t*

c++,visual-studio,com,mingw
I am porting some code from VS to mingw C++ . One of the statements in my code is CFactoryTemplate g_Templates[1] = { {&CLSID_SystemClock, CSystemClock::CreateInstance} }; int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]); I am getting the following error on the first statement error: cannot convert 'const GUID* {aka const _GUID*}'...

How can I define some functions individually for each interface of my class?

c++,com
I am learning COM, also I am a beginner in C++. I defined three interfaces: #include <objbase.h> // pure abstract base class interface IX : IUnknown{ virtual void __stdcall Fx() = 0; // pure virtual function }; // pure abstract base class interface IY : IUnknown{ virtual void __stdcall Fy()...

Convert C# string to C++ WCHAR* over COM

c#,c++,string,com,interop
I have a COM local server (implemented in C++) which I am trying to call from C# code. The method that's giving me trouble looks like this: HRESULT Foo([in] const WCHAR* bar); The parameter shows up in on the C# side as a ref ushort, but I want to pass...

Why DWebBrowserEvents2::NewProcess() receives pWB2==NULL in second parameter

internet-explorer,com,automation,bho
This dispatch is also known as DISPID_NEWPROCESS. If you start a new IWebBrowser2 with CoCreateInstance(CLSID_InternetExplorer), then it will by default start in Protected Mode (you can see it in Internet Options | Security | Internet | Enable Protected Mode). However, if you then Navigate() to an URL that is in...

How to find a DLL when the CLSID does not exist in registry

c++,com,registry,windows-server-2012,clsid
One of system services reports in his log that it has loaded some object. In the log mentioned also the CLSID of loaded object (value is 1CECAF7C-B7A0-4B81-912D-78F202E3F0EA, see also the screenshot: Of course, first of all I searched this value in registry (I have readed also this Stack Overflow question)....

Word Add-in keeps Word process alive when document is embedded via OLE

c#,com,ms-word,vsto,ole
I have built a Word Add-in which has to do a task when the user closes the document. I installed an event handler for the DocumentBeforeClose event of the Application object to do that. The problem is that the event handler appears to prevent the Word process from exiting when...

Return multiple variables to JavaScript from COM

javascript,c++,com
I have COM function in a disp interface as shown below, [id(1)] HRESULT MultipleReturn([out]BSTR* arg1, [out, retval] BSTR* arg2); implemented as STDMETHODIMP SomeCoolObject::MultipleReturn(BSTR* arg1, BSTR* arg2) { *arg1 = SysAllocString(L"test1"); *arg2 = SysAllocString(L"test2"); return S_OK; } In Python I can call it as import comtypes.client as cc obj = cc.CreateObject('SomeCoolObject')...

Call a c# dll function from testcomplete with a int[] parameter

c#,arrays,com,testcomplete
I'm trying to call a c# library function from within testcomplete code. The c# library i made based on the answer below by Helen is structured as follows: (build target for the library is 3.5 with a generic strongname key and regasm'd for both 32/64 bit) using System; using System.Collections.Generic;...

Register Explorer COM extension only if specific task was selected

com,installation,inno-setup
I have a complicated program for working with documents. Client requirement: it should be conditionally integrated in Windows Explorer context menu during install, i.e. then user check the corresponding option. So, in my Inno Setup script [Tasks] i've created a separate task named IntegrateToExporer. And in the [Files] section -...