Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ohjurot/easyhwnd
Never ever write your windows window-framework from scratch again. Header Only. Just the basic to make HWND OOP and more accessible.
https://github.com/ohjurot/easyhwnd
header-only helper hwnd oop win32 winapi window windows
Last synced: 20 days ago
JSON representation
Never ever write your windows window-framework from scratch again. Header Only. Just the basic to make HWND OOP and more accessible.
- Host: GitHub
- URL: https://github.com/ohjurot/easyhwnd
- Owner: Ohjurot
- License: other
- Created: 2021-02-06T01:01:14.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-02-06T01:31:22.000Z (almost 4 years ago)
- Last Synced: 2024-10-31T21:42:12.391Z (2 months ago)
- Topics: header-only, helper, hwnd, oop, win32, winapi, window, windows
- Language: C++
- Homepage:
- Size: 8.79 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# EasyHWND
### Never ever write your windows window-framework from scratch again!This library provides a basic window framework implementation / abstraction to fit the C++ Object Orientated design. This library is meant to be the starting point for your applications window framework. Just create a class that inherits from `EasyHWND::Window` and you can customize anything you want. Just look at the header (it is not complicated) and the example code.
```c++
int main(int argc, char** argv) {
EasyHWND::WindowClass wc(L"MyWindowClass", CS_OWNDC, NULL, NULL, CreateSolidBrush(RGB(255, 0, 0)));
EasyHWND::Window w(wc, L"MyWindow", 100, 100, 500, 500, WS_OVERLAPPEDWINDOW);
MSG msg = {};
while (!w.checkWindowCloseFlag()) {
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return 0;
}
```But I want my fu**ing HWND back! Well no problem:
```c++
EasyHWND::Window window(wc, L"MyWindow", 100, 100, 500, 500, WS_OVERLAPPEDWINDOW);
HWND stolenHwnd = (HWND)window;
```Do anything you want to that HWND but don't you dare trying to call `DestoyWindow(stolenHwnd)`.
### How to inherit from EasyHWND::Window
```c++
class MyAngryWindow : public EasyHWND::Window {
public:
// Make it construct
MyAngryWindow(EasyHWND::WindowClass& refWndClass, EASYHWND_STR windowTitle, INT posX, INT posY, UINT width, UINT height,
DWORD style, DWORD exStyle = NULL, HMENU menue = NULL, HWND parentWindow = NULL, HINSTANCE hInstance = NULL) :
EasyHWND::Window(refWndClass, windowTitle, posX, posY, width, height, style, exStyle, menue, parentWindow, hInstance)
{}protected:
virtual bool handleWindowMessage(LRESULT* ptrLRESULT, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) override {
// I hate to be closed and will yell at you
if (msg == WM_CLOSE) {
MessageBox(hwnd, L"DONT YOU CLOSE ME!", L"FU** NO", MB_ICONEXCLAMATION | MB_OK);
return true;
}
// Call parent!
return EasyHWND::Window::handleWindowMessage(ptrLRESULT, hwnd, msg, wParam, lParam);
}
};
```But the framework let me resize the window I don't want that! No problem just start the virtual madness and override that function too! Just define `#define EASYHWND_VIRTUAL_MADNESS` and several function will turn into virtual ones just like magic!