Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Need help for a custom browser


  • Please log in to reply
4 replies to this topic
Zaelia
  • Members
  • 754 posts
  • Last active: Jan 17 2015 02:38 AM
  • Joined: 31 Oct 2008
My family have many netbooks... Computers are old, with xp, with a small display resolution...
I tried to do a script for to create an internet browser with essentials functions on full screen without to lose habits, but I have some bugs or a lack of knowledge.

- Why "tab" (sometimes "enter" too) key doesn't work for to navigate inside a webpage who have the focus ? (+owner problem ? -tabstop option ?)
- How disable javascript errordialogbox on some website ? (without to go to IE settings if possible)
- How disable warning or ahk error messagebox ? for example when we "goback" when they are nothing, as an empty object problem. Script will not crashs but display annoying windows.
- and other thing if you find them...

So, here the basic script, go to top or bottom with your mouse for to spawn taskbar or controlbar :
#SingleInstance force
OnExit, exit
CoordMode, Mouse, Screen
WinHide ahk_class Shell_TrayWnd

Gui, win:-Border -Caption -Theme
Gui, win:Add, ActiveX, x0 y0 w%A_ScreenWidth% h%A_ScreenHeight% vWB, Shell.Explorer
Gui, win:Show, x0 y0 w%A_ScreenWidth% h%A_ScreenHeight%, Tiny Explorer

Gui, bar:-Border -Caption -Theme
Gui, bar:Color, 808080
Gui, bar:Margin, 0, 0
Gui, bar:Font, s14, Webdings
  Gui, bar:Add, Text, section y0 gback, 3
  Gui, bar:Add, Text, ys gforward, 4
Gui, bar:Font, s8, Tahoma
  Gui, bar:Add, Edit, y1 w480 R1 vaddress, loading...
Gui, bar:Font, s14, Webdings
  Gui, bar:Add, Text, ys gnavigate, a
  Gui, bar:Add, Text, ys ghome, 9 ;H ;ü
Gui, bar:Font, s8 bold, Webdings
  Gui, bar:Add, Text, % "section y-4 x" A_ScreenWidth-24 " w12 ghide", 0
  Gui, bar:Add, Text, ys xs+12 w12 gexit, r
Gui, bar:+Ownerwin

GoSub home
SetTimer, main, 50
return

home:
WB.Navigate("www.google.com")
return

#IfWinActive controlbar
enter::
navigate:
Gui, bar:Submit, NoHide
if !(lastURL=address)
  WB.Navigate(address)
else
  WB.refresh()
return

forward:
WB.goforward()
return

back:
WB.goback()
return

main:
MouseGetPos, x, y
if (y=A_ScreenHeight-1) ; for a basic and normal taskbar (nowingetsize)
  WinShow ahk_class Shell_TrayWnd
if (y<A_ScreenHeight-30) ; DV2ControlHost = rebel
  WinHide ahk_class Shell_TrayWnd
if (y=0)
  Gui, bar:Show, NA x0 y0 w%A_ScreenWidth%, controlbar
if (y>24)
  Gui, bar:Hide
if !(WB.locationURL=lastURL)
  GuiControl, bar:, address, % lastURL:=WB.locationURL

/*
log:= WB.readystate()
log:= log=0 ? "uninitialised" : log=1 ? "loading" : log=2 ? "loaded" : log=3 ? "interactive"
    : log=4 ? "complete" : "unknown"
log.= "`n" (WB.busy() ? "busy" : "ready")
tooltip % log ;WB.stop()
*/
return

hide:
SetTimer, main, Off
WinShow ahk_class Shell_TrayWnd
WinMinimize Tiny Explorer
return

winGuiSize:
if !(A_EventInfo=1)
  SetTimer, main, On
return

exit:
winGuiClose:
SetTimer, main, Off
WinShow ahk_class Shell_TrayWnd
exitapp

Edit: maybe this kind of apps already exists but I haven't found.
I found an half anwser at <!-- m -->http://www.autohotke... ... 917#416917<!-- m --> who was updated for ahk_L
"You annoy me, therefore I exist."

tank nli
  • Guests
  • Last active:
  • Joined: --

- Why "tab" (sometimes "enter" too) key doesn't work for to navigate inside a webpage who have the focus ? (+owner problem ? -tabstop option ?)

there is a comment in that link
;; necesary to accept enter and accelorator keys

- How disable javascript errordialogbox on some website ? (without to go to IE settings if possible)

and then there is this comment
;; disable annoying script errors from the page

- How disable warning or ahk error messagebox

i wonder what this would do
ComObjError(0)


Zaelia
  • Members
  • 754 posts
  • Last active: Jan 17 2015 02:38 AM
  • Joined: 31 Oct 2008
Thanks a lot tank, I'm new with COM and object so at this moment it is a soup. I started to work with the script of the link... It's not a problem to manage this great code, but hard to understand how this work exactly (that look like javascript for my noob spirit)...

It's still black magic for me, what I understand is:
- We watch WM_KEY and we use a kind of sendmessage for translate them (as dispatched) to a special address, but how and where to find information about this Vtable function and message struct ? NumGet(NumGet(1*pipa)+5*A_PtrSize)
- We need to create an interface (how we know it's {00000117-0000-0000-C000-000000000046} ?) and merge it with ComObjQuery into WB Vtable for to create a function (above, with pipa), that use complicated system and memory address...

I hoped to have very simple "use" when I saw Gui, Add, ActiveX
In all case, thanks again, I missed WB.silent := true and also I will start to work and try with ComObjError(0) or a better history managment.

Edit: I will check ComObjQuery() inside ahk helpfile too , I guess I will understand more with ahk example...
<!-- m -->http://l.autohotkey....ComObjQuery.htm<!-- m --> and I wonder why vtable() is not inside ahk.
Also, I found <!-- m -->http://maul-esel.git...rfaces.html<!-- m -->
"You annoy me, therefore I exist."

jethrow
  • Moderators
  • 2854 posts
  • Last active: May 17 2017 01:57 AM
  • Joined: 24 May 2009
@Zaelia - just realize, you're stepping in deep ... :wink:

- We watch WM_KEY and we use a kind of sendmessage ...

We're calling a Com Method.

... Vtable function ...

If you don't understand Vtable functions, here a great tutorial by maul.esel - COM interface tutorial

... how and where to find information about this Vtable function and message struct ?

From comments in the code, you can see we accessed the IOleInPlaceActiveObject interface. I specifically left the line in there which assigns the Com Method to the variable TranslateAccelerator. From the interface documentation, you can see this is one of the methods.

NumGet(NumGet(1*pipa)+5*A_PtrSize)

From the tutorial & the vTable() function, you should recognize this layout. We are accessing the 6th function on the vTable. You can find the vTable in the header file - OleIdl.h (search the page for IOleInPlaceActiveObjectVTBL)

- We need to create an interface (how we know it's {00000117-0000-0000-C000-000000000046} ?)

The interface already exists, we are just accessing it. The IID is also found in the IOleInPlaceActiveObject interface documentation.

Zaelia
  • Members
  • 754 posts
  • Last active: Jan 17 2015 02:38 AM
  • Joined: 31 Oct 2008
Thanks Jethrow, I have all anwsers before my eyes, I need time to digest all informations and put everything back in order... maul.esel tutorial is great, that solve my doubts about some hard code and why MSDN is not enough...
I already asked but hadn't time and I forgot, very sorry (and was for richedit stream text):
<!-- m -->http://www.autohotke...topic76564.html<!-- m -->

off-topic, curiosity, However in this tutorial:
- DllCall(fn, "Ptr", ptr) Why we give ptr again? fn can't know himself that he come from ptr ? in other word, If method are sorted, why the method don't search himself address of his interface ? inherit problem or maybe for more complicated feature ? it seems redundant.
- At the end of tutorial, they declare "class Any : Unknown", but what the syntax for call the first method after this ? object := New , object.firstmethod(param1) ? maybe add a line for to enlight noobs.
"You annoy me, therefore I exist."