|
-
Aug 4th, 2002, 04:14 PM
#1
Thread Starter
Fanatic Member
Form on top but let the rest go on in the back
Alright this is complicated. I made my own msgbox form cause the standard isn't good enough cause it freezes the whole program. Now I want this form on top so the user can't klik elsewhere in the program, but it must let all the other forms go on. Cause it's a chat program and else the winsock isn't working good cause i check each x seconds if the other users are still online. Any suggestions??
-
Aug 4th, 2002, 04:16 PM
#2
PowerPoster
Try making the msgbox form modal
That will prevent them from clicking elsewhere in the app and it should allow the app to continue working underneath
-
Aug 4th, 2002, 04:36 PM
#3
Thread Starter
Fanatic Member
That just do'n't work, cause the mainform winsock will get the data (in a buffer I think) but only goes on handling them when the modal form is away, so showing modal isn't the good solution
-
Aug 4th, 2002, 04:50 PM
#4
Frenzied Member
Modal form would cause the execution in anyother part of program to stop..
You can use SetWindowPos with SWP_TOPMOST and disable any other window of the program
-
Aug 4th, 2002, 05:18 PM
#5
PowerPoster
I couldn't remember if modal stopped execution or not...apparently it does
Oh well, c'est la vie
-
Aug 4th, 2002, 05:24 PM
#6
-= B u g S l a y e r =-
a sample on how to use SetWindowPos
VB Code:
Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_SHOWWINDOW = &H40
Private Const TOPMOST_FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, y, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Public Sub MakeNormal(Handle As Long)
'Replaces the window in the ZOrder
SetWindowPos Handle, HWND_NOTOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS
End Sub
Public Sub MakeTopMost(Handle As Long)
'Sets the window in the ZOrder
SetWindowPos Handle, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS
End Sub
'usage
Private Sub Form_Load()
MakeTopMost Me.hwnd
End Sub
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
|