Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

窗口特性:拖拽 #6

Open
suhao opened this issue Jun 5, 2019 · 3 comments
Open

窗口特性:拖拽 #6

suhao opened this issue Jun 5, 2019 · 3 comments

Comments

@suhao
Copy link
Member

suhao commented Jun 5, 2019

  1. 正常拖动窗口
  2. 最大化后拖动
  3. 全屏禁用拖动
@suhao
Copy link
Member Author

suhao commented Jun 5, 2019

windows7 maximized windows draggable SC_MOVE | HTCAPTION

win7系统以上,窗口最大化后,拖到caption区域会收到WM_SYSCOMMAND消息,但是wparam可能是:SC_MOVE | HTCAPTION

WM_SYSCOMMAND响应处理

    if (SCF_ISSECURE == wparam) {
        // indicates whether the screen saver is secure.
    }

    auto user = 0xFFF0 & wparam;
    auto hittest = wparam & 0x000F;

    if (wparam == SC_CLOSE || user == SC_CLOSE) {
        handled = true;
        SendMessage(WM_CLOSE);
        return 0;
    }

    if (wparam == (SC_MOVE | HTCAPTION)) {
        // 0xF012: drag window.

    }

    switch (user) {
    case SC_CLOSE: break;
    case SC_MAXIMIZE: break; // ShowWindow(SW_MAXIMIZE)
    case SC_MINIMIZE: break; // ShowWindow(SW_MINIMIZE)
    case SC_RESTORE: break; // SW_RESTORE
        
    case SC_MOVE:   
    case SC_SIZE: {
        // size move:
        // * https://github.com/jonathangray/freebsd-1.x-ports/blob/1deabf6e7f2570248fce13534b0a8f2868ba894b/util/wine/windows/nonclient.c
        // * https://github.com/mirror/reactos/blob/c6d2b35ffc91e09f50dfb214ea58237509329d6b/reactos/win32ss/user/ntuser/defwnd.c
        // if (IsZoomed() || IsIconic() || !IsWindowVisible()) return;
        /*
        calc window's position.
        WM_ENTERSIZEMOVE
        WM_EXITSIZEMOVE
        SetWindowPos
        */
    }break;

    case SC_NEXTWINDOW: break;
    case SC_PREVWINDOW: break;

    case SC_TASKLIST: break;
    case SC_HOTKEY: break;
    case SC_MONITORPOWER: break;
    case SC_SCREENSAVE: break;
    default: break;
    }

@suhao
Copy link
Member Author

suhao commented Jun 24, 2019

窗口resize到桌面边缘时自动拉伸高度

NCLButtonDown时可以给窗口增加WS_THICKFRAME, 再up时Remove WS_THICKFRAME

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant