Jump to content


Photo

Embed an Internet Explorer control in your AHK Gui via COM


  • Please log in to reply
107 replies to this topic

#1 Sean

Sean
  • Members
  • 2462 posts

Posted 27 February 2007 - 02:46 PM

This is a standard library for IE/WebBrowser controls.

REDIRECT. IE.ahk is now retired. Code it using COM Standard Library.

(Note from moderator: This topic was originally part of <!-- m -->http://www.autohotke...pic.php?t=15885<!-- m -->. It was split off at the author's request.)

#2 daonlyfreez

daonlyfreez
  • Members
  • 995 posts

Posted 27 February 2007 - 06:51 PM

Brilliant! 8)

I found out that the Mozilla ActiveX can very easily be used too...

[color=red]GUID4String(CLSID_MozillaBrowser, "{1339B54C-3453-11D2-93B9-000000000000}")[/color]

   ;GUID4String(CLSID_WebBrowser, "{8856F961-340A-11D0-A96B-00C04FD705A2}")
   GUID4String(IID_IWebBrowser2, "{D30C1661-CDAF-11D0-8A3E-00C04FC9E26E}")

   hModule := DllCall("LoadLibrary", "str", "atl.dll")
   DllCall(DllCall("GetProcAddress", "Uint", hModule, "str", "AtlAxWinInit"))
   DllCall("FreeLibary", "Uint", hModule)

   hCtrl := DllCall("CreateWindowEx"
      , "Uint", 0x200            ; WS_EX_CLIENTEDGE
      , "str",  "AtlAxWin"         ; ClassName
      , "str",  [color=red]CLSID_MozillaBrowser[/color]      ; WindowName
      , "Uint", 0x10000000 | 0x40000000   ; WS_VISIBLE | WS_CHILD
      , "int",  x            ; Left

...


Just make sure you register the mozctlx.dll first...

8)

This is very good... Now one could use IE as default and add/download the Mozilla ActiveX if necessary.

#3 majkinetor

majkinetor
  • Fellows
  • 4511 posts

Posted 27 February 2007 - 07:11 PM

superb guys

#4 Sean

Sean
  • Members
  • 2462 posts

Posted 28 February 2007 - 07:13 AM

I modified it to accommodate UrlHistory. Please copy it again.

#5 Guests

  • Guests

Posted 28 February 2007 - 06:25 PM

Thanks a million for this. I think many AHK developers will find embedding a browser into their application useful.

#6 Guests

  • Guests

Posted 28 February 2007 - 07:39 PM

The new COM implementation more accurately grabs the Current URL via Gui_IEGetURL() - using lbbrowse3.dll I had mixed results...

One somewhat major problem I'm experiencing using the latest CoHelper.ahk and this new IE4AHK COM code is that the main scroll bar doesn't appear, and you can't use pageup/pagedown/arrowup/arrowdown to move arround inside the page.

Another smaller issue that exists in both versions of IE4AHK is that the enter key doesnt properly focus. For example, go to google.com by typing the address into the address bar. You have to click the 'Google Search' button, since enter just reloads the page.

Both of these problems exist with the latest version of AHK, IE4AHK, using IE 6.0.2900.2180 on XP SP2.

Thanks a lot for contributing this great work back to the AHK community.

#7 Sean

Sean
  • Members
  • 2462 posts

Posted 01 March 2007 - 12:04 AM

One somewhat major problem I'm experiencing using the latest CoHelper.ahk and this new IE4AHK COM code is that the main scroll bar doesn't appear, and you can't use pageup/pagedown/arrowup/arrowdown to move arround inside the page.

I think this part is easy to correct. I updated the script. The only change is:

, "Uint", 0x10000000 | 0x40000000 | 0x04200000   ; WS_VISIBLE | WS_CHILD | ...


#8 majkinetor

majkinetor
  • Fellows
  • 4511 posts

Posted 01 March 2007 - 08:27 AM

Wiki page:
<!-- m -->http://www.autohotke... ... M_Wrappers<!-- m -->

#9 Guests

  • Guests

Posted 01 March 2007 - 02:32 PM

One somewhat major problem I'm experiencing using the latest CoHelper.ahk and this new IE4AHK COM code is that the main scroll bar doesn't appear, and you can't use pageup/pagedown/arrowup/arrowdown to move arround inside the page.

I think this part is easy to correct. I updated the script. The only change is:

, "Uint", 0x10000000 | 0x40000000 | 0x04200000   ; WS_VISIBLE | WS_CHILD | ...


Thanks Sean, this fixed the scroll bar issues.

#10 Sean

Sean
  • Members
  • 2462 posts

Posted 05 March 2007 - 10:18 AM

I modified the script using indirections like Shell.Explorer and IID_IDispatch.
Although there is no difference in features, I recommend updating to it.

#11 vlcek

vlcek
  • Members
  • 339 posts

Posted 11 March 2007 - 05:34 PM

Good program. Bat. I can't open any internet address. Please Help

#12 Guests

  • Guests

Posted 11 March 2007 - 09:19 PM

vicek - IE4AHK will use your IE connection settings, so if one works so should the other :) Maybe temporarily disabling your software firewall will help.

Sean - I'd really like to see a New > Window button in the IE4AHK interface. This opens a new window, but without spawning another process. Do you know of a way to do this with COM? I can post some GUI code for adding the button.

#13 Sean

Sean
  • Members
  • 2462 posts

Posted 12 March 2007 - 12:51 AM

Sean - I'd really like to see a New > Window button in the IE4AHK interface. This opens a new window, but without spawning another process. Do you know of a way to do this with COM? I can post some GUI code for adding the button.

It looks like not a COM problem, may be done by creating another GUI and start a new WebControl. Store them as (pweb1, hCtrol1), (pweb2, hCtrl2), etc and switch (pweb, hCtrl) to appropriate one among them whenever one of the GUI's becomes active.
Or, might simulate multi-tab features by creating multi WebControls in a single GUI, however, I'm not sure if there will be no glitch at all.

#14 vlcek

vlcek
  • Members
  • 339 posts

Posted 12 March 2007 - 06:04 AM

Graphics button can't read my screenreader. I open any web page, but i can't read this. I'm blind. I Programming in autohotkey, but I can't programming any graphics button. Thank.

#15 Sean

Sean
  • Members
  • 2462 posts

Posted 13 March 2007 - 12:08 AM

I updated the script as to now depend solely on pwb, no need to save hCtrl separately which is now derived from pwb.
So, if using multiple WebControls, only need to store pwb1, pwb2, etc.
I may add further a function to reverse the process, i.e. retrieving pwb from hCtrl if there is a demand.