PDA

Click to See Complete Forum and Search --> : API call.......?


DanG77
Oct 27th, 2000, 04:21 AM
Does anyone know how to change the state of an external window? for example if my application has a form and button, i want the button to be able to restore Word... which i know is open, but just minimized!!! i also have the title of the window..... i am sure there is a simple call, maybe to the win api, but not sure.

Oct 27th, 2000, 06:15 AM
Use the FindWindow and ShowWindow api functions.

Declare Function FindWindow Lib "user32.dll" _
Alias "FindWindowA" (ByVal lpClassName As Any, ByVal _
lpWindowName As Any) As Long

Declare Function ShowWindow Lib "user32.dll" (ByVal hwnd As _
Long, ByVal nCmdShow As Long) As Long


Private Sub Command1_Click()

handl = FindWindow(vbNullString, "Microsoft Word - Untitled")
If handl <> 0 Then
ShowWindow handl, 9 'restore window
End If

End Sub