The solution was to disable the Visual Studio hosting process from Project -> Project Properties: Based on the MSDN documentation of the Hosting Process, it has no real value to developers, and can safely be turned off....

A DLL that supports self-registration (usually a COM DLL, but doesn't strictly have to be) would export a function named DllRegisterServer or, less commonly, DllInstall. You can manually register such DLLs with the help of regsvr32 utility....

well the -- unregister command works well for unregistering COM objects , but -- debug is more usable in this position , when someone wants to modify the code. Also if you keep getting the Old instance of the COM object just restart the programs , and it'll detect the...

You are talking about the threading model you want to specify for your COM component. No, you cannot put that in the IDL, it is far too important. A client doesn't have to use your IDL, a scripting language like Javascript never will for example. It must go in the...

This is from a project where I had a similar requirement, an InProc COM wrapped .NET component visible to VBScript and Classic ASP (as in IDispatch friendly in COM parlance). I've renamed the interface, class and methods but you should get the idea. Declare our interface: [Guid("0B201484-E388-45eb-9AB8-A6AE1E197AAB")] [InterfaceType(ComInterfaceType.InterfaceIsDual)] [ComVisible(true)] public...

With the help of MS forums, the problem turned out to be that ISpellCheckProviderFactory is not an IClassFactory, and the DLL must return a proper IClassFactory that in turn can CreateInstance() the actual provider factory.

OK, the problem was that the indexer is overloaded and you shouldn't use that in COM-visible interfaces: https://msdn.microsoft.com/en-us/library/ms182197.aspx Extract from the page about what happens to overloaded methods: When overloaded methods are exposed to COM clients, only the first method overload retains its name. Subsequent overloads are uniquely renamed by...

About LEADTOOLS Multimedia in particular, there are 2 types of DLLs when you're building a .NET application: The core toolkit DLL, which is Leadtools.Multimedia.dll for DirectShow and Leadtools.MediaFoundation.dll for Media Foundation. These core DLLs contain the main controls (capture, convert and playback) along with several other helper objects and they...

The short answer is "yes, you can do this with Akka.NET" As Hans points out in his comment: Word doesn't care much about your library. Its interop interface is single-threaded, any call you make from a worker thread is automatically marshaled to the thread that owns the Application object. You...

Your code - you say you are porting is wrong, you need to provide different parameters to CFactoryTemplate, the compiler error proves that. Here you will find some sample code to init such array of instances of this class (you dont need to fill all fields): // list of class...

It would help to have a more useful debugging message than oops. I would suggest writing a vbscript program that would give a more useful message. Is your version of Perl that you are running 32 or 64 bit? If it is 64-bit, then your program is failing because in-process...

"onreadystatechange" is not a COM Automation event because COM Automation events require the caller (mainly written in scripting languages) to implement specific COM Interfaces, which scripting languages often cannot do (look up COM Connection Points to get the full details). If you start with the link you provided, and add...

There is very detrimental cargo cult behind that "two dot rule" silliness, it completely fails to keep C# programmers out of trouble since version 4. And it endlessly more painful than the simple way to make Office programs quit on demand. But this is not a problem you have at...

You can inherit from StandardOleMarshalObject or ServicedComponent for that effect: Managed objects that are exposed to COM behave as if they had aggregated the free-threaded marshaler. In other words, they can be called from any COM apartment in a free-threaded manner. The only managed objects that do not exhibit this...

The .idl file requires a library{} block before it will generate a type library. Inside this block you'll need to declare the types that need to be present inside the library. A normal library only has coclass definitions in the library section, midl automatically injects any interfaces that the coclasses...

Try the Switch/Continue trick. Your APP would call IInternetProtocolSink::Switch like this, e.g. in Start: PROTOCOLDATA data = {0}; data.grfFlags = PD_FORCE_SWITCH; // important pProtocolSink->Switch(&data); Eventually, the client will turn around and call IInternetProtocol::Continue on you, on the main UI thread. Once on the main thread, things like IServiceProvider::QueryService(IID_IWindowForBindingUI) should work,...

To answer to your first question, there is no easy way to tell if COM based collection is 0 based or 1 based. Not, unless you are willing to disassemble the implementation of get_Item() method of the object that implements the COM interface. It could be either 0 or 1,...

In the comments on the codeproject page another person mentions the same problem - in that case the offset of an array item was computed from the start of the structure, not taking into account the first 32/64 bits that contain the number of items in the array: [StructLayout(LayoutKind.Sequential, CharSet...

There are two questions here. Why don't you get intelisense for the QTP object in the IDE you're using (VBSEdit) Intelisense is a feature of the IDE, you should tag this question VBSEdit, not QTP Where can I get a list of all the COM objects in the system? When...

std::wstring has more methods for actual string handling, whereas CComBSTR is meant specifically for holding a BSTR string. BSTRs are used mostly by COM methods and have a different memory layout. Generally you should use std::wstring or CString unless you actually need the memory layout of BSTRs.

You should not be doing this in the DLL. Make it part of the contract between the DLL and the host that the host is responsible for initializing COM. The DLL cannot be expected to initialize COM because the host may already have done so. And use a different threading...

No, It's not possible, you can only force a garbage collector to run but you can not force it to work according to your logic. For more information on garbage collector please read this: https://msdn.microsoft.com/en-us/library/ee787088(v=vs.110).aspx Also GC is a static class, we can't override any of it's method :(...

You should use the first option CComPtr<Interface>. If you're importing the TLB though, via #import you should have some smart pointer templates generated for you that you can use. RobstepRemoteLibraryCSharp::IRobstepPtr interf; interf.CreateInstance(__uuidof(Class)); ...

Create two entries in [Files]: one with regserver flag to process when IntegrateToExporer task is selected one without the regserver flag to process when IntegrateToExporer task is not selected [Files] Source: "my.dll"; DestDir: "{app}"; Flags: regserver; Tasks: IntegrateToExporer Source: "my.dll"; DestDir: "{app}"; Tasks: not IntegrateToExporer See Components and Tasks Parameters...

Yes, you have to enable managed debugging. One problem with Visual Studio (at least 2008 and 2010 -- don't know about later versions) is that you can only debug Native and Managed code at the same time with 32-bit processes. With 64-bit processes, you have to debug one type or...

I think you are close, you just need to tell the marshalling system what kind of string to marshal it as: [DllImport("Sn62.dll", CallingConvention = CallingConvention.Cdecl)] public static extern int GetLicenseNo([MarshalAs(UnmanagedType.LPStr)]string lpszLicenseKey, [MarshalAs(UnmanagedType.LPStr)]string lpszEncryptionKey, [MarshalAs(UnmanagedType.LPStr)]string lpBuffer, ushort wBufferSize); That way it knows exactly how to transform the data. Edit: You may...

PumpWaitingMessage will process messages and return as soon as there are no more messages to process. You can call it in a loop, but you should call MsgWaitForMultipleObjects, or MsgWaitForMultipleObjectsEx, before the next loop iteration. Avoid calling these functions before the initial loop iteration, as they'll block and you won't...

Because the interface ISts is the default interface for the Sts coclass and no other coclass implements it. In this case, I guess the importer chooses the interface it once saw as the default for some coclass and implemented by no other....

Windows protects these registry values because their change might affect (damage) a lot of applications and subsystems. The code (correctly) attempts to address this problem by taking ownership on the key from system first so that you could break your system up soon afterwards. Apparently you did not write this...

Presumably your COM component was build as 32bit...so when you register it is registered as a (InProc) 32bit COM component....(and can only be loaded by a 32bit application). Your ASP.NET Website is most likely running in an AppPool that is set to be 64bit...thus it can't use the 32bit COM...

Try to move the garbage collector calls to a wrapper method. That way you can be sure that all automatically created references are out of scope when you call it. private void CreateWorkbookWithCleanup(...) { CreateWorkbook(...); // Yes, we really want to call those two methods twice to make sure all...

Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment. If you are building a solution...

Ok, I got it to work by going hog-wild with ComReleaser objects. Basically, I scanned through my code, and anytime I found anything that was at all from ArcObjects, I attached a ComReleaser to manage it. Basically, I'm just doing manual memory management. At any rate, it does seem to...

As far as I know, the universal marshaller does not work with Async COM. You need to build the (MIDL-generated) proxy (although, IIRC, you can merge the stubs if you're building a DLL). You also need to register the proxy DLL (and build it with the -DREGISTER_PROXY_DLL define). Async COM...

Ok there is a code to open a command prompt where you can submit pure Javascript javascript:var a=prompt();var f=Function(a);f() To fill a form it can be done like this: javascript:document.getElementsByName('nechama')[0].value="It's a me"; void 0; neat, isn't it Btw, COM extension only applys to MS InternetExplorer. The provided code example applys...

Based on your description of your requirements I'm not convinced you're going about this the right way. I suspect you've been led astray by 'they' providing you with a DLL file, as if you are building a desktop (or ASP.NET?) application. As I understand it you simply need to authenticate...

I'm posting it for my own future reference, in despite of the treatment I got in the comments to my original post. It would've saved me a day of search if someone pointed me to this article... This CodeGuru article, "COM in plain C, Part 2" explains how to create...

Just for reference if anyone has the same issue. I had been looking at it wrong. Basically when the component was deployed it deployed it with the windows explorer path "\machinename\c$...." (it should just be "C:\filepath.....)This meant that if the local machine did not have access to "remote access" itself...

I just wrap it as an OLE call and clean up my COM object with FinalReleaseComObject. Here's a simple wrapper class I've been using to open Wp docs and convert them to pdf. It cleans up nicely in our automated process: public class WpInterop : IDisposable { private bool _disposed;...

The MailAddress class uses the immutable pattern -- so once the instance is created, it can't be modified (there are some benefits to this pattern -- since among other things it can help a lot with threading, since there are no lock contention issues). The collection it gets placed into...

How is this possible? Simple: the DLL simply was never registered. Of course, that means you cannot find the DLL from the registry, but you may know for some other reason which DLL you need. E.g. because you wrote the DLL yourself! In this case it's quite possible that Microsoft...

TestComplete DelphiScript is an ActiveScript-based language (like Windows Script Host's VBScript and JScript) and uses the Variant data type. While simple values like numbers, booleans and strings are marshalled into .NET correctly, "complex" values like arrays and enums need to be created on the .NET side using the dotNET wrapper:...

The first thing to do is to make sure the object is registered--the ProgId and the CLSID are in the registry. Go to HKEY_CLASSES_ROOT and search for the ProgId of the object if you know it. If you don't know it, search for the CLSID in HKEY_CLASSES_ROOT\CLSID if it's a...

I assume here you are talking about a COM DLL created with Visual FoxPro and by the looks of it you are trying to instantiate it in C#. Make sure you have the runtimes properly installed. You can download them here....

When you use the class wizard on ATL classes you get only the option to add methods to the COM interface. You have to modify the class manually when you want to add something that is not in the COM interface. So you have just to add the static method...

Fixed. As mentioned in comments alert() works but document.writeln() doesn't. That is because document.writeln() resets the current document including scripts elements, use document.createElement(), document.createTextNode() and friends to modify current loaded elements. This could be common knowledge for those familiar with HTML/JavaScript, for rest of us it can be a real...

i put the installer inside a .net setup project and added the dependencies and it works now. However when i add the .tlb and the .dll gets added the .dll needs to make sure it is changed to vsdrfCOM in register property

What you are doing is inherently risky. Using Automation while the user is interacting with the Office program is tricky and you have to code carefully. The specific COM object does not get deleted, they are reference-counted and you are holding a reference on it. But when the user removes...

Binary compatibility requires caller and callee to agree on a common ABI (application binary interface). On both Windows and Linux, a standard ABI for C calls is specified by the OS, which allows calls into the C library from any other language. This also makes C++ useful for DLL development,...

nowhere in the documentation it is mentionned that I should answer to this IID Any COM object might be queried for an interface, which is unknown to the object. It is normal and more to this, it is mandatory for a COM object to respond to this correctly and...

In order to detect whether the object is remote CoIsHandlerConnected would QueryInterface the argument anyway (for IProxyManager etc), so it does not matter whether you provide the pointer you already have, or you additionally query for IUnknown. Your QueryInterface call has not effect on the status of the remote object:...

You cannot see the internal state of a COM object because you only have an interface to it. You are limited to any property getters and putters that the COM interface may expose. For some objects, getting every property you can, and calling the matching put_ function may be sufficient....

From the link which you have provided it seems that Microsoft has provided a wrapper for VBA(but not for Python). I would suggest to check with the data provider if he offers an API to Python. This has nothing to do with Excel, but it would allow you to receive...

Sure, this is a mistake. It is in good company, many other classes from mscorlib have the same problem. For example Registry, Directory, File, Buffer, Environment, Nullable, Monitor, Timeout. But not consistently, the attribute was properly omitted for BitConverter, Console, Convert, GC, Math, etcetera. The attribute is otherwise important for...

You need to pass a namesapce object instead of the outlookApp: namespaceObjType.InvokeMember("OpenSharedObject", System.Reflection.BindingFlags.InvokeMethod, null, namespaceObj, new object[] { temporaryFileName }); Anyway, the Namespace class doesn't provide the OpenSharedObject moded. Are you interested in the OpenSharedItem method?...

Well, you can get the type library information and try to read and walk it to determine if the function exists. Or, you can call the function through IDispatch::Invoke and see if it fails. If it fails, don't call it again and call the fallback function. So, it doesn't have...

I have debugged IE, and found out that the parameter will have NULL if your ProtectedMode (low integrity) IWebBrowser2 is becoming non-ProtectedMode (medium integrity) IWebBrowser2. Details: The interesting code is located in IEFRAME!CIEFrameAuto::_HandleProtectedModeRedirect(). It will call IEFRAME!IsProtectedModeProcess() and based on its results will eventually call either FireEvent_NewProcess() with pWB2 parameter...

It is both, COR_E_ARGUMENT and E_INVALIDARG have the same numerical value. Use the Reference Source to see how the class initializes its HResult property value. Click through to __HResults.COR_E_ARGUMENT to see 0x80070057, which is Windows' ERROR_INVALID_PARAMETER error code packed into an hresult. You can obtain the error code for E_INVALIDARG...

STA means "Single Threaded Apartment". It is a COM concept, highly unrelated to WPF. The WPF designers learned from the mistakes in .NET 1.x, many programmers wrote programs that violated thread-safety requirements and had a very difficult time fixing their programs. So they added more runtime checks in .NET framework...

Figured it out. RegisterTypeLib and RegisterTypeLibForUser always write both 32-bit and 64-bit entries when running on a 64-bit OS (even if the process is 32-bit). This is perfectly acceptable in most cases since it's only the interface and type library metadata that gets written. When the interface key is written,...

Finally found the problem!!! Starting from Windows 8, the program needs to have company information (I think this is a bug, since it isn't mentioned on Microsoft's site.) So make sure to fill out this attribute in AssemblyInfo.cs: [assembly: AssemblyCompany("YourCompany")] If it's an empty string it won't work!...

This is a pretty normal mishap. You can see the underlying problem by running OleView.exe from the Visual Studio Command Prompt. Use File + View Typelib and select the .tlb. You should see something like: void SetNodeArr(int Size, FOO_NODE* pArray); The pointer is the problem, it is ambiguous. It could...

If you add a method, a newer client that uses that method will fail when working with an older version of the component. Older versions of the component won't have the new method unless you specifically add code to implement it, rebuild the component, and then reinstall the component on...

If you are on a 64-bit machine, then if the CLSID is in HKEY_CLASSES_ROOT\CLSID then, it's a 64-bit control. If the CLSID is in HKEY_CLASSES_ROOT\Wow6432Node\CLSID, then it's a 32-bit control. 64 bit processes aren't going to be able to use 32-bit DLLs, and vice versa. If you have ported the...

My answer is not regarding Delphi, but about the general things. No exact solution, only links. Basically, you have several options to call managed code from unmanaged: Create COM object. You create c# dll and class with COM-related attributes MainTest. Then you register your dll in the system (using regasm.exe)....

Finally, I could make this work. Following are the steps I have followed to get the name assigned to control at design time from COM object:  ‘Name’ property is not directly available on IDispatch interface Using IDispatch interface on the COM object, we can invoke standard properties and methods....

Instead of attaching the DocumentBeforeClose event handler on application startup, consider attaching it on document open—and only if it's not an embedded object. The tricky part is determining whether the document being opened is an embedded object. I haven't found any documented way to explicitly check whether an Automation application...

JavaScript/COM binding doesn't support [out] parameters - only [out, retval] (of which, of course, there can only be one). JavaScript generally doesn't have a notion of pass-by-reference. There are several ways you can get closer to your goal. Return a SAFEARRAY of two strings. In JavaScript, consume it via VBArray...

A ProgId provides a friendly name for the CLSID guid of a coclass. Important to scripting languages, no good way to know the guid. Also used by languages that support late binding, like VB.NET and C#. The conversion from the string to the guid happens at runtime. The usual name...

This is pretty normal, COM will pump when the call crosses an apartment boundary. It has to pump, not doing so is very likely to cause deadlock. It is unclear why that boundary has to be crossed from the snippet, it looks like an STA thread when you talk about...

The problem was that the the garbage collector could clean up the reference to the underlying IUnknown object (the base type for all COM objects), and without the gc doing it's job the process stayed alive. I solve the problem by using the weakref module to immediately wrap the COM...

As Roman pointed out, you can avoid dealing with the PROPVARIANT structure, by using the utility functions to access the IMFAttributes store. However, as #7 points out on the page you referenced: Query the media type for the MF_MT_FRAME_RATE_RANGE_MAX and MF_MT_FRAME_RATE_RANGE_MIN attributes. This values give the range of supported frame...

It looks like there are at least two solutions to this problem. Add the string attribute to the parameter in the IDL to treat the pointer as a string, so this: HRESULT Foo([in] const WCHAR* bar); becomes this: HRESULT Foo([in, string] const WCHAR* bar); Then, a string can be passed...

The dialog has its own message pump/loop and inside the call it has a loop where it keeps receiving and dispatching window messages. This includes COM related messages worker windows receive and convert to COM callbacks you are seeing. Once the dialog is closed, respective windows are destroyed, the function...

Igor Tandetnik's comment pointed me to the correct direction. The article I used shows how to SetScriptSite but it's written in c. This question: How to load & call a VBScript function from within C++ has a very helpful answer. As that answer says, what you should do is define...

The located assembly's manifest definition does not match the assembly reference. Very common exception message, the DLL it finds at runtime isn't the same as the reference assembly your program was compiled with. A very basic DLL Hell problem, not otherwise specific to COM interop. You diagnose these kind...

Hans Passant's solutions in the comments above perfectly solved the problem: In VB.net, either use: Public Function ReturnDict() As System.Collections.IDictionary or reference scrrun.dll and: Public Function ReturnDict() As Scripting.Dictionary Dim dict As New Scripting.Dictionary The latter solution provides a VBA dictionary that can be used as one would like....