WPFを使ってデスクトップに常駐するアプリを作ろうとしているのですが、WPFで最背面表示をする方法が分かりません。
FormsではDLLImportを使うとできるらしいのですが、WPFではどうすればいいでしょうか?
http://jeanne.wankuma.com/tips/csharp/form/bottommost.html
ここでのDLLのインポートはSystem.Runtime.InteropServicesの[DLLImport]のことです。
WPFではMainWindowをProgram Managerの親ウィンドウにすることはできたのですが、親ウィンドウに設定しても非表示になってしまいます。
C#
[System.Runtime.InteropServices.DllImport("user32.dll", SetLastError = true)] static extern IntPtr FindWindow(string lpClassName, string lpWindowName); [System.Runtime.InteropServices.DllImport("user32.dll")] static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent); public void Desktop() { IntPtr tmpdesktop = FindWindow(null, "Program Manager"); if (tmpdesktop != null) { var wih = new System.Windows.Interop.WindowInteropHelper(this); SetParent(wih.Handle, tmpdesktop); } }
まだ回答がついていません
会員登録して回答してみよう