Posts

Showing posts with the label winapi

Window glitches after redrawing with RedrawWindow or SendMessage(WM_PAINT)

Image
Window glitches after redrawing with RedrawWindow or SendMessage(WM_PAINT) I'm writing an application in C++ using the standard Windows API. It does some simple registry modification using buttons. When a button is pressed, it changes a label displayed at the bottom. To change it, I need to repaint the window (which automatically changes the label as needed). But when I redraw the window, it starts glitching. The static labels start flickering, and the buttons are missing altogether, but it stops after moving the window. Here is a GIF of it happening: Here is my WndProc function: WndProc LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { static HFONT s_hFont = NULL; HWND drive; switch (message) { case WM_COMMAND: { int wmId = LOWORD(wParam); // Parse the menu selections: switch (wmId) { case IDM_ABOUT: Dial...

Contiune keyboard working while hooking

Contiune keyboard working while hooking I'm learning recently how to hook APIs and I started with keyboard calls. I set the hook with "SetWindowsHookEx(WH_KEYBOARD_LL, LowLevelKeyboardProc, 0, 0);" and everything is working as i want but... Hooking is capturing keyboard and kinda blocking it - so as i want only to get informations that keys are used but dont wanna change the way they'r working i used "keybd_event(p->vkCode, 0, 0, 0);" and here appears another "but"... This function as it's simulation of key press it going to be hooked again what i do NOT want. Is there any solution to get information about keyboard using without blocking the work of it? WH_KEYBOARD_LL not blocking keyboard – RbMm Jun 29 at 9:06 WH_KEYBOARD_LL DO NOT call keybd_event() from inside th...