Click here to Skip to main content
15,894,405 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralRe: C++ vs Managed Pin
palbano31-Jul-04 19:02
palbano31-Jul-04 19:02 
Generalassign mfc handle to dotnet form Pin
luke0530-Jul-04 1:36
luke0530-Jul-04 1:36 
GeneralUpdating multiple treeviews Pin
Sam Barham29-Jul-04 13:45
Sam Barham29-Jul-04 13:45 
GeneralConverting a managed .NET System::String to an unmanaged, UTF-8 encoded, null-terminated char array Pin
jerrycainjr29-Jul-04 8:30
jerrycainjr29-Jul-04 8:30 
GeneralRe: Converting a managed .NET System::String to an unmanaged, UTF-8 encoded, null-terminated char array Pin
palbano29-Jul-04 11:00
palbano29-Jul-04 11:00 
GeneralRe: Converting a managed .NET System::String to an unmanaged, UTF-8 encoded, null-terminated char array Pin
jerrycainjr30-Jul-04 10:07
jerrycainjr30-Jul-04 10:07 
GeneralQuestion about DLL imports - Fast Pin
Stanimir_Stoyanov24-Jul-04 20:20
Stanimir_Stoyanov24-Jul-04 20:20 
GeneralCOM Interop Question Pin
ursus zeta23-Jul-04 12:26
ursus zeta23-Jul-04 12:26 
I am currently reading, ".NET and COM: The Complete Interoperability Guide", by Adam Nathan. As a way to work my way through the material (to better understand it), I am creating a Windows Forms project from which I can programmatically manipulate MS Word. The authors recommends using the Type Library Importer (TLBIMP.EXE) to convert the Microsoft Word 10.0 Object Library (MSWORD.OLB) into an Interop Assembly. The assembly is then referenced in the Visual C++ .NET project and placed in the same directory as the compiled executable. This is surprisingly easy, and the assembly can then be inspected with the IL Disassembler (very similar to the way the OLE/COM Object Viewer works). At this point, in your source code you can instantiate COM objects very simply with the new operator. The author describes all this clearly and in great detail in his book.
Anyway, many of the method calls on the COM object involve passing structures to the COM component as a VARIANT. The Interop Marshaler apparently maps the COM VARIANT type to the .NET System::Object type, but, there is no way to pass a struct via a System::Object type to the COM object. So the method call throws an exception if you attempt to pass a System::Object to it (or just doesn't compile in the first place). However, the author has included in his book a code listing which manually marshals the VARIANT type in a given example to a structure which the COM component accepts and the function call then will succeed. It is confusing as hell, frankly, and I don't yet fully understand why it works. The basic idea is to reassemble the assembly after changing the signature of the original method so that it accepts an IntPtr instead of the VARIANT. He then writes a class that is like an Interop chimera, and which converts the original VARIANT into a struct via the IRecordInfo interface (InteropServices) and a couple of functions that you've probably never heard of: GetRecordInfoFromTypeInfo (oleaut32.dll), Marshal::GetITypeInfoForType, and Marshall::GetObjectForIUnknown. (I'm leaving alot of information out of this explanation just for brevity and clarity.)
This seems like an awful lot of trouble to go to, and potentially, you might have to write many of these custom marshalers, all different and complex.
I'm wondering if any of you have had to implement these kinds of marshalers in .NET applications, and if so, just how do they perform, and is the development process as insane as it looks?
Any opinion would be appreciated, thanks.
GeneralFurther Adventures Pin
ursus zeta4-Aug-04 10:37
ursus zeta4-Aug-04 10:37 
GeneralPossible Memory Leak issues Pin
Anonymous23-Jul-04 5:19
Anonymous23-Jul-04 5:19 
GeneralFast question Pin
Oriocat22-Jul-04 10:50
Oriocat22-Jul-04 10:50 
GeneralRe: Fast question Pin
Daniel Turini22-Jul-04 10:57
Daniel Turini22-Jul-04 10:57 
Generalneed doctor to check this pice of code Pin
Oriocat22-Jul-04 9:58
Oriocat22-Jul-04 9:58 
GeneralProblem... Pin
Pazzuzu22-Jul-04 5:13
Pazzuzu22-Jul-04 5:13 
GeneralRe: Problem... Pin
palbano25-Jul-04 18:05
palbano25-Jul-04 18:05 
GeneralConverting ... Pin
User 91483322-Jul-04 3:59
User 91483322-Jul-04 3:59 
GeneralRe: Converting ... Pin
palbano25-Jul-04 18:04
palbano25-Jul-04 18:04 
GeneralWebService without ASP and IIS Pin
MyPaq22-Jul-04 2:08
MyPaq22-Jul-04 2:08 
GeneralGoing mad with this Pin
Pazzuzu21-Jul-04 6:11
Pazzuzu21-Jul-04 6:11 
GeneralRe: Going mad with this Pin
palbano21-Jul-04 17:28
palbano21-Jul-04 17:28 
GeneralRe: Going mad with this Pin
Pazzuzu22-Jul-04 0:07
Pazzuzu22-Jul-04 0:07 
QuestionHow to convert....... Pin
Pazzuzu21-Jul-04 4:09
Pazzuzu21-Jul-04 4:09 
GeneralVritual functions wapping Pin
Mostafa Mohamed20-Jul-04 2:12
Mostafa Mohamed20-Jul-04 2:12 
GeneralSystem::IO::File::Copy errors Pin
Chris Korzeniowski19-Jul-04 10:21
Chris Korzeniowski19-Jul-04 10:21 
GeneralRe: System::IO::File::Copy errors Pin
Chris Korzeniowski19-Jul-04 11:36
Chris Korzeniowski19-Jul-04 11:36 

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.