|
-
Apr 18th, 2000, 04:36 AM
#1
Hi,
I am invoking a VB form from a word application.The form that comes up is always behind the word application.
I have tried setting the zorder to the front.It still does not work.Zorder i guess works in an MDI forms.
I have also tried to bring the form up Modally.It still appears behind the word application.
Can anyone give me the name of the API to make a form always stay on top.
Thanks in advance,
Desi
-
Apr 18th, 2000, 04:53 AM
#2
Addicted Member
Desi,
Try...
Declare:
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 conHwndTopmost = -1
Global Const conHwndNoTopmost = -2
Global Const conSwpNoActivate = &H10
Global Const conSwpShowWindow = &H40
Code:
'(Place a Check Box on the form name it to "chkStayOnTop")
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Sub chkStayOnTop_Click()
'Make sure you define your form properties after the conHwndTopmost statement
'200,200 = top and left corner ... 319,262 = window width, window height
'Use this formula to determine the window width, window height:
'(200,200)-(519,462)<--Bottom,right corner | window width,height-->319,262
'Or just use the proggie Spy++
Select Case chkStayOnTop.Value
Case 0
chkStayOnTop.Value = 0
SetWindowPos hwnd, conHwndNoTopmost, 200, 200, 319, 262, conSwpNoActivate Or conSwpShowWindow
Case 1
chkStayOnTop.Value = 1
SetWindowPos hwnd, conHwndTopmost, 200, 200, 319, 262, conSwpNoActivate Or conSwpShowWindow
End Select
End Sub
Hope this helps!
Daniel Christie
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
|