I have a win32 application (written in Delphi), that calls some WPF windows. These WPF windows calls other windows in win32 Delphi projects (to reuse some code). When I do this, it hides (send to background) the WPF windows.
These win32 windows are in COM dlls.
There is a way to avoid this behavior?
I need something like this:
+--------------------------------------------------
| win32
|
|
|
| +-------------------------------------+
| | wpf |
| | |
| | |
| | |
| | +--------------------+ |
| | | win32 | |
| +--| |-------------+
| | |
| +--------------------+
|
|
but I get:
+--------------------------------------------------
| win32
|
|
|
|
|
|
|
|
| +--------------------+
| | win32 |
| | |
| | |
| +--------------------+
|
|
In delphi main project I have used "CreateOleObject" to get access to wpf code. In WPF, the windows is opened using "ShowDialog()" command. Again, in WPF I call delphi, using interop references to my win32 dlls.
Ok, the code used is bellow:
Delphi main application:
var dll : OleVariant;
begin
dll := CreateOleObject("MyDllinCSharp.ClassName");
dll.DoSomething(...);
at this point, wpf windows comes to front:
wpf code:
var form = new MyForm();
form.ShowDialog();
In xaml, nothing important, only a basic window:
<Window x:Class="MyForm"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Reverter" Height="432" Width="500" WindowStartupLocation="CenterScreen">
now in c#, I will call a delphi DLL, after I reference the COM dll in c# project:
var dll = Delphi.CreateInstance("delphidll", "Interfacename") as IMyProcess;
dll.DoSomethingInDelphi(....);
I got this to work, hosting the Win32 window inside WPF element, like this walkthrough:
http://msdn.microsoft.com/en-us/library/ms752055.aspx
Now I havesomething like this:
+--------------------------------------------------
| win32
|
|
|
| +-------------------------------------+
| | wpf |
| | |
| | |
| | -wpf------------------ |
| | |+--------------------+| |
| | || win32 || |
| +-|| ||------------+
| || ||
| |+--------------------+|
| ----------------------
|
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.