|
-
Nov 21st, 2000, 02:38 PM
#1
Thread Starter
New Member
Could show me a good example for making a second form
show all the time when turned on (similar to the
Toolbox in VB). I already have a form designed that
would server as the "Parent Form" and it is not an MDI form (It took 6 months to code correctly, so I really do not want to make any changes to this form).
Can this be done?
If not how do I turn a form into a MDI child form?
Thanks
-
Nov 21st, 2000, 02:56 PM
#2
Fanatic Member
Well what you could do is place an MDI form into your project and set your form as the child. Or if you want to use your existing form you can use the this code to have another form be sort of like the toolbox in VB...it will be on top or everything.
Code:
Private Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos"_
(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
Const SWP_NOMOVE = 2
Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Const SWP_NOSIZE = 1
Const HWND_NOTOPMOST = -2
Const HWND_TOPMOST = -1
Private Sub Form_Load()
SetWindowPos Me.hWnd, HWND_TOPMOST,0, 0, 0, 0, FLAGS
End Sub
You might want to change the starting location if you are going to use this code.
Gl,
D!m
-
Nov 21st, 2000, 03:26 PM
#3
Huh? That only makes the Form the Topmost.
Add this to Form1.
Code:
Private Sub Form_Load()
Form2.Show
End Sub
Private Sub Form_Unload(Cancel As Integer)
Form2.Tag = ""
Unload Form2
End Sub
Add this to Form2.
Code:
Private Sub Form_Load()
Me.Tag = "BLOCK"
End Sub
Private Sub Form_Unload(Cancel As Integer)
If Form2.Tag = "BLOCK" Then Cancel = True
End Sub
-
Nov 21st, 2000, 04:50 PM
#4
Thread Starter
New Member
Showing 2 Forms
Thanks for replying, both of you.
Dimitri, as to making my main form a child on the first
I tried this it had catastrophic effects (on a copy of course) so thats out.
As to the API stuff, when I load the second form
I cant touch my main form, and if I set Mdichild to true
for form2, I get an error cant show modal form
with non modal form showing (or something to that extent)
error.
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
|