Strange problem when performed window message processing in NPAPI plig-in under Windows.
Oleksandr Gavenko <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.plugins |
|---|---|
| Message-ID | <[email protected]> |
I have NPAPI based plug-in which called from JS through
plug-in scriptable object.
I report that plug-in is windowed (but seens browser do not check this)
through own 'NPP_GetValue' func.
In function that invoked on JS call I show native Windows window
which I create without passing parent main browser window
(by CreateWindowEx).
My window message processing loop:
while (1) {
MSG msg;
BOOL fGotMessage = GetMessage(&msg, NULL, 0, 0);
if (fGotMessage == 0)
break;
if (fGotMessage == -1) {
MessageBox(NULL, L"GetMessage", errorMsg, MB_ICONERROR);
break;
}
if (!IsDialogMessage(hWnd, &msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
I found that Firefox, Opera, Chrome and Safary have strange
behaviour after invoking by plug-in func from JS (and closing window
showed by plug-in) like clikcing on some URL do not perform
jumping to this URL or ever browser crashing (with WinDbg I check
that crash occur outside my plug-in code).
I found that this issue related to window message processing
when some message passed to 'DefWindowProc' in my 'WndProc'.
If I put:
if (message >= 0xc000)
return -1;
before switch in:
WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
case WM_CREATE: {
....
Firefox, Chrome and Opera browsers work fine. Safary still crashes.
Without this 'if (message >= 0xc000)' all browser have described
problems.
I experiment with different values in '(message >= 0xc000)' like
WM_USER/WM_APP/0xc000 and log all messages but reading log
does not take me some thing valuable.
Note that I am have a few skills in Windows development.
I found that working with WinDbg is hard to understand what happen.
Any suggestions please!
--
Best regards!