Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ActiveX exe vbModal form

Posted on 2002-04-17
17
Medium Priority
?
474 Views
Last Modified: 2007-12-19
I have two ActiveX.exe programs (ActiveX1 and ActiveX2).  ActiveX1 loads a form.  This form has a button that calls a method in ActiveX2 to show a form in that exe.  The problem I have is when ActiveX1 is minimized, and then maximized, sometimes the form in ActiveX2 is behind ActiveX1.

How can I stop this from happening?

Thank you.
0
Comment
Question by:afpcos
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
  • 3
  • +2
17 Comments
 

Expert Comment

by:RAJz
ID: 6948621
I didn't uynderstand ur ques.

did u give the reference of these EXE in ur Project?
0
 
LVL 4

Expert Comment

by:RichW
ID: 6948668
I know what you're saying, but I think it's working the way it should.

You want the second ActiveX EXE to act like it's a child of the first one, but when you minimize/maximize, the first form (parent) is in front of the child?

This is like having a VB form open a Word Doc object.  If you minimize the VB form, then maximize, the VB form would be on top.  This is Windows!

Even if you launched the ActiveX EXE from a standard VB project this would be the case.

You can use an API to keep the second form always on top.

Or you could not allow for 1 to be minimized.

I'm not sure what you're trying to do.  Could you explain a little better?

Thanks

0
 
LVL 5

Expert Comment

by:rkot2000
ID: 6948694

you can send an AppActivate statement from your first exe
like
first application
Form_active event
AppActive "Form's title in the second exe"


or you can use SetWindowPos API to keep your second window on top.






0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 5

Expert Comment

by:rkot2000
ID: 6948702
or you can use a timer in your second app to active form2 every xx seconds.
0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 900 total points
ID: 6948845
use the owner parameter of the Show method (the second parameter). pass the instance of your current form to the second activex and use it as the owner.

ActiveX1

call AX2Instance.ShowForm(me)



ActiveX2

Public Sub ShowForm(byref pForm as Object)
   form1.show ,pForm
End Sub
0
 
LVL 2

Author Comment

by:afpcos
ID: 6948944
The activate event does not occur when the window is minimized or maximized.

Even if you do not allow a form to be minimized, the user can click on "Show Desktop" button in windows and the window will minimize.

I need the form in the second ActiveX exe to show like a pop up for to the first ActiveX exe.

I can not set the for to always stay on top because it stays on top of other forms in the application.
0
 
LVL 2

Author Comment

by:afpcos
ID: 6950560
emoreau,

When I try to do this, i get the following error.
Run-time error '371': The specified object can't be used as an owner form for Show()
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6950579
are you sure that you are passing a reference to a visible form? Do you have something when you do

msgbox pform.caption
0
 
LVL 2

Author Comment

by:afpcos
ID: 6950698
Yes the form is visible.  The msgbox displays the correct caption of the form in the first activex exe.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6950721
do you have a form in a standard EXE somewhere ?
0
 
LVL 5

Expert Comment

by:rkot2000
ID: 6950760
You may need to subclass your first form to send messages to the second form.

Or in the second form you can use timer to :
Locate first form
Get  state
Based on results : Move/Hide/Show the second form
0
 
LVL 2

Author Comment

by:afpcos
ID: 6950776
emoreau,

I do not understand your questions.  The two projects in question are ActiveX exe programs.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6950789
can't you transform one as a STANDARD EXE?

when you start a new vb project, you have many templates. one of them is the standard exe and should be use for regular application.
0
 
LVL 2

Author Comment

by:afpcos
ID: 6951205
emoreau,

I do not want them to be standard exes.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6951228
it seems that the form in your ActiveX 1 does not have a regular handle so it can't be used as an owner.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6985022
any progress?
0
 
LVL 2

Author Comment

by:afpcos
ID: 6985805
Each parent form has to have the min button enabled for the min and max events to fire when you click on the Windows "Show Desktop" button.  I had to set up a series of events between the two forms so they let eachother know when it was resizing to tell the other form to resize.

I also had to disable all controls on the parent form when it launched the child form so that if the user clicked back on the parent form while the child form was up, the Form_OnFocus event would fire so I could send focus back to the child window.

It is very ugly, but it works.  I could not figure anything else out.

Thanks
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question