how to Focus on a child windows in java forms ?

  • Thread starter Thread starter Mostafa Salaheldien
  • Start date Start date
M

Mostafa Salaheldien

Guest
Hello everone,

i wsa using this code to focus on child window in windows form and its working 100%

but how can i use it to focus on child window in java form

Private Declare Auto Function FindWindowEx Lib "user32" (ByVal parentHandle As Integer,
ByVal childAfter As Integer,
ByVal lclassName As String,
ByVal windowTitle As String) As Integer

Private Declare Auto Function PostMessage Lib "user32" (ByVal hwnd As Integer,
ByVal message As UInteger,
ByVal wParam As Integer,
ByVal lParam As Integer) As Boolean

Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hWnd As IntPtr) As Integer
Private Declare Function SetFocus Lib "user32.dll" (ByVal hWnd As IntPtr) As Integer



and this code to check if the form open or not

Dim hwnd2 As IntPtr = FindWindow(Nothing, "Scan Document")
' vicaopenafter12.Enabled = True
If hwnd2 = IntPtr.Zero = True Then
End if

and this code to close the child

Dim WM_QUIT As UInteger = &H12
Dim WM_CLOSE As UInteger = &H10

Dim x1 As Integer = FindWindowEx(0, 0, Nothing, "Print Report")

PostMessage(x1, WM_CLOSE, 0, 0)


How can i use it in java from ?

thank u so much

Continue reading...
 
Back
Top