06 2020 档案
摘要:调用SetMonitorBrightness 代码示例: #pragma comment(lib, "dxva2.lib") #include <windows.h> #include <lowlevelmonitorconfigurationapi.h> #include <physicalmon
阅读全文
摘要:只需要调用WM_CTLCOLORLISTBOX和WM_CTLCOLOREDIT来分别处理编辑框和下拉列表。 Combox的创建: int xpos = 100; // Horizontal position of the window. int ypos = 100; // Vertical pos
阅读全文
摘要:如果指针指向基类,但是指针在运行时指向派生类,则该基类必须具有虚拟析构函数,以便破坏派生类。如果没有虚拟析构函数,则只会运行基类的析构函数。 比如: Base* basePtr; basePtr = new Derived(1); 如果没有添加virtual,也就是没有虚拟析构函数,看下面代码示例:
阅读全文
摘要:一个完整的用户模式dump是基本的用户模式转储文件。 此转储文件包括进程的整个内存空间,程序的可执行映像本身,句柄表以及其他信息,这些信息对于调试器在重建转储发生时正在使用的内存中很有用。 可以将完整的用户模式转储文件“缩小”到小型转储中。只需将转储文件加载到调试器中,然后使用.dump(创建转储文
阅读全文
摘要:std::vector<std::byte> ReadBytes(PVOID address, SIZE_T length) { std::vector<std::byte> buffer(length); std::cout << "length" << buffer.size() << std:
阅读全文
摘要:这个api的功能主要是实现“透明” 原理: Transparent将hdc中bmp的特定颜色“透明化” #include <Windows.h> #pragma comment(lib,"Msimg32.lib") using namespace std; HBITMAP hBitmap; HBIT
阅读全文
摘要:下面的例子用于反映本地系统的日期格式变化 // locale test #include <stdio.h> #include <locale.h> #include <time.h> #include <locale> #include <Windows.h> #pragma warning(di
阅读全文
摘要:// Test_1.cpp : Defines the entry point for the application. // #include "framework.h" #include "Test_1.h" #include <atlimage.h> #define MAX_LOADSTRIN
阅读全文
摘要:通过使用EnumWindows()和枚举窗口来手动确定EnumChildWindows()来直接确定哪个窗口在z轴上比另一个窗口高。 struct myEnumInfo { HWND hwnd1; HWND hwnd2; HWND hwndOnTop; }; BOOL CALLBACK EnumCh
阅读全文
摘要:void OnEraseBkGnd(HWND hwnd) { /* Vars */ HDC dc; /* Standard Device Context; used to do the painting */ /* rect = Client Rect of the window; Temp = T
阅读全文
摘要:#include <string> #include <sstream> #include <iostream> int main() { std::wstring keyname = L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Mozilla\\Firefox"; std::w
阅读全文
摘要:滑动鼠标滚轮可以改变图像大小 #include <windows.h> #include <tchar.h> #include <Urlmon.h> // URLDownloadToCacheFile #pragma comment (lib, "Urlmon") #include <shlwapi
阅读全文
摘要:#include <string> void makebox(LPCSTR name) { std::string res(name); res += " is X"; ::MessageBoxA(nullptr, res.c_str(), res.c_str(), MB_OK); }
阅读全文
摘要:创建半透明的窗口,以及在窗口上绘制不透明的文本 方法: 创建Bitmap具有PixelFormat32bppPARGB像素格式的GDI + 对象。 创建一个Graphics对象以绘制该Bitmap对象。 使用GDI +将所有图形绘制到该对象中。 销毁Graphics在步骤2中创建的对象。 GetHB
阅读全文
摘要:使用CreateDIBSection 可以创建一个设备无关位图 #include <windows.h> using namespace std; int main() { HDC hdc = GetDC(HWND_DESKTOP); HDC MemDC = CreateCompatibleDC(h
阅读全文
摘要:使用StretchDIBits将位图数据传输到printer的dc中 #include <Windows.h> #include <algorithm> int main() { int nWidth = 16, nHeight = 16; BYTE byteBitmap[768]; std::fi
阅读全文