Skip to content

Instantly share code, notes, and snippets.

the-nose-knows

Block or report user

Report or block the-nose-knows

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View MonitorInfo.md

A Windows MonitorInfo class

MonitorInfo.h

#ifndef MONITOR_INFO_H
#define MONITOR_INFO_H

#include <Windows.h>
#include <vector>
@the-nose-knows
the-nose-knows / delay.h
Created Jun 20, 2018
A non-busy C++ thread sleeper, static class meant to be included as-needed; sleeps whatever thread it's used on.
View delay.h
#ifndef DELAY_H
#define DELAY_H
#include <chrono>
#include <thread>
class Delay
{
private:
Delay(){};
@the-nose-knows
the-nose-knows / csharp_7point1orlater_asyncmain_countdowntimer.cs
Last active Jun 6, 2018
A countdown timer written in C# 7.1+ using an async main method and an async task delay
View csharp_7point1orlater_asyncmain_countdowntimer.cs
using System;
using System.Threading.Tasks;
namespace CountdownTimer
{
class Program
{
public static async Task Main( string[] args )
{
int delay = 500; // Default delay
View send_virtual_key_and_mouse_input.cpp
#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 Apr 30, 2018
QFile 5.10 returning true for a directory instead of a file
View qfile_badFileCheck.cpp
#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");
View fixed_qscreen_info.cpp
#include <QGuiApplication>
#include <QScreen>
#include <Qpixmap>
#include <QDebug>
int main(int argc, char *argv[])
{
QGuiApplication a(argc, argv);
QList<QScreen *> screens = QGuiApplication::screens();
View good_output_qpixmap.txt
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
View qt_screen_info_output.txt
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
View qt_screen_info.cpp
#include <QGuiApplication>
#include <QScreen>
#include <Qpixmap>
#include <QDebug>
int main(int argc, char *argv[])
{
QGuiApplication a(argc, argv);
QList<QScreen *> screens = QGuiApplication::screens();
View msi_dump.log
=== Verbose logging started: 10/2/2017 15:18:47 Build type: SHIP UNICODE 5.00.10011.00 Calling process: C:\windows\system32\msiexec.exe ===
MSI (c) (E0:7C) [15:18:47:227]: Font created. Charset: Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg
MSI (c) (E0:7C) [15:18:47:227]: Font created. Charset: Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg
MSI (c) (E0:04) [15:18:47:242]: Resetting cached policy values
MSI (c) (E0:04) [15:18:47:242]: Machine policy value 'Debug' is 0
MSI (c) (E0:04) [15:18:47:242]: ******* RunEngine:
******* Product: SetupProject1.msi
******* Action:
You can’t perform that action at this time.