Skip to content

Instantly share code, notes, and snippets.

@itsho
itsho / Force 100 DPI Scale.ps1
Created December 20, 2018 09:41
Force 100% DPI Scaling for all screens even if the default value is different
# =========================================================================================================
# if you like to reset your DPI Scaling to the DEFAULT, you can use the registry (Option five) from here:
# https://www.tenforums.com/tutorials/5990-change-dpi-scaling-level-displays-windows-10-a.html#option5
#
# But, since the default value is different on various monitors, if you like to force 100%,
# you need the following trick:
# for each monitor - set DPIValue to 0xFFFFFFFF (which is -1 in DWord)
#
# Last update: 18 December 2018
# Created by: Itsho
@itsho
itsho / HwndHostEx.cs
Last active January 23, 2024 17:13
Hosting an app inside a WPF app (System.Windows.Interop)
using System;
using System.Runtime.InteropServices;
using System.Windows.Interop;
namespace HostingAppTest
{
// based on https://stackoverflow.com/q/30186930/426315
public class HwndHostEx : HwndHost
{
private readonly IntPtr _childHandle;