com

How can I reject a Windows "Service Stop" request in ATL 7?

I have a Windows service built upon ATL 7's CAtlServiceModuleT class. This service serves up COM objects that are used by various applications on the system, and these other applications naturally start getting errors if the service is stopped while they are still running. I know that ATL DLLs solve this problem by returning S_OK in Dl...

Passing Key-Value pair to a COM method from .NET

I have the following problem: I have a project in C# where I use a third party COM component. So the problem is that the above component has a method, which takes a string and a number of key-value pairs as arguments. I already managed to call that method through JavaScript like that: var srcName srcName = top.cadView.addSource( 'Dat...

How to wrap a thirdparty library COM class for notifications in a C++ project

A thirdparty vendor has provided a COM interface as an external API to their product, and for sending instructions to it, it's fine with the mechanism of generating class wrappers with visual studio by importing from the dll, then creating instances of the created classes, calling their CreateDispatch(), using the access functions and re...

Which file is the COM++ object and how do I import it to .NET?

I'm trying to write a COM++ object wrapper around a Qt widget (control) I wrote so I can use it in future .NET projects. e.g.: public __gc class comWidget; In the compile directory are the .exe, an exe.intermediate.manifest, and the comWidget.obj, and also some other crap files (.pdb, etc). So what/how do I import into .NET? I feel...

What is the different purpose of .H header file and a IDL file?

I am studying COM so there're some basic questions puzzling me... I know that IDL file is used to describe the method definitions (or the so called 'contract' between software modules), and the .H header files contains something like a method prototype, which looks similar to what the IDL is meant for. So, why are these two things coex...

Exposing .NET enums to COM clients{VBScript}

Am trying create of PoC for exposing/invoking various .NET objects from COM clients. The .NET library contains some classes and Enums. Am able to successfully access the classes in VBScript but not able to access the Enums. I know that Enums are value types and hence 'CreateObject' wont work in this case. But am able to access the sam...

DLL consumes 100 % CPU usage.

A particular com dll which i created to do some operations, when loaded in memory it consumes 100% CPU usage. Because when i rename the dll or unload it CPU usage goes normal state. How to debug the issue? ...

COM Interface Guid

Hello, I'm not much into COM interfaces, so i have a small question, say I have this code: [Guid("148BD528-A2AB-11CE-B11F-00AA00530503"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] internal interface IEnumWorkItems { [PreserveSig()] int Next([In] uint RequestCount, [Out] out System.IntPtr Names, ...

Need Advice on designing ATL inproc Server (dll) that serves as both a soure and a sink of events.

Hi, I need to design an ATL inproc server that besides exposing methods and properties, also can fire events (source) and serve as a sink for a third party COM control that fires events. I would assume that this is a fairly common requirement. I can also foresee several "gotchas" that I would like to read up on before commencing the ...

How to know about results of work with COM component?

I suppose this question is more general than working with COM components. I have a .NET client written in C# and COM component written in pure Win32 API. Client side uses this component to perform some actions. How to know on the client that component did its job? I think it may be socket/pipe, with component writing to it about results,...

dial windows serial modem from php

I am trying to dial a phone number from php (i have a client list in a database, and thought i could use it to ring them when i click on their name here is my code, it doesn't seem to work. I can hear the phone line click, but it doesn't seem to dial. maybe i am missing some command that needs to be sent prior to atdt? $device = "COM4"...

Get CLSID by PIA interface Type

Edit: Looks like Jon Skeet had some similar questions: http://stackoverflow.com/questions/1093536/how-does-the-c-compiler-detect-com-types How can I get the CLSID for a given interface within a Primary Interop Assembly? Here's what I'm talking about: // The c# compiler does some interesting magic. // The following code ... var app = n...

Media Foundation TypeLibrary for managed code ?

Is anyone know how to generate media foundation TypeLibrary which will then be imported as COM in managed code ? I didn't found any dll or tlb file related to media foundation which i can import in my C#.Net application. ...

HTML file: add annotations through IHTMLDocument

I need to add "annotations" to existing HTML documents - best in the form of string property values I can read & write by name. Apparently (to me), meta elements in the header seem to be the common way - i.e. adding/modifying elements like <head> <meta name="unique-id_property-name" content="property-value"/> ... </head> Questio...

midl.exe cannot load mscorlib.tlb

I'm trying to use midl to turn an idl file into a tlb. However, when I try I get this warning: warning MIDL2015: failed to load tlb in importlib : mscorlib.tlb and I then get a subsequent error: error MIDL2337 : unsatisfied forward declaration : _Object..... I'm certain that the error is due to the first warning. I've tried the same ...

Invoking method (from .net managed dll) from a SQL Stored procedure - Help

We wanted to call a .NET Managed code (deployed as dll) from a Stored Procedure in (SQL Server 2005/2008) We found couple of solutions, but couldn't get it working: Following steps mentioned in the article at this place http://www32.brinkster.com/srisamp/sqlArticles/article_33.htm - leaves us with following error code: 0x80131700 ...

COM OCX registration - 2 DLL's with same name

Hi, I have a native app that has an .OCX file that needs to be registered for it to be used in a .NET application. Now currently there's different versions of this .OCX on the machine. Can someone please explain how this can affect the registration of this new (updated) .OCX file registration? And how does my .NET app know which ob...

Workflow Foundation (WF) -- Why does setting a DependencyProperty to a COM object using SetValue() throw an ArgumentException?

Assume that I have a .NET Workflow Foundation (WF) SequenceActivity class with the following "output" property: public IWorkspace Workspace { get; private set; } // ^^^^^^^^^^ // important: this is a COM interface type! public static DependencyProperty WorkspaceProperty = DependencyProperty.Register( "Workspace", ...

Using ref Array parameters in C# with COM interop

I have a 3rd party COM libary that I'm consuming and am having problems with array parameters. The method signature that I'm calling is as follows: int GetItems(ref System.Array theArray) The documentation says that the method's return value is the number of items it will populate into the array, but when it get's called, all of the ...

.NET Com Interopability

I have a C# class X which inherits from class Y. Class X should be Com-Visible (should be used in an old Vb6 application). It is neccessary to use some Types of class Y in the VB6 application. How can I make them also COM-visible (without changing class Y) ? ...