finestre-sys 0.1.1

Bare-bones bindings for a very limited subset of the Win32 API. Advise you use the official windows-sys crate instead.
Documentation
mod consts;
pub use consts::*;
use crate::typedefs::*;


#[link(name = "User32")]
unsafe extern "system" {
    pub unsafe fn FindWindowExW(
        parent_window: HWND,
        child_window_after: HWND,
        window_class: LPCWSTR,
        window_name: LPCWSTR,
    ) -> HWND;

    pub unsafe fn RegisterWindowMessageW(
        message: LPCWSTR,
    ) -> UINT;

    pub unsafe fn SendMessageTimeoutW(
        window: HWND,
        message: UINT,
        w_param: WPARAM,
        l_param: LPARAM,
        flags: UINT,
        timeout: UINT,
        result: *mut DWORD_PTR
    ) -> LRESULT;

    pub unsafe fn MessageBoxW(
        window: HWND,
        text: LPCWSTR,
        caption: LPCWSTR,
        message_box_type: UINT
    ) -> INT;

    pub unsafe fn GetSysColor(
        index: INT
    ) -> DWORD;
    
    pub unsafe fn LoadImageW(
        instance: HINSTANCE,
        name: LPCWSTR,
        image_type: UINT,
        width: INT,
        height: INT,
        load_options: UINT
    ) -> HANDLE;

    pub unsafe fn RegisterClassExW(
        window_class: *const WndClassExW
    ) -> ATOM;

    pub unsafe fn CreateWindowExW(
        extended_style: DWORD,
        class_name: LPCWSTR,
        window_name: LPCWSTR,
        style: DWORD,
        x: INT,
        y: INT,
        width: INT,
        height: INT,
        parent_window: HWND,
        menu: HMENU,
        instance: HINSTANCE,
        user_data_pointer: LPVOID
    ) -> HWND;

    pub unsafe fn DestroyWindow(
        window: HWND
    ) -> BOOL;

    pub unsafe fn GetMessageW(
        message: *mut Msg,
        window: HWND,
        message_filter_min: UINT,
        message_filter_max: UINT
    ) -> BOOL;

    pub unsafe fn PeekMessageW(
        message: *mut Msg,
        window: HWND,
        message_filter_min: UINT,
        message_filter_max: UINT,
        remove_message: UINT
    ) -> BOOL;

    pub unsafe fn SendMessageW(
        window: HWND,
        message: UINT,
        w_param: WPARAM,
        l_param: LPARAM
    ) -> LRESULT;

    pub unsafe fn TranslateMessage(
        message: *const Msg
    ) -> BOOL;

    pub unsafe fn DispatchMessageW(
        message: *const Msg
    ) -> LRESULT;

    pub unsafe fn PostQuitMessage(
        exit_code: INT
    );

    pub unsafe fn SetTimer(
        window: HWND,
        event_id: UINT_PTR,
        time_out_ms: UINT,
        timer_proc: TIMERPROC
    ) -> UINT_PTR;

    pub unsafe fn GetSystemMetrics(
        index: INT
    ) -> INT;

    pub unsafe fn GetClientRect(
        window: HWND,
        rect: *mut Rect
    ) -> BOOL;

    pub unsafe fn GetWindowLongPtrW(
        window: HWND,
        index: INT
    ) -> LONG_PTR;

    pub unsafe fn SetWindowLongPtrW(
        window: HWND,
        index: INT,
        new_pointer: LONG_PTR
    ) -> LONG_PTR;

    pub unsafe fn DefWindowProcW(
        window: HWND,
        message: UINT,
        w_param: WPARAM,
        l_param: LPARAM
    ) -> LRESULT;
}



#[repr(C)]
#[derive(finestre_init_with_size_derive::InitWithSize)]
pub struct WndClassExW {
    pub size: UINT,
    pub style: UINT,
    pub window_proc: WNDPROC,
    pub class_extra_bytes: INT,
    pub window_extra_bytes: INT,
    pub instance: HINSTANCE,
    pub icon: HICON,
    pub cursor: HCURSOR,
    pub background_brush: HBRUSH,
    pub menu_name: LPCWSTR,
    pub class_name: LPCWSTR,
    pub icon_small: HICON
}

#[repr(C)]
pub struct Point {
    pub x: LONG,
    pub y: LONG
}

#[repr(C)]
pub struct Rect {
    pub left: LONG,
    pub top: LONG,
    pub right: LONG,
    pub bottom: LONG
}

#[repr(C)]
pub struct Msg {
    pub window: HWND,
    pub message: UINT,
    pub w_param: WPARAM,
    pub l_param: LPARAM,
    pub time: DWORD,
    pub point: Point,
    private: DWORD
}


#[repr(C)]
pub struct CreateStructW {
    pub user_data_pointer: LPVOID,
    pub instance: HINSTANCE,
    pub menu: HMENU,
    pub parent_window: HWND,
    pub height: INT,
    pub width: INT,
    pub y: INT,
    pub x: INT,
    pub style: LONG,
    pub window_name: LPCWSTR,
    pub class_name: LPCWSTR,
    pub extended_style: DWORD
}