05 2020 档案
摘要:模拟键盘CTRL+S 的输入 using System; using System.Collections.Generic; using System.Diagnostics; using System.ComponentModel; using System.Runtime.InteropServ
阅读全文
摘要:按下鼠标左键, 连击 按下鼠标右键, 停止 import win32api import time from pynput.mouse import Button, Controller mouse = Controller() while True: if (win32api.GetAsyncKe
阅读全文
摘要:主要用于日常的win32窗口的测试 #include <Windows.h> #include <stdio.h> #include <iostream> using namespace std; LRESULT CALLBACK WndProc(HWND hwnd, UINT message, W
阅读全文
摘要:BOOL bRet; while( (bRet = GetMessage( &msg, hWnd, 0, 0 )) != 0) { if (bRet == -1) { // handle the error and possibly exit } else { TranslateMessage(&m
阅读全文
摘要:#pragma comment(lib, "UxTheme") #include <windows.h> #include <uxtheme.h> LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); int WINAPI WinMain(HIN
阅读全文
摘要:使用UI Automation遍历窗口的所有控件标题和类 #include <Windows.h> #include <stdio.h> #include <UIAutomation.h> IUIAutomation* pClientUIA; IUIAutomationElement* pRootE
阅读全文
摘要:我们使用WH_KEYBOARD来禁用记事本的ALT的按键 .cpp #include <Windows.h> #include <stdio.h> #include <tchar.h> unsigned long GetTargetThreadIdFromWindow(const char* cla
阅读全文
摘要:SetupDiSetClassInstallParams函数一般是用来禁用/启用某个设备 比如我们可以禁用网络适配器 /* for Devpkey */ #define INITGUID /* dependencies */ #pragma comment (lib, "SetupAPI") #in
阅读全文
摘要:从编辑框中获取控件文本 一般常用的方法是, wchar_t buffer[100]; GetWindowText(hWnd, buffer, sizeof(buffer) / sizeof(buffer[0])); 但是这样浪费了数组空间, 所以一般使用GetWindowTextLengthW获取控
阅读全文
摘要:Graphics* StartPaint(HWND win, HDC* hdc, PAINTSTRUCT* ps) { *hdc = BeginPaint(win, ps); return new Graphics(*hdc); } case WM_PAINT: { HDC hdc; PAINTST
阅读全文
摘要:创建多个具体SS_NOTIFY样式的static controls 根据文档显示,当用户单击具有SS_NOTIFY样式的静态控件时,将发送STN_CLICKED通知代码。控件的父窗口通过WM_COMMAND消息接收此通知代码。 所以代码如下: switch (uMsg) { case WM_COMM
阅读全文