ShowDialog behaviour for my application from another application

A

asadikhan

Hi,

I have written a windows application with a GUI (let's call it MENU).
I own the code for this application and have access to it.

We have another application that is a third-part windows application
with a GUI interface as well (let's call it BASE). I don't have access
to the code of this application. This application has hooks through
which other applications can be called. I have defined a hook in this
application which bring up my first menu application.

The behaviour I am after is sort of like the "showdialog" behaviour,
where if my menu application is brought up, then the user can not
switch back to the base application without first closing or hitting
the OK button (which essentially will close my menu application) on my
menu application.

The user should still be able to switch to other open applications
without a problem. So in a way I am trying to immitate the feeling of
my menu application being a child window of the parent application -
though the only real behaviour I'm after is that the user should not
be able to switch to the parent application without closing my menu
application first.

Any ideas how I can achieve this, NOT having access to the code of
parent base application.

Asad
 
C

Chris Dunaway

Hi,

I have written a windows application with a GUI (let's call it MENU).
I own the code for this application and have access to it.

We have another application that is a third-part windows application
with a GUI interface as well (let's call it BASE). I don't have access
to the code of this application. This application has hooks through
which other applications can be called. I have defined a hook in this
application which bring up my first menu application.

The behaviour I am after is sort of like the "showdialog" behaviour,
where if my menu application is brought up, then the user can not
switch back to the base application without first closing or hitting
the OK button (which essentially will close my menu application) on my
menu application.

The user should still be able to switch to other open applications
without a problem. So in a way I am trying to immitate the feeling of
my menu application being a child window of the parent application -
though the only real behaviour I'm after is that the user should not
be able to switch to the parent application without closing my menu
application first.

Any ideas how I can achieve this, NOT having access to the code of
parent base application.

Asad

Does the parent application provide you with its form handle or any
other information? You could try using the FindWindow and SetParent
API's to set the BASE application window as the parent of your
application window.

Just a thought
 
A

asadikhan

Does the parent application provide you with its form handle or any
other information? You could try using the FindWindow and SetParent
API's to set the BASE application window as the parent of your
application window.

Just a thought

Yeah, I got that to work, but I am unable to get a showdialog kind of
behaviour. I used findwindow and setparent, so now the child
application is contained within the boundaries of the parent
application, and gets closed when the parent application closes.
However, I cant figure out how to make the child app window stay on
top as showdialog. Any ideas?

Asad
 
C

Chris Dunaway

Yeah, I got that to work, but I am unable to get a showdialog kind of
behaviour. I used findwindow and setparent, so now the child
application is contained within the boundaries of the parent
application, and gets closed when the parent application closes.
However, I cant figure out how to make the child app window stay on
top as showdialog. Any ideas?

You could try using SetWindowLong and SetWindowPos API. Go to
pinvoke.net and look up these functions and see if it might help. You
might try looking up the WS_POPUP style and see if that will help as
well.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top