Salve,
ho un problema che nn riesco a risolvere sto provando a verificare lo stato di una finestra conoscendone l'handle, riporto qui sotto il codice. Il problema è che la
GetWindowPlacement mi restituisce sempre ZERO, ossia un errore
la api getlasterror mi da errore numero 126)
Qualcuno sa indicarmi l'errore se c'è ? O come posso fare per verificare lo stato di una finestra partendo dal suo handle ?
Grazie mille !!
Ciao
codice:
Public Class Form1
Inherits System.Windows.Forms.Form
Public Structure RECT
Dim Left As Integer
Dim Top As Integer
Dim Right As Integer
Dim Bottom As Integer
End Structure
Public Structure POINTAPI
Dim x As Integer
Dim y As Integer
End Structure
Public Structure WINDOWPLACEMENT
Dim Length As Integer
Dim flags As Integer
Dim showCmd As Integer
Dim ptMinPosition As POINTAPI
Dim ptMaxPosition As POINTAPI
Dim rcNormalPosition As Rect
End Structure
Public Declare Function GetWindowPlacement Lib "user32" Alias "GetWindowPlacement" (ByVal hwnd As Integer, ByVal lpwndpl As WINDOWPLACEMENT) As Integer
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim handle As Long
Dim WinEst As WINDOWPLACEMENT
Dim rtn As Long
handle = (FindWindow(Nothing, "Senza nome - Blocco note"))
MsgBox("find : " & handle)
WinEst.Length = Len(handle)
rtn = GetWindowPlacement(handle, WinEst)
MsgBox("Ritorna : " & rtn)
End Sub
End Class