public RemoteControl() { // Cannot set ShowInTaskbar = false, or WndProc will not be handled // correctly (maybe because we use HWND_BROADCAST). ShowActivated = false; Width = Height = 0; WindowState = WindowState.Minimized; WindowStyle = WindowStyle.None; SourceInitialized += (o, e) => (PresentationSource.FromVisual(this) as HwndSource).AddHook(WndProc); // Allow these messages to reach us even from a process with a // lower integrity level. This may happen when WinCompose was // launched at high level (e.g. through the installer) but // wincompose-settings.exe is launched at medium level (through // the start menu). The security risk seems very low since all // we do is open an existing window. // Note: this function does not exist on Windows XP if (NativeMethods.EXISTS("user32", "ChangeWindowMessageFilter")) { NativeMethods.ChangeWindowMessageFilter(WM_WINCOMPOSE.OPEN, MSGFLT.ADD); } Show(); Hide(); }