|
-
Nov 1st, 2000, 03:30 PM
#1
Thread Starter
Hyperactive Member
Ok. When my prog is minimized it sits in the taktray. When a user clicks the icon it restores to vbnormal. Now, I need this window to be seen (As in on top). My problem is, for some reason the forcewindowontop function isn't working?
Code:
Declare Function SetForegroundWindow Lib "user32.dll" (ByVal hwnd As Long) As Long
Why?
-
Nov 1st, 2000, 03:36 PM
#2
To make your Form TopMost use the SetWindowPos API with the HWND_TOPMOST constant, i.e.
Code:
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_TOPMOST = -1
Private Sub Form_Activate()
Call SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)
End Sub
-
Nov 1st, 2000, 03:40 PM
#3
Thread Starter
Hyperactive Member
Tried that one already, also didn't work
-
Nov 1st, 2000, 03:40 PM
#4
It does work, but won't appear to work when run from within the VB IDE environment, compile the EXE and it's fine.
-
Nov 1st, 2000, 03:42 PM
#5
Thread Starter
Hyperactive Member
I know, and have compiled. Still didn't work. Maybe I should say that I am running Win 2000 Server. It worked fine before on 98 and NT!
-
Nov 1st, 2000, 03:54 PM
#6
Thread Starter
Hyperactive Member
Ok now this is weird. If I call both api functions the window comes to the top (even in the IDE) but not if I only call one.
Can anyone explain or should I just blame this on Microsoft?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|