|
-
Feb 2nd, 2005, 08:23 AM
#1
Thread Starter
Junior Member
Change window status
Hello,
Let say I have a window (IE for instance) and I know its handle (hwnd). How can I do to change the status window:
- active window
- full screen window
- miunimized window
etc...
I know I can do it using the shell command, but my program is already running, so I can't start it with shell...
Is there some functions like setMinimized(hwnd) ????
Thx for replying
-
Feb 2nd, 2005, 08:29 AM
#2
Re: Change window status
you would use the setwindowplacement api
VB Code:
Private Const SW_MINIMIZE = 6
Private Type POINTAPI
x As Long
y As Long
End Type
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type WINDOWPLACEMENT
Length As Long
flags As Long
showCmd As Long
ptMinPosition As POINTAPI
ptMaxPosition As POINTAPI
rcNormalPosition As RECT
End Type
Private Declare Function ClientToScreen Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
Private Declare Function GetWindowPlacement Lib "user32" (ByVal hwnd As Long, lpwndpl As WINDOWPLACEMENT) As Long
Private Declare Function SetWindowPlacement Lib "user32" (ByVal hwnd As Long, lpwndpl As WINDOWPLACEMENT) As Long
Dim Rectan As RECT
Private Sub Form_Load()
Dim WinEst As WINDOWPLACEMENT
Dim rtn As Long
WinEst.Length = Len(WinEst)
'get the current window placement
rtn = GetWindowPlacement(Me.hwnd, WinEst)
Rectan = WinEst.rcNormalPosition
End Sub
Private Sub Command1_Click()
Dim WinEst As WINDOWPLACEMENT
Dim Punto As POINTAPI
Dim rtn As Long
'set the new min/max positions
Punto.x = 100
Punto.y = 100
'initialize the structure
WinEst.Length = Len(WinEst)
WinEst.showCmd = SW_MINIMIZE
WinEst.ptMinPosition = Punto
WinEst.ptMaxPosition = Punto
WinEst.rcNormalPosition = Rectan
'set the new window placement (minimized)
rtn = SetWindowPlacement(Me.hwnd, WinEst)
End Sub
from allapi
rgds pete
-
Feb 2nd, 2005, 11:36 AM
#3
Thread Starter
Junior Member
Re: Change window status
Thx a lot for replying so fast, it works fine!!!!!!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|