-
Finally got some code, that should work for VB3, on keeping my program on top.....however i get a duplicate procedure in setwindowpos....tell me if you can notice why.
In the (general)(declarations) section, put
Declare Function SetWindowPos Lib "user" (ByVal hWnd as Integer, ByVal hWndInsertAfter as Integer, ByVal X as Integer, ByVal Y as Integer, ByVal cx as Integer, ByVal cy as Integer, ByVal wFlags as Integer)
Const SWP_NOACTIVATE = &H10
Const SWP_SHOWWINDOW = &H40
Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2
On form load
SetWindowPos me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW
-
'I use this in vbs looks similar
'perhaps you can spot a difference
'that might help you out
'to make form stay topmost
'put this in a bas module
'
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
Global Const SWP_NOMOVE = 2
Global Const SWP_NOSIZE = 1
Global Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Global Const HWND_TOPMOST = -1
Global Const HWND_NOTOPMOST = -2
Public res&
'=============================================
'
'put this in events click or load or whatever
'or hardcopy
'To set Form1 as a TopMost form, do the following:
res& = SetWindowPos (Form1.hWnd, HWND_TOPMOST, _
0, 0, 0, 0, FLAGS)
'if res&=0, there is an error
'To turn off topmost (make the form act normal again):
res& = SetWindowPos (Form1.hWnd, HWND_NOTOPMOST, _
0, 0, 0, 0, FLAGS)
-
nope
Can't use the res function because can't use the public command....so when i try to do res = setwindowspos i get a illegal dll error