Skip to content

Commit 79ba3f9

Browse files
committed
Добавлена заготовка для всплывающих подсказок.
1 parent 97d3f66 commit 79ba3f9

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

Source/PropPage.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,34 @@ HRESULT CVRMainPPage::OnApplyChanges()
520520
return S_OK;
521521
}
522522

523+
HWND CVRMainPPage::CreateHintWindow(HWND parent, int timePop, int timeInit, int timeReshow)
524+
{
525+
HWND hhint = CreateWindowExW(WS_EX_TOPMOST, TOOLTIPS_CLASS, nullptr,
526+
WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, CW_USEDEFAULT,
527+
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, parent, nullptr, nullptr, nullptr);
528+
529+
SetWindowPos(hhint, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
530+
SendMessageW(hhint, TTM_SETDELAYTIME, TTDT_AUTOPOP, MAKELONG(timePop, 0));
531+
SendMessageW(hhint, TTM_SETDELAYTIME, TTDT_INITIAL, MAKELONG(timeInit, 0));
532+
SendMessageW(hhint, TTM_SETDELAYTIME, TTDT_RESHOW, MAKELONG(timeReshow, 0));
533+
SendMessageW(hhint, TTM_SETMAXTIPWIDTH, 0, 470);
534+
return hhint;
535+
}
536+
537+
void CVRMainPPage::AddHint(int id, const LPCWSTR text)
538+
{
539+
if (!m_hHint) {
540+
m_hHint = CreateHintWindow(m_Dlg, 15000);
541+
}
542+
TOOLINFOW ti;
543+
ti.cbSize = sizeof(TOOLINFOW);
544+
ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND;
545+
ti.hwnd = m_Dlg;
546+
ti.uId = (LPARAM)GetDlgItem(id).m_hWnd;
547+
ti.lpszText = const_cast<LPWSTR>(text);
548+
SendMessageW(m_hHint, TTM_ADDTOOLW, 0, (LPARAM)&ti);
549+
}
550+
523551
// CVRInfoPPage
524552

525553
CVRInfoPPage::CVRInfoPPage(LPUNKNOWN lpunk, HRESULT* phr) :

Source/PropPage.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) 2018-2024 see Authors.txt
2+
* (C) 2018-2025 see Authors.txt
33
*
44
* This file is part of MPC-BE.
55
*
@@ -33,6 +33,8 @@ class __declspec(uuid("DA46D181-07D6-441D-B314-019AEB10148A"))
3333

3434
int m_oldSDRDisplayNits = SDR_NITS_DEF;
3535

36+
HWND m_hHint = nullptr;
37+
3638
public:
3739
CVRMainPPage(LPUNKNOWN lpunk, HRESULT* phr);
3840
~CVRMainPPage();
@@ -53,6 +55,9 @@ class __declspec(uuid("DA46D181-07D6-441D-B314-019AEB10148A"))
5355
}
5456
INT_PTR OnReceiveMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) override;
5557
HRESULT OnApplyChanges() override;
58+
59+
HWND CreateHintWindow(HWND parent, int timePop = 1700, int timeInit = 70, int timeReshow = 7);
60+
void AddHint(int id, const LPCWSTR text);
5661
};
5762

5863
// CVRInfoPPage

0 commit comments

Comments
 (0)