Skip to content

Instantly share code, notes, and snippets.

@the-nose-knows
the-nose-knows / AddWinRTToCpp17Projects.md
Created October 19, 2018 21:11
Adding WinRT to a Visual C++ 17 project in Visual Studio

Adding WinRT to a Visual C++ 17 project in Visual Studio

  1. Open the project's Properties panel
  2. Go to the C++ section, then Commandline
  3. Add this for all platforms and configurations: /Zc:twoPhase-
C:\_gh\DeepSpeech-master\DeepSpeech-master>python --version
Python 3.6.6
C:\_gh\DeepSpeech-master\DeepSpeech-master>pip --version
pip 18.0 from c:\program files\python36\lib\site-packages\pip (python 3.6)
C:\_gh\DeepSpeech-master\DeepSpeech-master>pip install deepspeech
Collecting deepspeech
Could not find a version that satisfies the requirement deepspeech (from versions: )

A Windows MonitorInfo class

MonitorInfo.h

#ifndef MONITOR_INFO_H
#define MONITOR_INFO_H

#include <Windows.h>
#include 
@the-nose-knows
the-nose-knows / delay.h
Created June 20, 2018 03:38
A non-busy C++ thread sleeper, static class meant to be included as-needed; sleeps whatever thread it's used on.
#ifndef DELAY_H
#define DELAY_H
#include <chrono>
#include <thread>
class Delay
{
private:
Delay(){};
@the-nose-knows
the-nose-knows / MessageBoxEx.cs
Last active June 6, 2018 08:45
RogerB's MessageBoxEx from CODEPROJECT; an include-only extension for MessageBox, supporting a timeout timer
/*
* From author RogerB: https://www.codeproject.com/script/membership/view.aspx?mid=716667
* Code source article: https://www.codeproject.com/articles/7968/messagebox-with-a-timeout-for-net
* Licensing: https://www.codeproject.com/info/cpol10.aspx
*/
using System;
using System.Text;
using System.Runtime.InteropServices;
using System.Security.Permissions;
#include <Windows.h>
// == MOUSE ACTIONS ==
// Uses absolute coords where the primary display starts at 0,0
// That works well with enumerated monitors structures and their reported coords.
#define SET_MOUSE_MOVE mip.mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE;
#define SET_MOUSE_RCLICK_HOLD mip.mi.dwFlags = MOUSEEVENTF_RIGHTDOWN;
#define SET_MOUSE_RCLICK_RELEASE mip.mi.dwFlags = MOUSEEVENTF_RIGHTUP;
#define SET_MOUSE_LCLICK_HOLD mip.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
#define SET_MOUSE_LCLICK_RELEASE mip.mi.dwFlags = MOUSEEVENTF_LEFTUP;
@the-nose-knows
the-nose-knows / qfile_badFileCheck.cpp
Created April 30, 2018 18:43
QFile 5.10 returning true for a directory instead of a file
#include <QCoreApplication>
#include <QDebug>
#include <QFile>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
qDebug() << "Folder is detected as file?" << QFile::exists("C:/config.folder");
#include <QGuiApplication>
#include <QScreen>
#include <Qpixmap>
#include <QDebug>
int main(int argc, char *argv[])
{
QGuiApplication a(argc, argv);
QList<QScreen *> screens = QGuiApplication::screens();
Screen 0 :
height: 1080
width: 1920
rect: QRect(0,0 1920x1080)
size: QSize(1920, 1080)
cacheKey: 4294968376
depth: 32
isQBitmap: false
isNull: false
defaultDepth: 32
Screen 0 :
height: 1080
width: 1920
rect: QRect(0,0 1920x1080)
size: QSize(1920, 1080)
cacheKey: 4294968376
depth: 32
isQBitmap: false
isNull: false
defaultDepth: 32