• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3156
  • Last Modified:

Marshal.PtrToStructure(pointer, Point) returns error.

Hi,

When i use the Marshal.PtrToStructure i get the following error
The structure must not be a value class.Parameter name: structure.

I pass the function a IntPtr and and a reference to a structure Point.

As far as i can see this is done like Micrsoft says it's supposed to be done.
0
Kapalua
Asked:
Kapalua
1 Solution
 
mac-willCommented:
Hmm... try adding [StructLayout(LayoutKind.Sequential)] above your struct.

Checkout: http://msdn.microsoft.com/en-us/library/0t2cwe11(vs.71).aspx
0
 
KapaluaAuthor Commented:
Thanks!
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now