我希望我的窗口只能在我的应用程序中的所有其他窗口之上.如果我设置窗口的TopMost属性,它将变为所有应用程序的所有窗口之上,我不希望这样.
即使其他应用程序在Fullscreen上运行,是否可以使窗口始终保持在顶部?我正在使用TopMost = true,但当其他应用程序在全屏运行时,我的隐形.WindowStyle = None顺便说一句,这是窗口.
编辑:不要让其他窗口最小化
我正在开发基于OptiTrack SDK(来自NaturalPoint)的应用程序.我需要将应用程序窗口作为"Always on Top"运行.该窗口是在XAML中设计的,并在"CameraView"类中进行控制,但它似乎不包含"TopMost"属性或等效属性.附件是"CameraView.xaml.cs"的代码和"CameraView.xaml"的代码,它们是OptiTrack SDK(NaturalPoint)的一部分,称为"Single_Camera_CSharp_.NET_3.0".
人们可以期望CameraView类包含属性或成员来设置窗口在屏幕上的位置或将其设置为TopMost但是在搜索时我什么都没发现.我不知道该怎么做.
谢谢你,Brian
================
using System;
using System.IO;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Navigation;
using System.Drawing.Imaging;
using System.Drawing.Drawing2D;
using System.Windows.Threading;
namespace TestProject
{
public partial class CameraView
{
private const int NP_OPTION_OBJECT_COLOR_OPTION = 3;
private const int NP_OPTION_VIDEO_TYPE = 48;
private const int NP_OPTION_NUMERIC_DISPLAY_ON = 71;
private const int NP_OPTION_NUMERIC_DISPLAY_OFF = 72;
private const int NP_OPTION_FETCH_RLE = 73;
private const int NP_OPTION_FETCH_GRAYSCALE = 74;
private const int …Run Code Online (Sandbox Code Playgroud) 我想列出一个进程的所有窗口,比如 Word。这只给了我主窗口:
Get-Process winword |where {$_.mainWindowTItle} |format-table id,name,mainwindowtitle –AutoSize
Run Code Online (Sandbox Code Playgroud)
我还想在这里列出 Document1。
ID 名称 MainWindowTitle
1616 WINWORD Document2 - Microsoft Word
除了主窗口,还有其他方法可以访问窗口吗?
我想在我的 WPF 应用程序中托管一个外部进程的窗口。我是这样推导的HwndHost:
class HwndHostEx : HwndHost
{
[DllImport("user32.dll")]
static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
private IntPtr ChildHandle = IntPtr.Zero;
public HwndHostEx(IntPtr handle)
{
this.ChildHandle = handle;
}
protected override System.Runtime.InteropServices.HandleRef BuildWindowCore(System.Runtime.InteropServices.HandleRef hwndParent)
{
HandleRef href = new HandleRef();
if (ChildHandle != IntPtr.Zero)
{
SetParent(this.ChildHandle, hwndParent.Handle);
href = new HandleRef(this, this.ChildHandle);
}
return href;
}
protected override void DestroyWindowCore(System.Runtime.InteropServices.HandleRef hwnd)
{
}
}
Run Code Online (Sandbox Code Playgroud)
并像这样使用它:
HwndHostEx host = new HwndHostEx(handle);
this.PART_Host.Child = host;
Run Code Online (Sandbox Code Playgroud)
handle我想托管的外部窗口的句柄在哪里,是PART_Host我的 WPF …