'UPGRADE_WARNING: Structure WINDOWPLACEMENT may require marshalling attributes to be passed as an argument in this Declare statement. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="C429C3A5-5D47-4CD9-8F51-74A1616405DC"'
'Upgraded from Vb 6
Public Declare Function GetWindowPlacement Lib "user32" (ByVal hwnd As Integer, ByRef lpwndpl As WINDOWPLACEMENT) As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim struct As New WINDOWPLACEMENT
Try
GetWindowPlacement(CInt(AppDomain.GetCurrentThreadId()), struct)
Messages.Text += vbCrLf & struct.rcNormalPosition.X
Messages.Text += vbCrLf & struct.rcNormalPosition.Y
Messages.Text += vbCrLf & GetLastError()
Catch x As Exception
MessageBox.Show(x.Message)
End Try
End Sub
Declare Function GetWindowRect Lib "user32.dll" ( _
ByVal hwnd As Int32, _
ByRef lpRect As RECT) As Int32
Structure RECT
Public Left As Int32
Public Top As Int32
Public Right As Int32
Public Bottom As Int32
End Structure