codice:
Option Explicit
Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crey As Byte, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
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 GWL_EXSTYLE = (-20)
Private Const WS_CAPTION = &HC00000 'WS_BORDER Or WS_DLGFRAME
Private Const WS_EX_APPWINDOW = &H40000
Private Const WS_EX_TOOLWINDOW = &H80
Private Const WS_EX_TRANSPARENT = &H20
Private Const WS_SYSMENU = &H80000
Private Const WS_MINIMIZEBOX = &H20000
Private Const WS_MAXIMIZEBOX = &H10000
Private Const WS_THICKFRAME = &H40000
Private Const WS_EX_LAYERED = &H80000
Private Const LWA_ALPHA = &H2&
Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal CX As Long, ByVal CY As Long, ByVal wFlags As Long) As Long
Private Const SWP_FRAMECHANGED = &H20
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOZORDER = &H4
Global Const WOT_SWP_NOMOVE = 2
Global Const WOT_SWP_NOSIZE = 1
Global Const WOT_FLAGS = WOT_SWP_NOMOVE Or WOT_SWP_NOSIZE
Global Const WOT_HWND_TOPMOST = -1
Global Const WOT_HWND_TOP = 0
Global Const WOT_HWND_NOTOPMOST = -2
'Per regolare la forma XXXX a TOPMOST, usi il seguente codice:
'successo = SetWindowPos(XXXX.hWnd, wot_HWND_TOPMOST, 0, 0, 0, 0,
' _successo < > 0 di rem delle BANDIERINE)
'per ripristinare la forma XXXX a NON-TOPMOST, usi il seguente codice:
'successo = SetWindowPos(XXXX.hWnd, wot_HWND_NOTOPMOST, 0, 0, 0, 0,
' _successo < > 0 di rem delle BANDIERINE)
'Mostro la finestra di windows
Private Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
'Selettori di ShowWindow
Const SW_HIDE = 0
Const SW_SHOW = 5
Sub extwinONTOP(ewinFORM As Form, locONTOP As Integer)
Dim succESS As Long, flags As Long
Dim frmL As Long, frmT As Long, frmW As Long, frmH As Long
frmL = ewinFORM.Left
frmT = ewinFORM.Top
frmW = ewinFORM.Width
frmH = ewinFORM.Height
If locONTOP <> 0 Then
succESS = SetWindowPos(ewinFORM.hWnd, WOT_HWND_TOPMOST, frmL, frmT, 0, 0, WOT_FLAGS)
Else
succESS = SetWindowPos(ewinFORM.hWnd, WOT_HWND_NOTOPMOST, frmL, frmT, 0, 0, WOT_FLAGS)
End If
ewinFORM.Show
End Sub
Private Sub SetWindowStyle(ByVal hWnd As Long, ByVal extended_style As Boolean, ByVal style_value As Long, ByVal new_value As Boolean, ByVal brefresh As Boolean)
Dim style_type As Long
Dim style As Long
If extended_style Then
style_type = GWL_EXSTYLE
Else
style_type = GWL_STYLE
End If
'Stile corrente
style = GetWindowLong(hWnd, style_type)
'Aggiorno o rimnuovo i valori
If new_value Then
style = style Or style_value
Else
style = style And Not style_value
End If
'Nascondo la finestra se apro task-maneger
If brefresh Then
ShowWindow hWnd, SW_HIDE
End If
'Imposto lo stile
SetWindowLong hWnd, style_type, style
'Mostro la finestra se apro task-maneger
If brefresh Then
ShowWindow hWnd, SW_SHOW
End If
'Ridisegno la finestra
SetWindowPos hWnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED Or _
SWP_NOMOVE Or _
SWP_NOSIZE Or _
SWP_NOZORDER
End Sub
Sub extwinTITLEBAR(ewinFORM As Form, ewinVAL As Integer)
SetWindowStyle ewinFORM.hWnd, False, WS_CAPTION, ewinVAL, False
End Sub
Sub extwinTOOLWINDOW(ewinFORM As Form, ewinVAL As Integer)
SetWindowStyle ewinFORM.hWnd, True, WS_EX_TOOLWINDOW, ewinVAL, False
End Sub
Sub extwinTASKBAR(ewinFORM As Form, ewinVAL As Integer)
SetWindowStyle ewinFORM.hWnd, True, WS_EX_APPWINDOW, ewinVAL, True
End Sub
Sub extwinMAXBUTTON(ewinFORM As Form, ewinVAL As Integer)
SetWindowStyle ewinFORM.hWnd, False, WS_MAXIMIZEBOX, ewinVAL, False
End Sub
xo il tuo codice funziona... forse nel mio prg mancava la parte riguardante il sub sul form_resize!