|
-
Jan 30th, 2001, 08:58 PM
#1
Thread Starter
Hyperactive Member
Hey,
Is there a way to show a modeless form from an ActiveX dll that stays on top of the main application's form?
I can't pass the main form as a parameter to the wrapper class for displaying the form. And, If I try to pass the form as an object and then use this object to be the parent of the form I'm trying to display, I get an error saying that this object cannot be the parent of the form I'm trying to load...
any ideas?
-scott
he he he
-
Jan 31st, 2001, 07:27 AM
#2
Fanatic Member
You could try using the 'SetWindowPos' API call to force the window to stay on top.
-
Jan 31st, 2001, 01:55 PM
#3
Thread Starter
Hyperactive Member
this works but not for me
Thanks,
That was a good idea. I tried this with two forms in the same project and it worked great. Unfortunately, when showing this form from the dll I no longer get a form Deactivate event!?
So, this is what I did, but it's not working from the dll.
Code:
Private Sub Form_Deactivate()
' Force this form to the top of the window list
' Emulates modeless form operation with main app's form as parent
Debug.Print "frmPartSetup Deactivated"
SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE Or SWP_NOACTIVATE
End Sub
Any more ideas?
-scott
he he he
-
Jan 31st, 2001, 04:00 PM
#4
Frenzied Member
I'm looking for a way to display a form from a DLL and make it vbModal of the main form that it was called from, but i haven't been able to figure it out either.
~Peter

-
Jan 31st, 2001, 09:58 PM
#5
Thread Starter
Hyperactive Member
this one works
I had this working...
If you show the form modally, it should automatically be modal to the main application because the dll is in the same process as the calling form.
That's how I had my app running, but I now need to show the form while allowing the user to access the underlying form as well.
-scott
he he he
-
Feb 1st, 2001, 03:48 AM
#6
Fanatic Member
Tell me,
Why did you put the API call in the form_deactivate event?
It seems like you are using it to 'Rescue' your form when it gets deactivated but why not call immediately after the form.Show method?
-
Feb 1st, 2001, 01:55 PM
#7
Thread Starter
Hyperactive Member
trying to do something different
Well,
I was passing a class into the form at startup, so I made a Display method to receive the class and show the form. It didn't work to call the SetWindowPos in this method, so I tried other things, albeit some squirrelly things.
Anyway, to make a long story short, I simplified the way I displayed the form and everything works.
Thanks for the help,
-scott
he he he
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
|