/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
WindowHook::MessageData* WindowHook::Lookup(UINT nMsg) {
MessageDataArray::index_type idx; for (idx = 0; idx < mMessageData.Length(); idx++) {
MessageData& data = mMessageData[idx]; if (data.nMsg == nMsg) return &data;
} return nullptr;
}
WindowHook::MessageData* WindowHook::LookupOrCreate(UINT nMsg) {
MessageData* data = Lookup(nMsg); if (!data) {
data = mMessageData.AppendElement();
if (!data) return nullptr;
data->nMsg = nMsg;
} return data;
}
void WindowHook::DeleteIfEmpty(MessageData* data) { // Never remove a MessageData that has still a hook or monitor entries. if (data->hook || !data->monitors.IsEmpty()) return;
MessageDataArray::index_type idx;
idx = data - mMessageData.Elements();
NS_ASSERTION(
idx < mMessageData.Length(), "Attempted to delete MessageData that doesn't belong to this array!");
mMessageData.RemoveElementAt(idx);
}
bool WindowHook::Notify(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam,
MSGResult& aResult) {
MessageData* data = Lookup(nMsg); if (!data) returnfalse;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.