Last active
August 29, 2015 13:57
-
-
Save cyriltovena/9758305 to your computer and use it in GitHub Desktop.
Blog Disable Charmbar
This file contains 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 "stdafx.h" | |
#include "DisableCharmBar.h" | |
bool DisableCharmbar(HWND hWnd) | |
{ | |
PROPVARIANT var; | |
var.vt = VT_BOOL; | |
var.boolVal = VARIANT_TRUE; | |
// Get window properties | |
IPropertyStore* pPropStore; | |
IID_PPV_ARGS(&pPropStore); | |
HRESULT hrReturnValue = SHGetPropertyStoreForWindow(hWnd, IID_PPV_ARGS(&pPropStore)); | |
// set PKEY_EdgeGesture_DisableTouchWhenFullscreen property | |
if (SUCCEEDED(hrReturnValue)) | |
{ | |
hrReturnValue = pPropStore->SetValue(PKEY_EdgeGesture_DisableTouchWhenFullscreen, var); | |
pPropStore->Release(); | |
} | |
return TRUE; | |
} |
This file contains 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
#pragma once | |
#pragma comment(lib, "User32.lib") | |
#pragma comment(lib, "oleaut32.lib") | |
#pragma comment(lib, "ole32.lib") | |
#pragma comment(lib, "shell32.lib") | |
#include <shlobj.h> | |
#include <assert.h> | |
#include <windows.h> | |
#include <iostream> | |
#include <propsys.h> | |
#include <propkey.h> | |
extern "C" __declspec(dllexport) bool DisableCharmbar(HWND hWnd); |
This file contains 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
<Window x:Class="MyWPFApplication.MainWindow" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
Title="MainWindow" Height="350" Width="525" WindowStyle="None" WindowState="Maximized"> | |
<Grid> | |
<TextBlock Text="Hello World !" FontSize="22" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> | |
</Grid> | |
</Window> |
This file contains 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 System.Windows; | |
using System.Windows.Interop; | |
namespace MyWPFApplication | |
{ | |
public partial class MainWindow : Window | |
{ | |
[DllImport("DisableCharmbar.dll", EntryPoint = "DisableCharmbar" | |
, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] | |
static extern bool DisableCharmbar(IntPtr hWnd); | |
public MainWindow() | |
{ | |
InitializeComponent(); | |
this.Loaded += (sender, args) => DisableCharmbar(new WindowInteropHelper(this).Handle); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment