MCPcopy Create free account
hub / github.com/TranslucentTB/TranslucentTB / classname

Method classname

TranslucentTB/windows/window.cpp:101–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101std::optional<std::wstring> Window::classname() const
102{
103 std::wstring className;
104 bool failed = false;
105 // https://learn.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-wndclassw
106 // The maximum length for lpszClassName is 256.
107 className.resize_and_overwrite(256, [hwnd = m_WindowHandle, &failed](wchar_t* data, std::size_t count)
108 {
109 const int length = GetClassName(hwnd, data, static_cast<int>(count) + 1);
110 if (!length)
111 {
112 LastErrorHandle(spdlog::level::info, L"Getting class name of a window failed.");
113 failed = true;
114 }
115
116 return length;
117 });
118
119 if (!failed)
120 {
121 return { std::move(className) };
122 }
123 else
124 {
125 return std::nullopt;
126 }
127}
128
129std::optional<std::filesystem::path> Window::file() const
130{

Callers 6

IsFilteredMethod · 0.80
FindRuleInnerMethod · 0.80
OnWindowCreateDestroyMethod · 0.80
InsertWindowMethod · 0.80
DumpWindowMethod · 0.80
WindowEnumProcMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected