com-interop

What does "Register for COM Interop" actually do?

What exactly does the VS project option "Register for COM interop" actually do? Because when I build my library with this option enabled I can call CreateObject on my library from VBScript. But if I build without this and then run regasm manually CreateObject fails. So I'm wondering -- what does VS2010 do that I'm not doing? ...

Programming against a PLC via OPC protocol with C#

I'm running this code to connect to a plc. System.Guid guid=new Guid("75d00bbb-dda5-11d1-b944-9e614d000000"); System.Type t=Type.GetTypeFromCLSID(guid,node,true); object COMobject=System.Activator.CreateInstance(t); opcServer = (IOPCServer) COMobject; using the opc protocol as previously mentioned. I have little to no ex...

Marshal.ReleaseComObject throws exception

Trying to use a COM visible .NET class via other .NET application and get exception: Message: The object's type must be __ComObject or derived from __ComObject. Parameter name: o Stack Trace: at System.Runtime.InteropServices.Marshal.ReleaseComObject(Object o) The class looks as follows: [ComVisible(true)] [Inte...

C# COM Interop: How to translate instructions from C++?

I am trying to translate the COM Interop instructions given by my camera manufacturer for C++ to C#. They write: To obtain the interface, you use the normal COM functions to ask for the specific interface you need from the capture filter. For example: IBaseFilter* pSourceFilter; ... CComQIPtr<IManufacturersInterface> pKs( pSour...

smartdevice C# dll in VC++

I'm trying to create a DLL in C# for windows mobile, and I have an error when I try to access the dll in VC++. Is possible to create a DLL in C# and access it in VC++, using Windows Mobile? I'm using Windows Mobile 6 SDK. The following code works very well in Desktop. The C# code: using System; using System.Collections.Generic...

SetWindowsHookEx returns 0 when compiling for the .NET 4.0 framework in 32bit machines

I'm trying to set a low level windows keyboard hook to grab three keys pressed even if the application is not in focus. To do this I'm calling SetWindowsHookEx as // Create an instance of HookProc. KeyboardHookProcedure = new HookProc(KeyboardHookProc); //install hook hKeyboardHook = SetWindowsHookEx( WH_KEYBOARD_LL, KeyboardHoo...

Accessing COM server (EXE) remotely using Java (DCOM)

I have a question about accessing COM objects remotely. Currently I am using JACOB to connect our custom COM server (exe) and it works really well. However we are trying to separate the Java code from the COM server and place them on separate machines. JACOB doesn't support DCOM. So I wanted to know is this possible with com4j? If so can...

How to insert macro into a excel file without using the excel com library

Is there any way to insert an existing macro into a existing excel file without using the excel library ? I need this to set the excel to print whole work book .I cannot use excel library because it will be done online in the server where installation of excel is not possible. I can however use the c#.net coding . I am using NPOI to gene...

Load a COM dll at runtime?

I'm writing an application for the Peachtree API and it needs to work with any version of the API. Unfortunately the dll from Peachtree 2011 can't interact with Peachtree 2010, and vice versa, even though the two dlls are stored in the same location and run with exactly the same code. I thought I should be able to refer to the dll by i...

What is E_POINTER and E_INVALIDARG?

I'm trying to write a browser helper object.. and sometimes I need to return E_INVALIDARG but I dont know what the value for this constant is. Is there a list of these constants in .net interop services somewhere? I've been searching the namespace in the object browser and I cant find it.. or do I not understand what I'm doing? Can so...

Breaking into Debugger when a process accesses a file, or get a call stack of file accesses from a process

I'm dealing with some hundreds of thousands of lines of code, and I'm stumped where this process is accessing a particular file. I've given up searching the code, I just cannot find out. So, here I am -- asking a question I'm almost certain there is no simple solution for. I've tried FileMon, ProcMon from SysInternals, and while I can ...

Problem : Need to make COM InterOp at runtime using reflections Passing Pointers as parameters?

Hello, I need to make COM IntetrOp at runtime using reflections. My native COM Object's exposed methods have some parameters as pointers (DWORD*) and some double pointers (DWORD**) and some are user defined types(e.g SomeUDTType objSmeUDTType) and vice versa its pointer(i.e. SomeUDTType *pSomeUDTType). Now for dynamic method invocation...

How to call native exe function(visual basic 6.0) From .Net (C#)?

Hi, We have an exe file produced by visual basic 6.0(unmanaged exe) and a .net exe written with c#. How can I call a function in unmanaged exe(visual basic) from clr exe? Thanks. ...

Strange COM interop exception 0x80005000 using System.DirectoryServices.AccountManagement libraries

Hi, I'm trying to write something that (amongst other things) adds a user to an AD group - using VS2010, .Net4 and the library facilities in System.DirectoryServices.AccountManagement. I've gotten a user and group by code like the sample below, and this works for other operations like enabling or disabling accounts. group = System.Dir...

Winforms Flickering While Drawing Image on Taskbar

Right now I'm drawing a small 16x16 image on the title bar of my window. It works nicely, except for an obnoxious flicker that I cant figure out how to get rid of. I'm simply drawing the image like this: Protected Overrides Sub WndProc(ByRef m As Message) If m.Msg = WM_SIZE Then wnd_size = New Size(New Point(CInt(m.LParam)...

"Register for COM Interop" vs "Make assembly COM visible"

What is the real difference between these two options? What I know is: Register for COM Interop This options executes regasm on the assembly and registers the assembly as an COM component(or maybe not) in the registry with all COM like registry entries. Does this step generates a TLB file? What else is done? Sometimes I see a tlb is ge...

Registration free COM, VBScript chokes on C# dll

I'm trying to get a third party app (hMailServer) to consume my C# library. They support 3rd party libraries using VBScript hooks. I got everything working fine using registration-full COM, but now want to use registration free. I've modified the hMailServer.exe manifest and added a manifest to my C# library. Now the hMailServer serv...

Signing my assembly with a strong name stops it from working

A colleague of mine created an assembly in VB.net for use with JScript via COM interop. The assembly used to work fine, but we signed it and now it only seems to work on Windows 7 machines. I've tested 2 Windows 7 machines and 2 Windows Vista machines. When we signed the assembly and we try to instantiate the ActiveX object in JScript...

public class members seemingly unavailable in VB6 IDE

I've created a .net assembly that includes the data contract for a WCF (win32) service. I then exposed these objects via COM Interop so that the same assembly can be re-used on the client side for calling the WCF service. I've got the following pieces to my project: [wcf service] <====> { [wcf client assembly exposed through COM int...

Problem with .NET 4 based SMTP OnArrival sink in Win 2008 R2

I had .NET 3.5 implementation of OnArrival sink for SMTP server that has been successfully running for years. When I recompiled it to .NET 4 and reinstalled it the SMTP server stopped picking it up. I suspect it has something to do with the default verion of .NET used by SMTP server interop to communicate with the sink (it seems that it ...