com

How to consume and re-expose a Win32 type library using Delphi Prism

I currently have a Win32 type library created in Delphi which I need to consume, implement and re-expose via .NET. What are the steps necessary to bring the TLB into Prism so the interface can be implemented? ...

Can I stop a COM dll from displaying forms?

To be more specific: We have a web service (written in .Net) which utilizes a large number of COM dlls for core business logic (written in VB6). Assume for now that these are sealed libraries. Unfortunately, many of these COM libraries implement their own error handling or validation messages; if we pass in data which isn't complete, ...

Where can I find all of the COM objects that can be created in Powershell?

In Powershell I can create COM objects which can be used, for example, to control Microsoft Office applications: $excel = New-Object -com "Excel.Application" $excel.visible = $true How can I list all of the available COM objects that can be created in Powershell? ...

How can I have a class that implements an interface and inherits from an abstract class? (C# .NET 3.5)

I have a situation which I think I need the functionality provided by an interface and an abstract class. I am creating models to be used in a simulation. Each model is contained in a C# class that implements an IModel interface (of my design so it can be modified). I also created a c++ unmanaged Win32 DLL that acts as a bridge between ...

ASP.Net app calling DLL with fOpen...

Hello, I have ASP.Net web app and my c# code calls into a custom COM DLL. The DLL was written awhile back and uses fOpen. he fOpen calls return a NULL pointer. I am suspecting it is permissions, but I am having no luck in recolving the issue. Can anyone give me any ideas of what to do? Can fOpen be used? Are there special permissi...

Grab most recently played iTunes song using Java

What is the easiest way to get the information about the last song played in iTunes into a Java program? I have looked at JACOB and iTunes COM but they seem like overkill. If that's the only way to go, could anyone provide a good example next to the first google result? A 'hack' method is acceptable as well! Thanks! ...

Exposing functionality via Prism & Com Interop

How does one go about exposing a class written in Prism via COM Interop? For example, given the following interface: TYPE IFoo = public interface property bar: string; read; end; FooImpl = class( IFoo ) private function GetBar : string; public property bar: string; read GetBar; end; In this example, assume I...

VB6 to C# interop: Cannot directly set a property of type 'object'

Given the following C# class: namespace ComTest { [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] [Guid("A1D11BE5-40A1-4566-A1CA-418ABC76017C")] public interface IThing { [DispId(1)] void SetValue( object input ); [DispId(2)] object Value {get; set;} } [ComVisible(true)] publ...

"Type mismatch" error when calling a simple method in a c# assembly registered for COM interop

I've build a classlibrary using c# and the .net framework 3.5. In my class library there is a class called Utilities with two methods. public string Method1(int length) { } public string Method2(int length, string aStringParameter) { } Now I went and build a simple asp page calling my methods. Method1 work like a charm. Method2 cause...

COM method call returns Catastrophic Failure

Note: Pass BSTR variable to COM method, HRESULT return is 8000FFFF Previous calls with interface pointer, was successful: HRESULT is 0 Execution, inside Visual Studio succeeds, outside fails - release and debug Illustration: const char *simFile; simFile = new char; //omitted _bstr_t simFileToOpen(simFile); BSTR raw_sim_Open = simFil...

COM method call returns Catastrophic Failure when BSTR is passed

Revised from previous question Note: Pass BSTR variable to COM method, HRESULT return is 8000FFFF Previous calls with interface pointer, was successful: HRESULT is 0 Execution, inside Visual Studio succeeds, outside fails - release and debug Illustration: BSTR raw_sim_Open = SysAllocString (L"c:\\example.S8"); hresult = pis8->raw_...

Is there a best practice for accessing C++ native COM functions to interop from C#

For example, if I have 100 C++ methods (basically a native library) that interacts with a core window component. I want to basically make a wrapper for these c++ methods in C#, so all my new hire employees can use that instead of C++, etc. the C++ code is legacy and scares me, so I Want to deal with it just once. Is the approach here, ...

How to have ADO.NET consume persisted XML ADO recordset for updates

I am working on a .NET 2.0 conversion of a multi-layer client-server application. For the time-being, we're converting the server-side to .NET but leaving client apps in COM (VB6). My current work is focused on getting data to/from the detached COM based clients. The current version under development is using ADO(COM) recordsets persis...

Managing a COM object in C#

I have an ATL COM exe that I am calling from C#. I import the reference into C# and everything works just fine, the exe is spawned, and I can call functions on it. Now, I instantiate several of these COM objects. Occasionally one of them will hang. Releasing the COM object does nothing, since its still running. I can't kill the process, ...

Detecting IE Container from ActiveX Control

What is a good way for an ActiveX control to detect that its container (or container's container) is Internet Explorer? Currently, I am doing this by calling the control's IOleClientSite::GetContainer method and checking whether the container implements the IHtmlDocument2 interface, but now, I would like to check all of the control's an...

Finding Container Ancestors from ActiveX control in CComCompositeControl/CAxHostWindow

How can an ActiveX control, created for a CComCompositeControl as part of a resource (.rc) dialog definition, gain reference to the container of the CComCompositeControl? The ActiveX control created in this way is actually contained in a CAxHostWindow instance per this article. I have observed this to be true and have encountered the p...

IEnumerable.GetEnumerator() returns IEnumVariant in Delphi 6

I am using a .Net2.0 Assembly in Delphi 6 via COM. One of the methods in one of the interfaces returns IEnumerable. As long as I import mscorlib.tlb located in "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727" , I can reach both IEnumerable and IEnumerator interfaces in Delphi 6. Here is the part where IEnumerable is defined in mscorlib...

BHO - Attach event handler from worker thread

on DISPID_DOCUMENTCOMPLETE if I am attaching an onclick handler for a particular element in the DOM from a worker thread, then the event is not getting fired while clicking it, what might be the reason? this is working fine if I am attaching event handler from the main thread, but I want to do things asynchronously. I am using CoMarshal...

Problem using Python comtypes library to add a querytable to Excel

I'm trying to create a QueryTable in an excel spreadsheet using the Python comtypes library, but getting a rather uninformative error... In vba (in a module within the workbook), the following code works fine: Sub CreateQuery() Dim con As ADODB.Connection Dim rs As ADODB.Recordset Dim ws As Worksheet Dim qt As QueryTabl...

Does C# clean up C++ allocated memory?

I have a hypothetical COM object with the following signature void MemAlloc(ref double[] test, int membercount) where the memory is allocated in C++ using new/malloc. Once this is in C#, using the RCW, how do I ensure that the memory is freed correctly? I would think it would be difficult for .NET to free, considering in C++ you need ...