fltk-rs 隐藏标题栏但显示任务栏图标

use fltk::{prelude::*, *};
use std::os::raw::*;

const GWL_EXSTYLE: i32 = -20;
const WS_EX_APPWINDOW: c_ulong = 0x00040000;
extern "system" {
    pub fn GetWindowLongA(wnd: *mut c_void, idx: c_int) -> c_ulong;
    pub fn SetWindowLongA(wnd: *mut c_void, idx: c_int, newval: c_ulong) -> c_long;
}

fn main() {
    let app = app::App::default();
    let mut win = window::Window::default()
        .with_size(400, 300)
        .with_label("Test");
    win.end();
    win.set_border(false);
    win.show();
    unsafe {
        let handle = win.raw_handle();
        let mut style_ex = GetWindowLongA(handle, GWL_EXSTYLE);
        style_ex |= WS_EX_APPWINDOW;
        SetWindowLongA(handle, GWL_EXSTYLE, style_ex);
    }

    app.run().unwrap();
}
posted @ 2024-05-20 20:40  rfrf  阅读(89)  评论(0)    收藏  举报