質問編集履歴

2

実際のコードを記載

2022/05/21 09:18

投稿

Poriet_Gadget
Poriet_Gadget

スコア15

test CHANGED
File without changes
test CHANGED
@@ -2,4 +2,21 @@
2
2
  FormsではDLLImportを使うとできるらしいのですが、WPFではどうすればいいでしょうか?
3
3
  http://jeanne.wankuma.com/tips/csharp/form/bottommost.html
4
4
  ここでのDLLのインポートはSystem.Runtime.InteropServicesの[DLLImport]のことです。
5
- WPFではMainWindowをProgram Managerの親ウィンドウにする方法分からずっています
5
+ WPFではMainWindowをProgram Managerの親ウィンドウにすることはできたのです、親ウィンドウ設定しても非表示になってしまいます
6
+ ```C#
7
+ [System.Runtime.InteropServices.DllImport("user32.dll", SetLastError = true)]
8
+ static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
9
+ [System.Runtime.InteropServices.DllImport("user32.dll")]
10
+ static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
11
+
12
+ public void Desktop()
13
+ {
14
+ IntPtr tmpdesktop = FindWindow(null, "Program Manager");
15
+ if (tmpdesktop != null)
16
+ {
17
+ var wih = new System.Windows.Interop.WindowInteropHelper(this);
18
+ SetParent(wih.Handle, tmpdesktop);
19
+ }
20
+ }
21
+
22
+ ```

1

DLLImportの中身を明記

2022/05/21 08:57

投稿

Poriet_Gadget
Poriet_Gadget

スコア15

test CHANGED
File without changes
test CHANGED
@@ -1,2 +1,5 @@
1
1
  WPFを使ってデスクトップに常駐するアプリを作ろうとしているのですが、WPFで最背面表示をする方法が分かりません。
2
2
  FormsではDLLImportを使うとできるらしいのですが、WPFではどうすればいいでしょうか?
3
+ http://jeanne.wankuma.com/tips/csharp/form/bottommost.html
4
+ ここでのDLLのインポートはSystem.Runtime.InteropServicesの[DLLImport]のことです。
5
+ WPFではMainWindowをProgram Managerの親ウィンドウにする方法が分からずに困っています、