.net - How can I keep window backmost in WPF? -
i have small .net program produces fullscreen window. keep window backmost window (i.e. other windows should open on top of it, , should not come front when clicked on). there practical way under windows presentation foundation?
as far know, you'll have p/invoke right. call setwindowpos
function, specifying handle window , hwnd_bottom
flag.
this move window bottom of z order, , prevent obscuring other windows.
sample code:
private const swp_nosize integer = &h1 private const swp_nomove integer = &h2 private const swp_noactivate integer = &h10 <dllimport("user32.dll", charset:=charset.auto)> _ private shared function setwindowpos(hwnd intptr, hwndinsertafter intptr, x integer, y integer, cx integer, cy integer, uflags integer) boolean end function public sub setasbottommost(byval wnd window) ' handle specified window dim hwnd intptr = new windowinterophelper(wnd).handle ' set window position hwnd_bottom setwindowpos(hwnd, new intptr(1), 0, 0, 0, 0, swp_nosize or swp_nomove or swp_noactivate) end sub
Comments
Post a Comment