com

C# - Good way to expose Nullable<T> to COM

We are working on exposing an assembly to COM. Among other things, we frequency use nullable values such as long?, DateTime?, etc. These are generic types and can't be exposed to COM. What is a good substitute for these data types for COM? We have tried the following: //Original CustomerID property in class public long? CustomerID {...

How to solve Link Error on call to ::UuidToString() ?

Hi All, I have included file "rpcdce.h" for ::UuidToString() function. Still i am getting link error . Can anyone help me ? ...

Hook IDispatch v-table in C++

I'm trying to modify the behavior of an IDispatch interface already present in the system. To do this my plan was to hook into the objects v-table during runtime and modify the pointers so it points to a custom hook method instead. If I can get this to work I can add new methods and properties to already existing objects. Nice. First I...

Use default authentication and separate cloaking/impersonation in DCOM call

Hi I'm trying achieve two things with DCOM (Out of process) Set the process wide authentication using CoInitializeSecurity and its parameter pAuthList. Using cloaking to change the caller's identity in special situations (COM calls) My thoughts: AFAIK the auth info structure contains the default authentication information (like us...

CString vs wstring

I have an MFC application in C++ that uses std::string and std::wstring, and frequently casts from one to the other, and a whole lot of other nonsense. I need to standardize everything to a single format, so I was wondering if I should go with CString or std::wstring. In the application, I'll need to generate strings from a string tabl...

Event Handling for Dynamically Created Activex Control

Hello, The scenario: I have a TabCtrl in which I plan to place 1 ActiveX Control (myActXCtrl) in each Tab. The number of Tabs can increase dynamically. Hence, I have to create a new instance of ActiveX Control (myActXCtrl) each time and place it in the newly created Tab (I have done till this point successfully). The problem: Th...

change Access Permissions in Component Services > COM Security with script/api?

is there an api to change the Access Permissions for the COM Security? i need to write new values to "Edit Limits..." and "Edit Default...". are these plain registry settings? can't find how to set these entries. ...

HRESULT:0x80040154 COM object with CLSID {} is either not valid or not registered.

I am using COM Object in my C# .NET 1.1 application. When the COM object is not registered on client machine, I get the exception: "COM object with CLSID {} is either not valid or not registered." (HRESULT:0x80040154) I know how to register the COM object using regsvr32. Our requirement is to identify the COM object which is no...

In COM, how can I get notified when a client dies?

I've got a COM solution with a client (an EXE) and a server (a service EXE). When the client is killed, or dies abnormally, I'd like to know about it in the server. Unfortunately, it appears that COM doesn't call Release when this happens. How can I tell that a COM client has died, so that I can clean up for it? Update: Answers so far ...

Return value from execScript(IHTMLWindow2)

hi, What is the best way to get the return value from IHTMLWindow2::execScript? I found this link, http://social.msdn.microsoft.com/Forums/en/ieextensiondevelopment/thread/712db8ec-0ceb-4efa-afe3-590dc6bbb7bf, I haven't tried this, is this the right way? Regards Manoj ...

How do I get FinalRelease to be called when using GlobalInterfaceTable?

I am using Visual Studio 2008 and I have created an ATL Project. I have aded a ATL Simple Object to the project. I want to add my object to the Global Interface Table when the object is created, so I have the following code in my FinalConstruct call: HRESULT res; res = CoCreateInstance(GLSID_StdGlobalInterfaceTable, NULL, CLSCTX_INPRO...

Serial COM-connections 64bit versions

Hi, I have a .net Application that writes text to a serial COM port, a POS reciept printer to be more exact. i am using the Rs232 class library to write and read to a serial device. My problem is now with some clients that have updated their operatingsystem to WIN7 64bit version, have trouble to create a connection to the COM-port. th...

Change COM port via registry, command line or software?

Hi. Does anybody know how to change the COM port number that Windows maps to a USB virtual COM port? You can change this via the Device Manager and clicking on the Advanced button.. but how can you do this via an API, registry change or commandline operation? Any ideas please? ...

iTunes COM interface, get the content of the search box

Is there any way to obtain a reference to the iTunes search box, and read the current content out of it? Either in C# or C++. I am using the iTunes 1.12 Type Library. ...

System.InvalidCastException when using a COM interface

I wrote a atl COM dll, dual. And used one of its intreace X in a C# GUI proj. when call X.F(), I got an System.InvalidCastException, can not cast namespace.XClass to namespace.IX, QueryInterface failed: BADTYPE. The call was in my own thread. If i move the code to the GUI thread, it works just fine. Please help me with that. Thanks a l...

COleSafeArray / VARIANT memory leak?

I want to export a lot of (table) data to Excel. I'm developing on Windows Xp, Vs2005. I'm filling a COleSafeArray, which was initialized like this: safeArray.Create( VT_VARIANT, 2, numElements ); // 2 dimensional, 30000 rows, 3 columns Now the filling is really fast, but in TaskManager/Process Explorer/VMMap, it looks like some of th...

Exposing class library DLL to COM with generics

For the sake of this question, here is my generic class. [ComVisible(true)] public class HtmlTable<T> where T : class { List<T> listToConvert; public HtmlTable(List<T> listToConvert) { this.listToConvert = listToConvert; } } Essentially, this class is responsibly for converting a List of class T to an HTML tab...

Using vb.net dll in unmanaged c++ project

I created a vb.net dll called "WSdll.dll". I compiled it, created a type library (tlb), and registered it globally(gacutil).. It includes a file called wsutils.vb, which includes a namespace called "wsutils". In the namespace, there's an interface (with attribute) called "IWSconnection", and a class called "WSconnection". The interface ...

Asynchronous Pluggable Protocols

Using this as reference, I'm trying to create an asynchronous pluggable protocol that is only temporarily available to my app (and not registered systemwide). I'm using CoInternetGetSession and then calling RegisterNameSpace to do it. However, when I make the call to RegisterNameSpace I get an AccessViolation exception: Attempting to re...

C++ undeclared identifier - object from .net dll class

I have a vb.net dll which I imported in an unmanaged c++ project. I successfully created an object of the class object using: CComPtr< IWSconnection > pIWSconnection; pIWSconnection.CoCreateInstance( __uuidof(IWSconnection ) ); Then, when I tried to call a method from the dll: pIWSconnection.connect(...); I am getting an erro...