i could never get myself to change the window style... i am just seeing what i can do, its obviosly no this. i tried.
call sendmessage( awindow&, WS_MINIMIZE, ?, ?)
what do i put in those ? marks
was i even close to getting it right?
Printable View
i could never get myself to change the window style... i am just seeing what i can do, its obviosly no this. i tried.
call sendmessage( awindow&, WS_MINIMIZE, ?, ?)
what do i put in those ? marks
was i even close to getting it right?
SendMessage should send a WM_.... message, a Windows Message. I suppose the WS_MINIMIZE could be used with the SetWindowLong API, combined with a GWL_STYLE. But I think the easiest way to minimize a window outside your application is to use the CloseWindow API. For an example look at the message I posted a few minutes ago.
.. or you could try:
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Const SW_HIDE = 0
Private Const SW_MINIMIZE = 6
Private Const SW_NORMAL = 1
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
h=findwindow(vbnullstring,"API to windowstyle - vb q and a - microsoft internet explorer")
showwindow h, SW_MINIMIZE
Frans C is on the right track. Here is an example:
Every time you click the button it will either remove or add a Minimize Button.Code:Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Const GWL_STYLE = (-16)
Private Const WS_MINIMIZEBOX = &H20000
Private Sub Command1_Click()
Static b As Boolean
HideShowMinimize Me.hWnd, b
b = Not b
End Sub
Public Sub HideShowMinimize(hWnd, pShow As Boolean)
Dim lStyle As Long
lStyle = GetWindowLong(Me.hWnd, GWL_STYLE)
If pShow Then
lStyle = lStyle Or WS_MINIMIZEBOX
Else
lStyle = lStyle Xor WS_MINIMIZEBOX
End If
SetWindowLong Me.hWnd, GWL_STYLE, lStyle
End Sub
------------------
Serge
Software Developer
[email protected]
[email protected]
ICQ#: 51055819