Hi EVERY ONE.
I'm working on a title-bar free window on windows api based on this example
ukmKN.png
But i want to resize window outside of it's window area just like windows 10 style :
4Q9NL.png
What should i do? or where should i start ?
Code:#pragma once #include <memory> #include <string> #include <Windows.h> using unique_hwnd = std::unique_ptr<std::remove_pointer <HWND>::type, decltype(&DestroyWindow)>; class Window { public: Window(); HWND handle() const { return hWnd.get(); } bool isClosed() const { return _closed; }; private: unique_hwnd hWnd; bool _closed = false; static const std::wstring& registerWindow(); static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); void setBorderLess() const; void show() const; void setShadow() const; };
Code:#include "test.h" #include <cassert> #include <stdexcept> #include <windowsx.h> #include <dwmapi.h> #pragma comment(lib, "dwmapi.lib") LPCWSTR CLASS_NAME = L"Win32APP"; #define BORDER_WIDTH 5 enum Style : DWORD { BorderLess = ( WS_THICKFRAME | WS_CAPTION | WS_SYSMENU | WS_MAXIMIZEBOX | WS_MINIMIZEBOX) }; const std::wstring& Window::registerWindow() { static const std::wstring WINDOW_CLASS = []{ WNDCLASSEX wcx{}; wcx.cbSize = sizeof(wcx); wcx.style = CS_HREDRAW | CS_VREDRAW; wcx.hInstance = (HINSTANCE)GetModuleHandle(nullptr); wcx.lpfnWndProc = &Window::WndProc; wcx.lpszClassName = CLASS_NAME; wcx.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_WINDOW + 1); wcx.hCursor = LoadCursor((HINSTANCE)GetModuleHandle(nullptr), IDC_ARROW); const HRESULT result = RegisterClassEx(&wcx); if (FAILED(result)) throw std::runtime_error("Faild To Register Window Class"); return wcx.lpszClassName; }(); return WINDOW_CLASS; }


Reply With Quote
