com

WCHAR array not properly marshalled

I have a COM interface with a following method definition (IDL notation): SCODE GetText( [in, out] ULONG* pcwcBuffer, [out, size_is(*pcwcBuffer)] WCHAR* awcBuffer ); Typelib marshaling is used for COM+, the type library is registered, other methods of the interface work allright when called through COM+, but not this met...

How do I start an out of process COM server as another (more privileged) user

I would like to create a COM object that runs in an out of process COM server as another user. How do I do that? I have control over the COM server source code and my COM client is the only one that will be creating these COM objects. ...

IAudioSessionNotification, anyone have working code?

I'm picking up some experimental code I was messing with in the Windows 7 Beta now that I've installed the RC. Basically, I'm trying to get IAudioSessionManager2 & IAudioSessionNotification working together to inform my little app of every new audio session created. Punchline code in AudioListener ( : public IAudioSessionNotification):...

What is the difference between COM and .NET?

Duplicate What is the difference between net components and com components What is the exact difference between COM and .NET? Is .NET a simple cloak of COM or is it something completly different? ...

Why would I get a GPF in DLLMain when run as a restricted user?

Why is this code crashing when run as a restricted user, but not when run as an admin of the machine? extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) { hInstance; m_hInstance=hInstance; return _AtlModule.DllMain(dwReason, lpReserved...

Parameter type for a complex object in a COM-visible function (VB6)

Should we use object or variant? What difference does it make? ...

Do I need a job queue in my COM server?

I have a COM EXE out-of-proc server exposing an API from one of its interfaces. The functionality of this API is to post URLs. My client will be creating the instance of the COM server and calling this API with new URLs. Every time client needs to post a URL it will create an instance of this COM server. Do I need to implement a queue...

How do the threads get created inside a COM component?

I have one COM component which is instantiated inside a COM service (this .exe is running). I have ten clients. Each client is getting an interface (IXyz) pointer from ROT and calling a method IXyz::abc() at the same time. From my traces I see that IXyz::abc() is gettting called 10 times at the same time, but in 10 different threads. ...

Why does COM+ ignore the apartment threading model?

I have an STA COM component which is put into a COM+ application. The client creates several instances of the class in that component and calls their methods in parallel. The class is registered properly - the "ThreadingModel" for the corresponding class id is "Apartment". I see several calls of the same method of the same class being e...

How to place a .net UserControl on a c++ cdialog in visual studio 6

Hi My task is pretty simple create a .net usercontrol and use it in a old visual studio 6 proejct. I have createt the usercontrol (its just a user control with a label), I then followed this guide (http://support.microsoft.com/kb/828736) and it seems to work fine. But how can I display the usercontrol? Do I have to use CreateControl, a...

Problems passing in a UserControl as a parameter in VB6

I have a COM-visible method which looks something like the following: Public Sub SomeMethod(someControl as Object) On Error Goto ErrHandler Dim someSpecificControl as SpecificControl MsgBox TypeOf someControl is Control MsgBox TypeOf someControl is SpecificControl On Error Resume Next Set someSpecificControl = someCon...

Excel 2007 automation on top of a Windows Server 2008 x64

I’m well aware of the Microsoft support base article stating that it’s not supported to automate office products UI less. It seems that Windows Server 2008 x64 and Excel 2007 enforce the given statement. I’m running the following code in a NT Service (Local System account) OnStart method. All it does is Excel automation the way it’s wo...

How to implement Dispose in a COM object

I have written a COM component in unmanaged C++ to provide customers access to our database. When using it from an unmanaged language the database connections are correctly cleaned up as the objects go out of scope. I recently tried using it from VB.NET and discovered that the COM objects are not being destroyed. Scattering calls to S...

Best way to send array of key-value pairs to an API in COM

I want to create an interface with API that can accept array of key-value pairs in COM. What is the best way to do that? I can think of sending SAFEARRAY of BSTR .Each BSTR can be considered as key-value pair . Logic of packing /unpacking key-values need to be added. ...

Windows 64-bit registry v.s. 32-bit registry

Hello everyone, I heard on Windows x64 architecture, in order to support to run both x86 and x64 application, there is two separate/different sets of Windows registry -- one for x86 application to access and the other for x64 application to access? For example, if a COM registers CLSID in the x86 set of registry, then x64 application wi...

Who owns returned BSTR?

Suppose a method from a COM interface returns BSTR value. Am I right in my opinion that I must free it? The code example at http://msdn.microsoft.com/en-us/library/aa365382(VS.85).aspx does not do that. Who's wrong? ...

64 to 32 bit Interop - how?

I need to integrate some legacy 32-bit code - for which I don't have the source code, into a project in such a way that it can be called from a 64-bit .NET assembly. The original code is implemented as a 32-bit COM object in a DLL. Windows doesn't allow direct calls from 64 to 32-bit objects, so I'm looking for inspiration on how to deal...

Passing a managed (C#) string[] array to a COM DLL.

Setup: I have a COM DLL that calls a method inside a managed C# DLL. This function returns a C# string[] array, which is marshaled to a SAFEARRAY. Problem: When I try to access the strings within the safearray I only get the first char of the string. What am I doing wrong? The code: // Pointer to the managed interface Databa...

Create COM Surrogate server (exe) in C#

I know how to create a COM DLL (a Class Library) in C#. Is it possible to create a COM Surrogate EXE using C#? This would be a standalone server capable of launching and hosting COM objects, which would then be accessible to COM clients. ...

ole32.dll causes GPF. How to interpret DebugDiag report?

Hi, My app (EasyJob) causes an access violation error on exiting. This only happens on some systems, mostly Vista, but it has happened on some XP boxes. The application is written in VB6. After finding a system that shows this behavior, I ran DebugDiag on my process and got this report: Function Arg1 Arg2 Arg3 0x04246c81 ...