Link to home
Start Free TrialLog in
Avatar of HLRosenberger
HLRosenbergerFlag for United States of America

asked on

Windows and Extended desktop

I'm trying to code this in VB.NET desktop app.  But I get syntax errors.  What is wrong?

  <StructLayout(LayoutKind.Sequential)>
    Public Structure IntegerPoint
        Public Property X() As Integer
        Public Property Y As Integer
    End Structure

User generated image
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Did you mean to make X an integer array, Public Property X() As Integer, or did you mean to make it an integer like this, Public Property X As Integer?
Avatar of Kimputer
Kimputer

Depends on the syntax error.
Otherwise, just check if this is on top of your code:

Imports System.Runtime.InteropServices
as per the definition on http://www.pinvoke.net/default.aspx/Structures/POINT.html, X is not an array (as pointed by Fernando). You need to remove the () after X:
  <StructLayout(LayoutKind.Sequential)>
    Public Structure IntegerPoint
        Public Property X As Integer
        Public Property Y As Integer
    End Structure

Open in new window

Avatar of HLRosenberger

ASKER

Nothing I try works, using that <StructLayout(LayoutKind.Sequential)> syntax.

This below works just fine.  Is there any difference?


    Public Structure IntegerPoint
        Public x As Integer
        Public y As Integer
    End Structure

    Public Structure IntegerRect
        Public Left As Integer
        Public Top As Integer
        Public Width As Integer
        Public Height As Integer
    End Structure

    Public Structure WindowPlacement
        Public Length As Integer
        Public Flags As Integer
        Public ShowCommand As Integer
        Public MinPosition As IntegerPoint
        Public MaxPosition As IntegerPoint
        Public NormalPosition As IntegerRect
    End Structure
SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
What is the exact error you are getting now? Please post.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the help.
thanks.