To do what your try to do, you apparently have to use P/Invoke. By doing this, you totally loose platform compatibility. Did you know that your application, even the Forms application (but not WPF) if written accurately, can run on many systems without recompilations, such as Linux, Mac OS X and more? You are going to loose it. No need.
All you need is using the property
Top
(or whatever) and fixing position/size; for example, in the event handler of the event
System.Windows.Forms.Form.Shown
:
Me.Shown += Function(sender, eventArgs)
If Me.Top < 140 Then
Me.Top = 140
End If
End Function
Something like that. Try to forget about using Windows API unless this is absolutely needed. You probably will be amazed how rarely it is the case.
[EDIT]
And I agree with AspNetDev who reminded us that it would require adding appropriate handlers to events like
SizeChanged
and
Move
. Please see our discussion in comments below.
—SA