MC++ Question



Greetings,

With a Managed class, if I'm #including a Windows SDK header file, and call
an API, it appears (according to .NET Reflector) that it automatically
generates a [DLLImport()] for each API call that I make. In other words, it
isn't actually calling the native method directly, right?

So, when I create a variable based on a struct (such as POINT or COORD) in
my Managed class, I can't just pass it in to the API call, right? It seems
that the compiler generates an empty stub of each struct I use from the SDK
header files, but it doesn't actually generate the members of the struct.
Is this left as an excercise for me to do?

One of the more interesting problems I can't seem to solve, if I have a
WinAPI struct defined as static at the class-level on a Managed class, and
use it in a function, it won't let me because of casting a __gc* pointer or
something like that. But if I define the same verianle locally, it works
just fine. I can't seem to figure out why. Perhaps I need to do something
to the class-member variable? (correct my terminology, its been many years
since I programmed C++ and I've about forgotten everything from lack of
practice).

One of the reasons I moved this project into MC++ is because I tired of
redfining API after API and struct after struct in C#. I thought that it
would be easier in MC++. And for the most part, it is a breeze when I
actually figure things out. But, I really don't want to keep redefining the
structs unless I have to. If I must, I must, its still easier (and more
interesting) than doing it in C#. Is there an easy way or is this it? Does
it get any easier with the 2005 implementation of IJW?


Thanks,
Shawn


.



Relevant Pages

  • Re: MC++ Question
    ... > automatically generates a for each API call that I make. ... > my Managed class, I can't just pass it in to the API call, right? ... > seems that the compiler generates an empty stub of each struct I use from ... in unmanaged code and then create a managed wrapper around the unmanaged ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Sending HTTP request
    ... Using gethostbyname() API you'll be able to get the host address. ... With socketAPI you'll create a new socket descriptor. ... have headers files for C language (both struct definition and function ...
    (comp.sys.ibm.as400.misc)
  • Re: Pointer to "base" type - what does the Standard say about this?
    ... Since the `api' is the first element ... in each struct, it is always safe to convert the struct pointer to ... all of my implementations can (and in fact ... The interfaces are used by the rest of the ...
    (comp.lang.c)
  • Re: Decrypting EFS file
    ... However, this API has a callback that must be fed with data from the file, ... INCLUDING the $EFS stream containing the encryption-related stuff. ... > DWORD m_dwVersionMinor; ... > struct EFS_ENTRY_HEADER ...
    (microsoft.public.windows.file_system)
  • Re: PInvoke TCHAR[] ??? Having trouble with this.
    ... |> Please show us your C# struct declaration, ... | public System.UInt32 DriverType; ... | internal struct SP_DEVINFO_DATA ... Try calling the API passing a IntPtr as third argument (change the API ...
    (microsoft.public.dotnet.languages.csharp)