com

Can a managed COM object unload or terminate itself?

I have a COM object written in C# that is a toolbar for the Windows taskbar (implements IDeskSite). I want to either, Prevent the taskbar from being loaded if a certain application is running Allow the toolbar to unload itself in the case of an unhandled exception rather than allowing the exception to cause Explorer to crash For #1,...

Which error code to return when a passed object doesn't implement a necessary interface?

In COM when I have a well-known interface that I can't change: interface IWellKnownInterface { HRESULT DoStuff( IUnknown* ); }; and my implementation of IWellKnownInterface::DoStuff() can only work when the passed object implements some specific interface how do I handle this situation? HRESULT CWellKnownInterfaceImpl::DoStuff( ...

Com Visibility in referenced assemblies

If I have the follwing assemblies: MyComVisibleApi: a .Net assembly that is used by a VB app MyReferencedAssembly: a .Net assembly referenced by MyComVisibleApi Does MyReferencedAssembly need to be ComVisible if its functionality is never directly referenced by the VB App? Thanks! ...

Can not reference a Dll that worked earlier.

I am trying to change the Terminal Services settings programmaticly. I learned that you must use tsuserex.dll. Being c# i ran tsuserex through tlbimp and created TSUSEREXLib.dll then registered it with regasm. I got it working and wrote a framework program with it as a prof of concept. However today after I made some changes when I run m...

Protecting code in COM objects

Hi, how can I protect my business logic C# code that I have written in a COM object from being reverse engineered by a high tech geek? ...

How can I programmatically inspect an ActiveXObject at runtime, using Javascript?

I am looking to create a Javascript library for ActiveX objects, enabling chainability. For example, I am looking to replace this: var dbEngine=new ActiveXObject('DAO.DBEngine.36'); var dbs=dbEngine.OpenDatabase('D:\\Todo.mdb'); var rs=dbs.OpenRecordset('SELECT * FROM ListItems'); with something like this (a la jQuery): var rs=AX('...

How to best convert CString to BSTR to pass it as an "in" parameter into a COM method?

I need to convert a CString instance into a properly allocated BSTR and pass that BSTR into a COM method. To have code that compiles and works indentically for both ANSI and Unicode I use CString::AllocSysString() to convert whatever format CString to a Unicode BSTR. Since noone owns the returned BSTR I need to take care of it and relea...

unidentified com_error in python

I've encountered the following error while scripting in Python. ERROR Tue 19. Jan 14:51:21 2010 C:\Python24\Lib\site-packages\win32com\client\util.py:0: Script Error com_error: (-2147217385, 'OLE error 0x80041017', None, None) Unfortunately, I don't know what it means, or even what other information I might need to find out. Does ...

How to mark .NET objects exposed to COM-interop as single threaded?

When defining a COM-visible class in C++ I can define the supported threading model in the header file (the threading(single) line): [ coclass, default(IComInterface), threading(single), vi_progid("Example.ComClass"), progid("Example.ComClass.1"), version(1.0), uuid("72861DF5-4C77-43ec-A4DC-ED04396F0CCD") ] ...

Dynamic web content with VB6 (java servlet inspired)

Hi all, I'm working on a project that needs more 'flare' than what can normally be done with VB6. My thought is to generate HTML/CSS content and display this within a browser control on a form. I would also like the ability to respond to form events from the web content within the VB application. My inspiration comes from recent expe...

Configure .NET-Based Components for Registration-Free Activation

I've been trying to get a registration-free .NET based COM DLL to work, but without success. In Visual Studio 2008 I added a new C# class library. I enabled the 'make assembly COM-visible' and 'register for COM interop' options. I added a public interface and class with some functions. I added a manifest dependency to my C++ client app...

COM dll error when tried from IIS

I have an ASP.NET 3.5 application where I am using an ActiveX control. When I try to run the website from Visual Studio 2008 using built-in web server it is working like a charm. When I publish the same code to IIS I get the following error: Retrieving the COM class factory for component with CLSID {ADAACEC8-D9F2-4E05-A5F3-D29E5C9C82F9...

How do I check if a swf file loaded correctly since put_Movie always returns S_OK?

I am using the latest flash player and have a swf file served locally from my dev machine. In one container test app I am able to play the swf and make calls to it, but in my "Real" application the same code path results in com errors (basically it looks like the swf isn;' loading properly) Additionally this is made more challenging be...

Calling vb6 objects from asp.net web service fails but works from forms app

We have an asp.net web service running on Windows Small Business Server 2008 SP2 (64-bit). It is in its own application pool. We've tried both Integrated and Classic settings for Managed Pipeline Mode. Enable 32-bit Applications is set to True. It is not able to successfully call a vb6 dll method but a Windows Forms app on the same m...

marshalling custom directshow filter interface in c#

Hey folks, I've been stuck on this for the past few days. I have a custom COM interface that I am able to cast to, but when I call one if it's functions I get an AccessViolationException because the this pointer has changed. The below code represents the two interfaces that I am marshalling. All methods result in the same problem. Any...

What are all of the well-known virtual folder GUIDs?

There seem to be a few virtual folders which have GUIDs associated to them (control panel, desktop) - ::{00021400-0000-0000-c000-000000000046} // desktop Where the blazes are these defined? When are they used? What I want is a way to have a string which represents a virtual folder without any ambiguity. If, for instance, I were to...

Enumerate COM object (IDispatch) methods using ATL?

Using ATL (VS2008) how can I enumerate the available methods available on a given IDispatch interface (IDispatch*)? I need to search for a method with a specific name and, once I have the DISPID, invoke the method (I know the parameters the method takes.) Ideally I would like to do this using smart COM pointers (CComPtr<>). Is this po...

IDL in ATL/COM: Can I publish a const of a complex type?

I know how to publish a const of a simple type in IDL, for example: const long blah = 37 But I want to publish consts of complex types, with methods, or at least readable struct-like member fields. For example, perhaps a type called CarType, which has accessor fields like "get_Make", "get_Model", "get_Year", "get_BasePrice", et ceter...

Registering handlers for .NET COM event in C++

I've been following the 'tutorials' of how to expose a .NET framework through COM ( http://msdn.microsoft.com/en-us/library/zsfww439.aspx and http://msdn.microsoft.com/en-us/library/bd9cdfyx.aspx ). Everything works except for the events part. When I add events to the C# interface the following C++ code is generated: struct __declspec(u...

Why can't I register my COM DLLs?

My application needs two COM DLLs to be registered. It is done automatically if the user has the necessary access rights, but otherwise it can be done using regsvr32. Now on a few workstations the following happens: Start cmd.exe as Administrator Register first DLL: Success Register second DLL: Failure (0x80004005, Access denied) T...