Hi everyone, including you!
I have found a strange error that keeps happening each time I press the F1 key while any program with the web browser component is running, and in keyboard focus. (I click on the browser window then press F1)
Its happened on a few different computers I've tried, XP home and XP Prof
I found that the cause was the system calling IDocHostShowUI@ShowMessage handler with NULL lpstrCaption and lpstrText pointers.
I fixed the code by not showing a messagebox for empty strings, and not modifying the plResult if it happens (I believe thats what causes the error)
I dont see how the code is wrong at all, I've check the specs for this function, and the code seems to comply perfectly
I also dont know why its calling ShowMessage, when you think F1 would call showhelp atleast.
IDocHostShowUI@ShowMessage proc pif:DWORD,hwnd:DWORD,lpstrText:DWORD,lpstrCaption:DWORD,dwType:DWORD,lpstrHelpFile:DWORD,dwHelpContext:DWORD,plResult:DWORD
; This Proc is called by MSHTML when it needs to display a message box.
.IF plResult
invoke MessageBox,hwnd,lpstrText,addr szDisplayName,dwType
mov edx,plResult
mov [edx],eax <- seems to be why it crashes when the title and caption are blank
.ELSE
invoke MessageBox,hwnd,lpstrText,addr szDisplayName,dwType
.ENDIF
;S_OK Host displayed its UI. MSHTML will not display its message box.
;S_FALSE Host did not display its UI. MSHTML will display its message box.
return S_OK
IDocHostShowUI@ShowMessage endp
Hope someone can explain the strange crashes, because I cant figure out why
Thanks!
Fab :eek
I've noticed in custom implementation of IDropTarget (see api RegisterDragDrop)
in method DragEnter - the last argument is pdwEffect (pointer to dword)
NOPE! if you hange dword pointed by this pointer you get crash.
But changing this 'pointer' (only on stack) works ok :green, so as the caller has pushed a dword, called your method and read the dword back from stack :/
push ...
push dwEffect
push this_droptarget
call IDropTarget@DragEnter
mov dwEffect,[esp-8] ;<- something like this, hehe
Thanks Fab
You can just remove that and the above line.
KetilO