kenshaw
asked on
guaranteeing a form appears at the front of the zorder
here's the scenario:
1. i have a standard exe that contains the main UI
2. i have an ActiveX exe that the standard exe calls sometimes to provide certain functionality
3. the ActiveX exe has a form in it which is displayed when the ActiveX exe is called. this form is used to give the user status information
the problem:
- when my standard exe calls teh ActiveX exe - the form that the ActiveX exe pops up is ALWAYS underneath the standard exe. I obviously need the form that the ActiveX exe displays. how do i do that?
in the ActiveX EXE - when i display the form i use this code:
'putting up form that gives user progress and offers cancel button
frmCancel.Show
frmCancel.ZOrder 0
intNumberOfFilesProcessed = 0
frmCancel.lblStatus = "Recording information about the files you have selected"
1. i have a standard exe that contains the main UI
2. i have an ActiveX exe that the standard exe calls sometimes to provide certain functionality
3. the ActiveX exe has a form in it which is displayed when the ActiveX exe is called. this form is used to give the user status information
the problem:
- when my standard exe calls teh ActiveX exe - the form that the ActiveX exe pops up is ALWAYS underneath the standard exe. I obviously need the form that the ActiveX exe displays. how do i do that?
in the ActiveX EXE - when i display the form i use this code:
'putting up form that gives user progress and offers cancel button
frmCancel.Show
frmCancel.ZOrder 0
intNumberOfFilesProcessed = 0
frmCancel.lblStatus = "Recording information about the files you have selected"
Your code should work (at least it does for me). Could you show us some more of it? Including call from standard exe
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Why not just provide a method in the ActiveX EXE to retrieve the information? Then you can use that information to display your own form.
ASKER
hmm... your code gives me an error on the Me.SetFocus call
says its an invlid call
says its an invlid call
ASKER
the code in teh ActiveX EXE is called by 5 or 6 different parts of our main app. we want all the code related to the tasks - including the GUI code in the ActiveX EXE.
There is only one way that I know of for a window to force its way to the front of other windows:
"Force another window to the foreground, when SetForegroundWindow doesn't work, by attaching to its thread."
http://www.classicvb.net/samples/project.asp?id=forcefore
"Force another window to the foreground, when SetForegroundWindow doesn't work, by attaching to its thread."
http://www.classicvb.net/samples/project.asp?id=forcefore
It also depends from where do you call ActiveX Exe; e.g. if it is from MouseUp event in your main exe, it is possible that ActiveX form shows, but after that focus is returned to the original form/control in main app. To check, set a breakpoint or msgbox immediately after frmCancel.Show line.
In ActiveX application you must be invoking the form from some function use vbModal like this
Sub SomeFunction()
Call Form1.Show(vbModal)
End Sub
In your application you can call it.
Sub SomeFunction()
Call Form1.Show(vbModal)
End Sub
In your application you can call it.