By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,841 Members | 1,761 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,841 IT Pros & Developers. It's quick & easy.

Always on Top MakeTopMost

P: n/a
I found this function (MakeTopMost) over the weekend and it worked
great under XP and Access97 but does not work for more than 30 seconds
here at work under WIN2000 and Access 2000. Any help would be
appreciated:

Public 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
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOSIZE = &H1

Public Function MakeTopMost(iPos As Boolean, lHWnd As Long) As Boolean

'call MakeTopMost(-1,Application.hWndAccessApp)
'call MakeTopMost(0,Application.hWndAccessApp)
Dim lWinPos As Long
Dim l As Long

Select Case iPos
Case False:
lWinPos = HWND_NOTOPMOST
Case True:
lWinPos = HWND_TOPMOST
Case Else
Exit Function
End Select

If SetWindowPos(lHWnd, lWinPos, 0, 0, 0, 0, SWP_NOMOVE _
+ SWP_NOSIZE) Then
MakeTopMost = True
End If
End Function
Nov 13 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.