This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.InteropServices; | |
namespace ConsoleApp18 | |
{ | |
public class Program | |
{ | |
static void Main() | |
{ | |
GetUserColorPreference(out var pref, false); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.ui.composition.interop.h> | |
#include <ShellScalingAPI.h> | |
#include <DispatcherQueue.h> | |
#include <winrt/Windows.System.h> | |
#include <winrt/Windows.UI.Composition.Desktop.h> | |
extern "C" IMAGE_DOS_HEADER __ImageBase; | |
using namespace winrt; | |
using namespace Windows::UI; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Source = @" | |
using System; | |
using System.Runtime.InteropServices; | |
namespace wuapi | |
{ | |
[ComImport, Guid("ef8208ea-2304-492d-9109-23813b0958e1"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] | |
public interface IUpdateInstaller4 | |
{ | |
void _VtblGap0_29(); // skip 4 (IDispatch) + 25 IUpdateInstaller4 methods |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
#include <strsafe.h> | |
#include <atlbase.h> | |
#include <mfapi.h> | |
#include <stdio.h> | |
#pragma comment(lib, "advapi32") | |
#pragma comment(lib, "mfreadwrite") | |
#pragma comment(lib, "mfplat") | |
#pragma comment(lib, "mfuuid") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private async Task OpenCapturePicker() | |
{ | |
var picker = new GraphicsCapturePicker(); | |
var handle = new WindowInteropHelper(this).Handle; | |
var interop = (IInitializeWithWindow)(object)picker; | |
interop.Initialize(handle); | |
await picker.PickSingleItemAsync(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.InteropServices; | |
using UIAutomationClient; // add a COM reference to Windows\System32\UIAutomationCore.dll, and set "Embed Interop Types" to false on this reference's properties | |
namespace ConsoleApp | |
{ | |
internal class Program | |
{ | |
private static readonly CUIAutomation8 _ui = new CUIAutomation8(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"> | |
<assemblyIdentity version="1.0.0.0" name="MyAtlFile" type="win32" /> | |
<file name="MyAtlFile.dll"> | |
<comClass | |
description="Simple Object" | |
clsid="{a377453e-a407-4533-9c2f-537164c6882e}" | |
threadingModel="Apartment" | |
tlbid="{3f4efe00-9913-4fd9-9576-e1c8fc14c724}" /> | |
<typelib |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.ComponentModel; | |
using System.Runtime.InteropServices; | |
using System.Text; | |
namespace ConsoleApp2 | |
{ | |
internal class Program | |
{ | |
// code must be ran as admin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _AFXDLL | |
#include <WinSock2.h> // MFC... | |
#include <windows.h> | |
#include <afxwin.h> // CBitmap | |
#include <atlbase.h> | |
#include <atlcom.h> // CComPtr | |
#include <d2d1.h> | |
#include <d2d1_3.h> // ID2D1DeviceContext5 | |
#include <wincodec.h> // Wic |