perf: 直接调用窗口过程而不是发送消息

This commit is contained in:
Xu 2025-02-02 14:36:16 +08:00
commit 2db1444374
2 changed files with 7 additions and 7 deletions

View file

@ -238,9 +238,9 @@ static bool CreateAutoStartTask(bool runElevated, const wchar_t* arguments) noex
principal->put_LogonType(TASK_LOGON_INTERACTIVE_TOKEN);
if (runElevated) {
hr = principal->put_RunLevel(_TASK_RUNLEVEL::TASK_RUNLEVEL_HIGHEST);
hr = principal->put_RunLevel(TASK_RUNLEVEL_HIGHEST);
} else {
hr = principal->put_RunLevel(_TASK_RUNLEVEL::TASK_RUNLEVEL_LUA);
hr = principal->put_RunLevel(TASK_RUNLEVEL_LUA);
}
if (FAILED(hr)) {

View file

@ -456,9 +456,9 @@ LRESULT MainWindow::_TitleBarMessageHandler(UINT msg, WPARAM wParam, LPARAM lPar
{
POINT cursorPos{ GET_X_LPARAM(lParam),GET_Y_LPARAM(lParam) };
ClientToScreen(_hwndTitleBar.get(), &cursorPos);
wParam = SendMessage(_hwndTitleBar.get(), WM_NCHITTEST, 0, MAKELPARAM(cursorPos.x, cursorPos.y));
wParam = _TitleBarMessageHandler(WM_NCHITTEST, 0, MAKELPARAM(cursorPos.x, cursorPos.y));
[[fallthrough]];
}
[[fallthrough]];
case WM_NCMOUSEMOVE:
{
CaptionButtonsControl& captionButtons = Content()->TitleBar().CaptionButtons();
@ -513,7 +513,7 @@ LRESULT MainWindow::_TitleBarMessageHandler(UINT msg, WPARAM wParam, LPARAM lPar
Content()->TitleBar().CaptionButtons().LeaveButtons();
} else {
// 然后检查鼠标在标题栏上的位置
LRESULT hit = SendMessage(_hwndTitleBar.get(), WM_NCHITTEST, 0, MAKELPARAM(cursorPos.x, cursorPos.y));
LRESULT hit = _TitleBarMessageHandler(WM_NCHITTEST, 0, MAKELPARAM(cursorPos.x, cursorPos.y));
if (hit != HTMINBUTTON && hit != HTMAXBUTTON && hit != HTCLOSE) {
Content()->TitleBar().CaptionButtons().LeaveButtons();
}
@ -553,9 +553,9 @@ LRESULT MainWindow::_TitleBarMessageHandler(UINT msg, WPARAM wParam, LPARAM lPar
POINT cursorPos{ GET_X_LPARAM(lParam),GET_Y_LPARAM(lParam) };
ClientToScreen(_hwndTitleBar.get(), &cursorPos);
wParam = SendMessage(_hwndTitleBar.get(), WM_NCHITTEST, 0, MAKELPARAM(cursorPos.x, cursorPos.y));
wParam = _TitleBarMessageHandler(WM_NCHITTEST, 0, MAKELPARAM(cursorPos.x, cursorPos.y));
[[fallthrough]];
}
[[fallthrough]];
case WM_NCLBUTTONUP:
{
// 处理鼠标在标题栏上释放。如果在标题栏按钮上,则通知 CaptionButtons否则将消息传递给主窗口