Returns buffer instead of WPARAM and LPARAM
This commit is contained in:
parent
f22837523f
commit
ef038257d1
4 changed files with 23 additions and 8 deletions
|
@ -190,9 +190,21 @@ void Window::OnExecuteWindowsCommand(const std::string& command_name) {
|
|||
}
|
||||
|
||||
#if defined(OS_WIN)
|
||||
void Window::OnWindowMessage(UINT message, uint64_t w_param, int64_t l_param) {
|
||||
v8::Local<v8::Value> Window::ToBuffer(void* val, int size) {
|
||||
auto buffer = node::Buffer::New(isolate(), static_cast<char*>(val), size);
|
||||
|
||||
if (buffer.IsEmpty()) {
|
||||
return v8::Null(isolate());
|
||||
} else {
|
||||
return buffer.ToLocalChecked();
|
||||
}
|
||||
}
|
||||
|
||||
void Window::OnWindowMessage(UINT message, WPARAM w_param, LPARAM l_param) {
|
||||
if (IsWindowMessageHooked(message)) {
|
||||
messages_callback_map_[message].Run(w_param, l_param);
|
||||
messages_callback_map_[message].Run(
|
||||
ToBuffer(static_cast<void*>(&w_param), sizeof(WPARAM)),
|
||||
ToBuffer(static_cast<void*>(&l_param), sizeof(LPARAM)));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue