Click here to Skip to main content
15,915,975 members
Home / Discussions / COM
   

COM

 
GeneralExcel events inside a DLL Pin
Zizilamoroso19-Jun-02 23:48
Zizilamoroso19-Jun-02 23:48 
GeneralRe: Excel events inside a DLL Pin
soptest20-Jun-02 7:54
soptest20-Jun-02 7:54 
GeneralInterlocked increment failed Pin
sefip19-Jun-02 20:56
sefip19-Jun-02 20:56 
GeneralRe: Interlocked increment failed Pin
Dudi Avramov20-Jun-02 2:05
Dudi Avramov20-Jun-02 2:05 
Generallock-up catching excel events Pin
Zizilamoroso18-Jun-02 23:54
Zizilamoroso18-Jun-02 23:54 
GeneralRe: lock-up catching excel events Pin
Zizilamoroso19-Jun-02 1:20
Zizilamoroso19-Jun-02 1:20 
GeneralRe: lock-up catching excel events Pin
soptest20-Jun-02 7:52
soptest20-Jun-02 7:52 
GeneralLegacy COM calling .NET DLL: LPArray problem Pin
bad_english18-Jun-02 21:01
bad_english18-Jun-02 21:01 
Does anyone know how to properly marshal the data from legacy app to
a .Net component? The legacy app uses the following IDL interface
definition:

interface IMyInterface2 : IUnknown
{
HRESULT doit( [in, size_is(msgLength)]UCHAR* msg, [in] ULONG
msgLength );
};

When my legacy COM Client calls my .Net component that implements this
interface, an access violation (0xC0000005) exception is thrown. I've
tried everything and can not figure out why the exception is thrown in
the
COM Client.

Here is the COM Client:

#include "stdafx.h"
#include "IMyInterface2_h.h"
#include "IMyInterface2_i.c"

int _tmain(int argc, _TCHAR* argv[])
{
HRESULT hr = S_OK;
hr = ::CoInitialize( NULL );
CLSID rcid = { 0x5F850215, 0x7AC2, 0x48b8, { 0xA8, 0xCF, 0xA0, 0x08,
0xF7, 0x33, 0xD6, 0x61 } };

{
CComPtr<imyinterface2> iMyInterface2;
hr = iMyInterface2.CoCreateInstance( rcid, NULL, CLSCTX_INPROC_SERVER
);
UCHAR* pBytes = (UCHAR*)::CoTaskMemAlloc( 20 );
::ZeroMemory( pBytes, 20 );
iMyInterface2->doit( pBytes, 20 );
}
::CoUninitialize();

return 0;
}

The exception is thrown on the statement:
iMyInterface2->doit( pBytes, 20 );
The call never gets to the .Net component's method

And here is the .Net service component. The .Net component must be
copied in the same directory as the COM client.

using System;
using System.Runtime.InteropServices;

namespace ComSrv
{
[GuidAttribute("5F850215-7AC2-48b8-A8CF-A008F733D661")]
public class MyClass : IMyInterface2
{
public void doit( byte[] msg, ulong msgLength )
{
}
}

[ComImport]
[GuidAttribute("B55AFAEB-BC7D-4ca9-8065-F9A45FE378B6")]
[InterfaceTypeAttribute
ComInterfaceType.InterfaceIsIUnknown)]
public interface IMyInterface2
{
void doit(
[In, MarshalAs( UnmanagedType.LPArray,
SizeParamIndex=1, ArraySubType=UnmanagedType.U1 )]byte[]
msg, [In]ulong msgLength );
}
}
GeneralCatching Events Pin
18-Jun-02 4:48
suss18-Jun-02 4:48 
GeneralRe: Catching Events Pin
Amit Dey18-Jun-02 11:14
Amit Dey18-Jun-02 11:14 
GeneralRe: Catching Events Pin
19-Jun-02 4:37
suss19-Jun-02 4:37 
GeneralRe: Catching Events Pin
20-Jun-02 6:32
suss20-Jun-02 6:32 
GeneralRe: Catching Events Pin
Anonymous27-Aug-02 9:15
Anonymous27-Aug-02 9:15 
GeneralRe: Catching Events Pin
Amit Dey27-Aug-02 13:52
Amit Dey27-Aug-02 13:52 
GeneralException Handling Error Pin
soup15-Jun-02 6:00
soup15-Jun-02 6:00 
GeneralRe: Exception Handling Error Pin
Tim Smith15-Jun-02 6:20
Tim Smith15-Jun-02 6:20 
GeneralRe: Exception Handling Error Pin
soup15-Jun-02 14:25
soup15-Jun-02 14:25 
GeneralRe: Exception Handling Error Pin
Tim Smith15-Jun-02 14:58
Tim Smith15-Jun-02 14:58 
QuestionHow to pass out an array from a com+ object? Pin
Lizp13-Jun-02 23:43
Lizp13-Jun-02 23:43 
AnswerRe: How to pass out an array from a com+ object? Pin
soptest14-Jun-02 9:40
soptest14-Jun-02 9:40 
GeneralRe: How to pass out an array from a com+ object? Pin
Lizp14-Jun-02 16:09
Lizp14-Jun-02 16:09 
GeneralPlease help (Events) Pin
Jason Troitsky (was Hattingh)13-Jun-02 21:30
Jason Troitsky (was Hattingh)13-Jun-02 21:30 
GeneralRe: Please help (Events) Pin
Amit Dey15-Jun-02 5:55
Amit Dey15-Jun-02 5:55 
GeneralRe: Please help (Events) Pin
Jason Troitsky (was Hattingh)15-Jun-02 6:19
Jason Troitsky (was Hattingh)15-Jun-02 6:19 
GeneralRe: Please help (Events) Pin
Amit Dey15-Jun-02 14:56
Amit Dey15-Jun-02 14:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.