Click here to Skip to main content
15,909,747 members
Home / Discussions / COM
   

COM

 
Questionabout directsound transfer and play back Pin
doudou-shen10-Jun-08 19:47
doudou-shen10-Jun-08 19:47 
Questionregarding System Error Code 995 Pin
pra84veen9-Jun-08 0:28
pra84veen9-Jun-08 0:28 
AnswerRe: regarding System Error Code 995 Pin
CPallini9-Jun-08 0:51
mveCPallini9-Jun-08 0:51 
AnswerRe: regarding System Error Code 995 Pin
Mike Dimmick10-Jun-08 2:56
Mike Dimmick10-Jun-08 2:56 
AnswerRe: regarding System Error Code 995 Pin
buntyrolln12-Jun-08 2:43
buntyrolln12-Jun-08 2:43 
QuestionOLE Control Draw & Update Problem Pin
DavidRipple7-Jun-08 20:16
DavidRipple7-Jun-08 20:16 
QuestionWhich API is used for changing the video settings. Pin
balaji_vbr6-Jun-08 19:54
balaji_vbr6-Jun-08 19:54 
QuestionVB6 - C# interop. Returning an arrays. MarshalAs? Pin
Simon P Stevens6-Jun-08 0:07
Simon P Stevens6-Jun-08 0:07 
Hi,

I'm writing a C# class that will be used by a VB6 application. The class has a method that needs to return an array of custom objects.

Initially I just couldn't get this to work. I got a "type mismatch" error every time the call was made in VB.

then I found this[^] page which suggested tagging the interface with [return: MarshalAs(UnmanagedType.AsAny)]. This got it working. Big Grin | :-D

My question is why does this work?

As I understand it, MarshalAs(UnmanagedType.AsAny) dynamically detects the type and marshals as the correct type, but I know what type it is, why wouldn't VB accept it as an array of MyClass. MyClass is fully com visible and VB is happy to use it fine in several other areas, it just doesn't like the MyClass[] when returned from a c# method.

I've programmed C# & VB6 separately loads before, but this is my first attempt at any interop.

Can anyone explain or point me at a good resource?

Cheers

[Sorry if this is the wrong place to ask. I know it's VB6 - C#, but I thought the problem is more related to the COM interop factor. If anyone thinks otherwise, shout and I'll move it]

Simon

AnswerRe: VB6 - C# interop. Returning an arrays. MarshalAs? Pin
Baltoro12-Jun-08 6:51
Baltoro12-Jun-08 6:51 
GeneralRe: VB6 - C# interop. Returning an arrays. MarshalAs? Pin
Simon P Stevens12-Jun-08 10:57
Simon P Stevens12-Jun-08 10:57 
QuestionDirectShow video capture and play back synchronisation problem Pin
ak$12345-Jun-08 22:04
ak$12345-Jun-08 22:04 
AnswerRe: DirectShow video capture and play back synchronisation problem Pin
stuart151-Sep-08 0:00
stuart151-Sep-08 0:00 
QuestionLaunching multiple IE [modified] Pin
Nirav Doshi5-Jun-08 8:19
Nirav Doshi5-Jun-08 8:19 
AnswerRe: Launching multiple IE Pin
Nirav Doshi5-Jun-08 10:11
Nirav Doshi5-Jun-08 10:11 
QuestionRe: Launching multiple IE [modified] Pin
Nirav Doshi12-Jun-08 18:04
Nirav Doshi12-Jun-08 18:04 
AnswerRe: Launching multiple IE Pin
Nirav Doshi14-Jun-08 0:10
Nirav Doshi14-Jun-08 0:10 
AnswerRe: Launching multiple IE Pin
Michael Dunn12-Jun-08 14:45
sitebuilderMichael Dunn12-Jun-08 14:45 
GeneralRe: Launching multiple IE Pin
Nirav Doshi13-Jun-08 8:19
Nirav Doshi13-Jun-08 8:19 
AnswerRe: Launching multiple IE Pin
Jörgen Sigvardsson13-Jun-08 10:49
Jörgen Sigvardsson13-Jun-08 10:49 
GeneralRe: Launching multiple IE Pin
Nirav Doshi13-Jun-08 20:14
Nirav Doshi13-Jun-08 20:14 
GeneralRe: Launching multiple IE Pin
Jörgen Sigvardsson13-Jun-08 22:14
Jörgen Sigvardsson13-Jun-08 22:14 
GeneralRe: Launching multiple IE Pin
Nirav Doshi14-Jun-08 2:06
Nirav Doshi14-Jun-08 2:06 
QuestionDetect Network Adapters in Borland C++ Builder Pin
Nekt Chrono4-Jun-08 21:54
Nekt Chrono4-Jun-08 21:54 
QuestionExcel WorkbookBeforeClose event Document Proof Pin
HarishKumarS4-Jun-08 4:37
HarishKumarS4-Jun-08 4:37 
Questionpass a parameter to a com+ application Pin
Ayman Mashal4-Jun-08 0:19
Ayman Mashal4-Jun-08 0:19 

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.