Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

Search Results for "Marshalling " in [All]

user32

.

        /// we don't have to do any special marshalling here.  Much

Interfaces

.
Summary
Part of the Task Scheduler 1.0 Interfaces, which consists of IEnumWorkItems, ITask, ITaskScheduler, ITaskTrigger and IScheduledWorkItem. There is some helper code below for actually using the iterator as the marshalling seemed impossible without resorting to the unmanaged helper functions in System.Runtime.InteropServices.Marshal. Not all methods have been tested, so be careful!

mscorsn

.

Requires manual marshalling of parameters. The Size parameters refer to the length of the buffer in bytes, though the buffers contain Unicode characters.

setupapi

.

        //Marshalling vars

.

        //Marshalling vars

advapi32

.

An alternate approach to this can be found at http://blogs.msdn.com/peerchan/pages/487834.aspx. However as presented that technique requires more manual marshalling and more work for the calling code.

.

Custom Marshalling provide a self contained and caller transparent solution to this scenario, the returned Credentials object is fully managed without the need to worry about object lifetimes.

Structures

.

       // Alternate, Structure Version.  This One Allows Correct Marshalling As A "ref" Parameter,

.

    <Some Marshalling attribute here>

.

ptstrName is actually a LPTSTR in windows API (whereas string in .NET is unicode), so a marshalling attribute is needed to make it work.

ole32

.
Summary
The CoSetProxyBlanket API is not safe for use from managed code directly, you must use the .NET marshalling APIs to access the right COM functions.

misc

.

One question: The APIs here appear to be machanically created from some other source - from things like "System.Windows.Forms.NativeMethods"? The functions are present, but not the structures and data types used in the params. Any plans to do a mechanical dump of the structures as well? The real magic of marshalling is getting the param types set up correctly, which for structures can be quite a pain.

.

The marshalling restrictions are one problem, as well as which DLL is actually used. From the CF side, we usually do the dumb downed one to work on both desktop and device.

glossary

.

static extern TODO Marshalling (TODO);

.

Declare Function Marshalling  Lib "glossary.dll" (TODO) As TODO

.
Documentation
Marshalling @msdn on MSDN
.

Declare Function Marshalling Lib "glossary.dll" (TODO) As TODO

kernel32

.

I understand the conversion between 1 to 4 bytes for the different types of bools. However, isn't [MarshalAs(UnmanagedType.Bool)] the default for marshalling a .NET bool? Therefore making it unnecessary to specify any marshal on the return value. Please let me know if I'm wrong about this.

.

GetProcAddress only comes in an ANSI flavor, hence we help the runtime by telling it to always use ANSI when marshalling the string parameter. We also prevent the runtime looking for a non-existent GetProcAddressA, because the default for C# is to set ExactSpelling to false.

.

Should the marshalling not be: <MarshalAs(UnmanagedType.LPWStr)> Otherwise lpBuffer will be converted to Ansi and then passed to a Unicode API method.


 
Access PInvoke.net directly from VS: