Solved

ActiveX exe vbModal form

Posted on 2002-04-17
17
456 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
  • 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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 300 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

809 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