Programmatically Launching Windows 10 Emoji Hotkeys Programmatically Launching Windows 10 Emoji Hotkeys wpf wpf

Programmatically Launching Windows 10 Emoji Hotkeys


Open Emoji panel in a Windows Forms or WPF application

You need to handle the desired event, then first Focus to your control, then using CoreInputView.GetForCurrentView get the core input view for the current window, and then call its TryShow method and pass CoreInputViewKind.Emoji to the method. For example:

//using Windows.UI.ViewManagement.Core;private async void button1_Click(object sender, EventArgs e){    textBox1.Focus();    CoreInputView.GetForCurrentView().TryShow(CoreInputViewKind.Emoji);}

Note: For Windows Forms or WPF project, before using above code, youneed to configure your project to be able to call Windows RuntimeAPIs in desktopapps.

Call Windows Runtime APIs in Windows Forms or WPF

.NET 5

  1. Solution Explorer → Right click on your project → Choose Edit Project File.

  2. Change the value of TargetFramework to one of the following strings and save changes.

    • net5.0-windows10.0.17763.0: for targeting Windows 10, version 1809.
    • net5.0-windows10.0.18362.0: for targeting Windows 10, version 1903.
    • net5.0-windows10.0.19041.0: for targeting Windows 10, version 2004.

    For example:

    <Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">  <PropertyGroup>    <OutputType>WinExe</OutputType>    <TargetFramework>net5.0-windows10.0.18362.0</TargetFramework>    <UseWindowsForms>true</UseWindowsForms>  </PropertyGroup></Project>

.NET 4.X

  1. Tools → NuGet Package Manager → Package Manager Settings →Make sure PackageReference is selected for Default package management format.

  2. Solution Explorer → Right click on your project → choose Manage NuGet Packages.

  3. Find Microsoft.Windows.SDK.Contracts package. In the right pane of the NuGet Package Manager window select the desired version of the package based on the version of Windows 10 you want to target and click install:

    • 10.0.19041.xxxx: for targeting Windows 10, version 2004.
    • 10.0.18362.xxxx: for targeting Windows 10, version 1903.
    • 10.0.17763.xxxx: for targeting Windows 10, version 1809.
    • 10.0.17134.xxxx: for targeting Windows 10, version 1803.


Since I couldn't get these more elegant solutions to work, I resorted to keyboard calls. This works just fine for my needs, so I thought I'd share.

 Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As IntPtr, ByVal bScan As IntPtr, ByVal dwFlags As IntPtr, ByVal dwExtraInfo As IntPtr) Private Sub EmojiLaunch_Click(sender As Object, e As EventArgs) Handles EmojiLaunch.Click    Call keybd_event(&H5B, 0, &H0, 0) 'Windows Key Down    Call keybd_event(&HBE, 0, &H0, 0) 'Period Key Down    Call keybd_event(&HBE, 0, &H2, 0) 'Period Key Up    Call keybd_event(&H5B, 0, &H2, 0) 'Windows Key Up End Sub

EmojiLaunch is a Label, you don't want to use a button since it changes the focus.