Category : winapi

How to compare a LPCSTR string? HWND __stdcall CreateWindowExA_Hook(DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam ) { if (lpClassName) { char a[2000]; strncpy_s(a, lpClassName, 1999); a[1999] = ‘{$content}’; if (lstrcmpA(a, "classname") == 0) { //… } } return ..

Read more

#include<windows.h> LRESULT CALLBACK window_callback(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { return DefWindowProc(hwnd, uMsg, wParam, lParam); } int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { // Create Window Class WNDCLASS window_class = {}; window_class.style = CS_HREDRAW | CS_VREDRAW; window_class.lpszClassName = L"Game Window Class"; window_class.lpfnWndProc = window_callback; // Register Class RegisterClass(&window_class); // Create ..

Read more

I want to expand a string ("%LOCALAPPDATA%/test.txt") with a Windows environment path. The following function in principle does the job, but calling it again with the same output string (or assigning some value to the output string before calling the function) gives a segfault. Obviously I am making some (probably really bad) mistake by converting ..

Read more

Goal: using C++, the Win32 SDK and Visual Studio 2019 to set the desktop wallpaper to be centered or tiled or stretched. One can use SystemParametersInfo() to change the wallpaper. No problem at all. Problem is telling the system to tile or center or stretch the wallpaper image. Reading on the web, whether the wallpaper ..

Read more

How do i ‘block’ the WM_LBUTTONDOWN message to be fired? The function is inside of a dll, I also tried to use LowLevelMouseProc but it does not work with error code: 1429 which means "global only hook". I don’t own the window in question. I tried to return a WM_NULL in the code below, but ..

Read more