![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Oct 2005
Posts: 3
Rep Power: 0
![]() |
How to to do this using Win32 API?
Hi,
I have a third party application (Application A) and I have my C# WinForm Application. In my WinForm application, I have a popup window that is shown when user clicks a button. Now, the trickest part is, I need to show the popup window as a modal window in Application A's main window. I tried SetParent API and then used EnableWindow to disable Application A's main window. SetParent was able to show my popup window into the Application A' main window but the problem I found here is I lose mouse activity on my popup window. Keyboard tabbing works fine and if I do Alt-Tab, the popup window is completely inaccessible (disabled) with no activity. Next, I tried AttachThreadInput and calling SetForeGroundWindow, but nothing works. Although AttachThreadInput returns true for me, I couldn't see any change in behavior. So, in summary, how do I make my popup window from my app show up as a child window and also a modal window inside Application A' main window? I'm posting this in C++ section also thinking that hardcore C++ developers might be able to help me. Appreciate feedbacks. Rgds. |
|
|
|
|
|
#2 |
|
Highly Adaptive Penguin
Join Date: May 2005
Location: United States
Posts: 252
Rep Power: 4
![]() |
you'll get more help if you post this in the C# forum.
|
|
|
|
|
|
#3 | |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,260
Rep Power: 5
![]() |
You might want to have a look at this extract that I just found in the WIN32 API Help file after a quick search on modal dialog boxes. There are a few things in this extract relevant to ensuring you don't lose mouse input.
Quote:
|
|
|
|
|
|
|
#4 |
|
Newbie
Join Date: Oct 2005
Posts: 3
Rep Power: 0
![]() |
This suggestion is great as long as I call dialogbox API myself. But, what I need is to make a window from Application 2 (process 2) as modal to Application A (process 1) from C#. I think the language that it is coded doesn't matter. Also, please note that I don't have the source to Application A since it is a third party application. I only have source code to Application B since it is ours.
Anybody? |
|
|
|
|
|
#5 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,260
Rep Power: 5
![]() |
In general, there is no solution unless you know how Application A is doing things.
most things involving windows (dialogs, etc) rely on windows messages, and the processing of those is in control of the application that (in your case) launches the dialog. If that application happens to ignore messages of a particular type, there is nothing you can do to make the modal dialog respond to them (short of hacking the executable. You might be able to do something involving SetFocus(), and then sending keystrokes or mouse events to the window when it is in focus. But, as all these methods work by sending windows messages, which can be ignored .... Your best bet would be to contact the author of the program and request advice on a method to achieve what you want. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|