#winapi #window #api #create #ui #windows #costless

llwlib

A costless windows api wrapper to create windows

5 releases

0.1.4 Sep 2, 2024
0.1.3 Sep 1, 2024
0.1.2 Aug 30, 2024
0.1.1 Aug 30, 2024
0.1.0 Aug 30, 2024

#104 in Windows APIs

MIT license

9KB
129 lines

llwlib - A costless windows api wrapper to create windows

To create a window:

use llwlib::{Window, WindowProperties, WindowStyles};
use windows_sys::Win32::UI::WindowsAndMessaging::*;
use windows_sys::Win32::Foundation::*;

fn main() {
    Window::new(
        WindowProperties {
            style: WindowStyles { ..Default::default() },
            position: (CW_USEDEFAULT, CW_USEDEFAULT),
            classname: "class_name".into(),
            title: "Title".into(),
            size: (1200, 700)
        },
        wnd_proc,
        None,
        false,
        ()
    );
}

unsafe fn wnd_proc(hwnd: HWND, msg: u32, wp: WPARAM, lp: LPARAM, _: isize) -> LRESULT {
    DefWindowProcW(hwnd, msg, wp, lp)
}

Dependencies

~12–19MB
~240K SLoC