Categories
Game Creation Mastering Development

Create context OpenGL 4 for WinAPI (Core & new – style context)

I try create new – style context OpenGL 4.2 in core mode for OS WIndows (using WinAPI). My code is work: #include <windows.h> #include <string> #include <sstream> #include <GL/GL.h> using GLchar = char; using DEBUGPROC = void (APIENTRY*)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar * message, const void* userParam); using […]

Categories
Development

WinAPI – manipulating windows and hooking mouse

I want to get handles to all opened, visible windows and do something with them. I need to detect dragging the window and I need to change the position of some windows. But my app freezes every time. It does not execute properly and printing “Done”. #include <string> #include <iostream> #include <windows.h> BOOL CALLBACK enumWindowCallback(HWND […]

Categories
Development

Why does SetWindowRgn not work for static controls?

I have some problems with making static controls rounded. I can’t understand why SetWindowRgn doesn’t work for a static control here. Also I’ve tried SelectClipRgn and it works. But nevertheless why SetWindowRgn doesn’t? The Microsoft documentation states that The system does not display any portion of a window that lies outside of the window region. […]

Categories
Development

SetWindowsHookEx – difference between VK_LSHIFT and “Search” keyboard button

I use SetWindowsHookEx to catch keyboard events SetWindowsHookEx(WH_KEYBOARD_LL, HookCallback, NULL, 0) Here is HookCallback LRESULT __stdcall HookCallback(int nCode, WPARAM wParam, LPARAM lParam) { if (nCode >= 0) { // the action is valid: HC_ACTION. if (wParam == WM_KEYDOWN) { kbdStruct = *((KBDLLHOOKSTRUCT*)lParam); printf(“%ld\n”, kbdStruct.vkCode); } } } When press “left shift” output is 160 when […]

Categories
Development

C++ Callbacks for an Event Manager using std::function and std:bind with derived classes as parameters

I have the following Event Manager: AppEventManager.h #pragma once #define GF_BIND_FN(fn) std::bind(&fn, this, std::placeholders::_1) struct Event { public: enum EventType { AppQuit, AppBackground, WindowResize, WindowGainFocus, WindowLostFocus }; EventType type = EventType::AppQuit; Event(EventType type) : type(type) {} }; struct WindowResizedEvent : public Event { public: int width = 0; int height = 0; WindowResizedEvent(int width, int […]

Categories
Development

Bitblt,combine multiple irregular regions into one in a back buffer [closed]

I did an edit of my original and missed putting in the original conditions: C++11 CODE::BLOCKS 17.12 Windows 32 bit. I going for Unicode, but I do not know if I have it yet. Two regions. I do not know how to combine the two in a back buffer so that they are put on […]

Categories
Development

DialogBox not drawing the dialog correctly

So I have the following dialogbox template which I saved in a .rc file: DIALOG_TEST DIALOG 0, 0, 186, 95 STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU CAPTION “Dialog” FONT 8, “Ms Shell Dlg” { PUSHBUTTON “Cancel”, IDD_CAN, 129, 24, 50, 14, 0, WS_EX_LEFT DEFPUSHBUTTON “OK”, […]

Categories
Development

Is there a way I can pass another parameter to use inside this window callback function?

LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) So, this is the function prototype for a Window Procedure of some window created using the Windows API (win32). It is used to process some window messages like when the user clicks the Close button, or resize the window. WNDCLASSA window_class = {0}; window_class.style = […]

Categories
API Development

WinAPI timer callback not called while child window is in focus

I’m working on a 3D editor app using Direct3D and WinAPI. I create a main window, which has a child window that takes up a portion of the main window’s client area. This is used by D3D as the render target. I then also create a separate window with CreateWindow, which is built the same […]

Categories
Development

Rich Edit Control paints whole application black after unminimize

Here’s my problem: (gif) It happens whenever I unminimize the application. The gif starts showing the app reopened after a minimize, and stepping through the moments just before and after the background of all windows turns black. This never happens if I’m switching between apps without the app in question never having been minimized before. […]