News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Help2 revisited

Started by donkey, February 22, 2009, 12:51:01 AM

Previous topic - Next topic

akane

To implement CTRL+A and CTRL+C for webbrowser, just add a standard accelerator. For select all or copy, use the following method:webbrowser->ExecWB(OLECMDID_SELECTALL, OLECMDEXECOPT_DODEFAULT, NULL, NULL)
webbrowser->ExecWB(OLECMDID_COPY, OLECMDEXECOPT_DODEFAULT, NULL, NULL)

To save the current page in various formats (full, html, mht, text), callwebbrowser->ExecWB(OLECMDID_SAVEAS, OLECMDEXECOPT_PROMPTUSER, NULL, NULL)

PBrennick

Edgar,

HTML format is fine for me. It looks like akane has some good news, also.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

donkey

Hi Paul,

I did look at accelerators however they are fairly arbitrary, I would need to know when the window is focused and I am still having issues with getting a useful window handle. For example I can use the following code to extract the handle of the browser...

CoInvoke(pIWebBrowser2,IWebBrowser2.IUnknown.QueryInterface,offset IID_IServiceProvider,offset pServiceProvider)
CoInvoke(pServiceProvider,IServiceProvider.QueryService,offset SID_SShellBrowser,offset IID_IOleWindow,offset pWindow)
CoInvoke(pWindow,IOleWindow.GetWindow,offset hBrowser)
CoInvoke(pWindow,IOleWindow.IUnknown.Release)
CoInvoke(pServiceProvider,IServiceProvider.IUnknown.Release)


However the handle returned is not the handle with the focus when the copy command is sent. Actually sending a copy or select all is very simple with ExecWB however making sure that the window is correct is important since the user might also want to copy from the various text boxes. For that reason I was hoping to find an alternative to the accelerator approach.

Edgar
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

akane

Edgar, use GetClassName and separate selectall/copy dispatchers for different window classes:

OnCopyCommand proc
invoke GetFocus
and    eax,eax
jz     copy_from_browser ; default
invoke GetClassNameW, hwnd, buff, 64
invoke lstrcmpiW, buff, L"edit"
and    eax,eax
jz     copy_from_edit
invoke lstrcmpiW, buff, L"Internet Explorer_Server"
and    eax,eax
jz     copy_from_browser

Instead comparing class names, you could test the return value form SendMessage(WM_GETDLGCODE) for DLGC_HASSETSEL flag.

donkey

#64
Thanks Akane,

Good idea, I had looked at the class name to find the window handle for a compare but it your method is more reliable.

Version 0.6.3.7

Added Select All (ctrl-A) Copy (ctrl-C) and Save As (ctrl-S)

Version 0.6.3.8

Added filters to the search dialog

Version 0.6.3.9

Found a bug where the topic would not be loaded properly through CreateProcess due to not preserving EBX in InitializeNamespace, this bug was introduced by the filters mod and has been corrected.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

PauloH

Hi Donkey,

When I try to compile Help2 Viewer I get this output:

=====================================================
C:\Programing\Assembler\Compiladores\Goasm\BIN\GoAsm.EXE /d UNICODE  "Help2 Viewer.asm"

GoAsm.Exe Version 0.56.5h - Copyright Jeremy Gordon 2001/9 - JG@JGnet.co.uk
Output file: Help2 Viewer.obj
C:\Programing\Assembler\Compiladores\Goasm\BIN\GoLink.EXE "Help2 Viewer.obj" "Help2 Viewer.res"

GoLink.Exe Version 0.26.10 beta5- Copyright Jeremy Gordon 2002/9-JG@JGnet.co.uk

Warning!
Assumed entry point (Start) was not found.
Output file: Help2 Viewer.exe
Format: win32 size: 53,248 bytes

Make finished.
Total compile time 344 ms
======================================================

On execution it crashes.
Any hint?

By the way, thank you for your work on headers and examples for GoAsm.

PauloH.

donkey

Hi PauloH,

The error indicates a problem in the headers, I have been working for the last couple of days weeding them out in order to implement INCLUDEALL. I will upload a fixed version today at some point. Sorry about that but there was something screwy with the editor I was using, a Scintilla based one, it would occasionally say it saved when it actually hadn't. I'm back to using good old RadAsm with some macros I recorded for it, it's much more reliable.

Edgar
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

PauloH

Thank you, Donkey. You're doing a giant's work!

PauloH.