Dasiths
Apr 29th, 2001, 09:39 AM
Hi,
I have this code to put a form always on top but I don't know how to get it to work.
_________________________________________________
Private 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_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const HWND_NOTOPMOST = -2
Private Const HWND_TOPMOST = -1
Public Function WinSetFloating(ByVal pHwnd As Long, _
ByVal flOnTop As Boolean) As Boolean
' Sets a window to float or releases it
Dim llngRet As Long
Dim llngMess As Long
If flOnTop = True Then
llngMess = HWND_TOPMOST
Else
llngMess = HWND_NOTOPMOST
End If
llngRet = SetWindowPos(pHwnd, llngMess, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)
If llngRet = 0 Then
Err.Raise APIWinErrors.FLOATING_NOT_SET, "WinSetFloating", _
"Windows has not been set on top."
WinSetFloating = False
Else
WinSetFloating = True
End If
End Function
_______________________________________________
I just copied that code to the code view window.
How can I call that command.
this
________________-
Call WinSetFloating
______________________
won't work.
Please help me..
I have this code to put a form always on top but I don't know how to get it to work.
_________________________________________________
Private 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_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const HWND_NOTOPMOST = -2
Private Const HWND_TOPMOST = -1
Public Function WinSetFloating(ByVal pHwnd As Long, _
ByVal flOnTop As Boolean) As Boolean
' Sets a window to float or releases it
Dim llngRet As Long
Dim llngMess As Long
If flOnTop = True Then
llngMess = HWND_TOPMOST
Else
llngMess = HWND_NOTOPMOST
End If
llngRet = SetWindowPos(pHwnd, llngMess, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)
If llngRet = 0 Then
Err.Raise APIWinErrors.FLOATING_NOT_SET, "WinSetFloating", _
"Windows has not been set on top."
WinSetFloating = False
Else
WinSetFloating = True
End If
End Function
_______________________________________________
I just copied that code to the code view window.
How can I call that command.
this
________________-
Call WinSetFloating
______________________
won't work.
Please help me..