AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Embed an Internet Explorer control in your AHK Gui via COM
Goto page Previous  1, 2, 3 ... 9, 10, 11, 12  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Jero3n



Joined: 19 Jan 2007
Posts: 151

PostPosted: Fri Jan 25, 2008 8:36 pm    Post subject: Reply with quote

tank wrote:
i mean it i really am a villiage idiot
but wow dude read the freaking manual even wtf i did of course :S
Quote:

After creating a Tab control, subsequently added controls automatically belong to its first tab. This can be changed at any time by following these examples:

Gui, Tab ; Future controls are not part of any tab control.
Gui, Tab, 3 ; Future controls are owned by the third tab of the current tab control.
Gui, Tab, 3, 2 ; Future controls are owned by the third tab of the second tab control.
Gui, Tab, Name ; Future controls are owned by the tab whose name starts with Name (not case sensitive).
Gui, Tab, Name,, Exact ; Same as above but requires exact match (case sensitive too).

straight out of the freaking help file for tabs
so your problem is this
Code:


#Include IE.ahk

Gui, Add, Tab2, w1000 h1000, Tab1|Tab2|Tab3
Gui, Tab, 1
Gosub, GuiOpen
Gui, +Resize +LastFound
Gui, Show, Autosize Center, Fusion 0.1a

hGui:= WinExist()
pwb := IE_Add(hGui, +20, 30, 780, 580)
IE_LoadURL(pwb, "http://nuclearfamily.soft.nl/")

GuiOpen:
IE_Init()
Return

GuiClose:
Gui, Destroy
COM_Release(pwb)
IE_Term()
ExitApp


But this isn't working also Sad
Back to top
View user's profile Send private message
ahklerner



Joined: 26 Jun 2006
Posts: 1213
Location: USA

PostPosted: Fri Jan 25, 2008 8:49 pm    Post subject: Reply with quote

here is a quick example.....i can post a better one later sometime.....
Code:
#Include IEControl.ahk ; + CoHelper.ahk!
OnExit, WebTerminate
SetTitleMatchMode, 2

W := A_ScreenWidth-100
H := A_ScreenHeight-100
WinTitle = TabTest

GUI:
   Gui +0x2000000 +Lastfound
   Gui Margin, 0, 0
   Gui, Add, Tab, h25 w%W% gMyTab vSelTab, IE1|IE2
   Gui, Show, h%H% w%W%, %WinTitle%
   GoSub, WebInit
   Return
   
WebInit:
   GoSub, GuiStart
   pwb1 := IE_Add(WinExist(), 0, 25, w, h - 25)
   pwb2 := IE_Add(WinExist(), 0, 25, w, h - 25)
   OldhWnd := IE1 := GetHostWindow(pwb1)
   IE2 := GetHostWindow(pwb2)
   IE_LoadURL(pwb1, "http://www.google.com")
   IE_LoadURL(pwb2, "http://www.yahoo.com")
   WinHide, ahk_id %IE2%
   
   GuiStart:
      AtlAxWinInit()
      CoInitialize()
      Return
   Return
MyTab:
Gui, Submit, NoHide
WinHide, % "ahk_id " .  OldhWnd
WinShow, % "ahk_id " .  %SelTab%
OldhWnd := %SelTab%
   return
   
   
GuiClose:
WebTerminate:
Gui, Destroy
      Release(pwb)
      CoUninitialize()
      AtlAxWinTerm()
      ExitApp

_________________
Back to top
View user's profile Send private message
Jero3n



Joined: 19 Jan 2007
Posts: 151

PostPosted: Fri Jan 25, 2008 8:52 pm    Post subject: Reply with quote

Wow thanks Very Happy
Oh and here is the rewritten version for IE.ahk, maybe some people wants it:

Code:

#Include IE.ahk
OnExit, WebTerminate
SetTitleMatchMode, 2

W := A_ScreenWidth-100
H := A_ScreenHeight-100
WinTitle = TabTest

GUI:
   Gui +0x2000000 +Lastfound
   Gui Margin, 0, 0
   Gui, Add, Tab, h25 w%W% gMyTab vSelTab, IE1|IE2
   Gui, Show, h%H% w%W%, %WinTitle%
   GoSub, WebInit
   Return
   
WebInit:
   GoSub, GuiStart
   pwb1 := IE_Add(WinExist(), 0, 25, w, h - 25)
   IE_LoadURL(pwb1, "http://www.google.com")
   GuiStart:
   IE_Init()
      Return
   Return
MyTab:
Gui, Submit, NoHide
WinHide, % "ahk_id " .  OldhWnd
WinShow, % "ahk_id " .  %SelTab%
OldhWnd := %SelTab%
   return
   
   
GuiClose:
WebTerminate:
Gui, Destroy
COM_Release(pwb)
IE_Term()
ExitApp
Back to top
View user's profile Send private message
ahklerner



Joined: 26 Jun 2006
Posts: 1213
Location: USA

PostPosted: Fri Jan 25, 2008 8:53 pm    Post subject: Reply with quote

tank wrote:
Ok so far i havent found a way via any AHK to access the DOM
But as i work with DOM
Ill offer soemthing I got this elsewhere in the forums in various places i dont recall it being all put together this way. as an entire post

Code:

#Include acc.ahk
#Include com.ahk
IE_InjectJS(hWnd_MainWindow, JS_to_Inject, VarNames_to_Return="")
   {
   ;Get a list of the hWnd's owned by the window specified
   WinGet, ActiveControlList, ControlListhWnd, ahk_id %hWnd_MainWindow%
   ;Go throught the list 1 at a time to determine if it is the correct control
   ;This will allow the script to find the current tab in IE7
   Loop, Parse, ActiveControlList, `n
      {
      ;Get the classname of the current control
      WinGetClass, ThisWinClass, ahk_id %A_LoopField%
      ;If the classname is correct and it is visible, it is the correct tab
      If (ThisWinClass = "Internet Explorer_Server") and (DllCall("IsWindowVisible", UInt, A_LoopField))
       hIESvr := A_LoopField
      }
   ;If a control was not found, give a message and return, doing nothing   
   If !hIESvr
      {
      MsgBox, Control "Internet Explorer_Server" not found.
      Return
      }
   ;Initialize the COM interface. code modified from SEAN
   IID_IHTMLWindow2   := "{332C4427-26CB-11D0-B483-00C04FD90119}"
   ACC_Init()
   pacc := ACC_AccessibleObjectFromWindow(hIESvr)
   pwin := COM_QueryService(pacc,IID_IHTMLWindow2,IID_IHTMLWindow2)
   COM_Release(pacc)
   ;Execute the Javascript (if there is any). Thanks LEXIKOS.
   If JS_to_Inject
      COM_Invoke(pwin, "execscript", JS_to_Inject)
   ;Get the value of the variables, if any.
   If VarNames_to_Return {
      ;Split the passed variable names into a psuedo array of ahk variables
      StringSplit, Vars_, VarNames_to_Return, `,
      ;Get the value of each javascript variable in the order it was passed
      Loop, %Vars_0%
         Ret .= COM_Invoke(pwin,Vars_%A_Index%) . ","
      ;Remove the trailing comma
      StringTrimRight, Ret, Ret, 1
      }
   ; Cleanup
   COM_Release(pwin)
   ACC_Term()
   ;Return a comma seperated list of variables in the order they were passed
   Return Ret
   }



And usage would be like this
Code:

AHKvar:=IE_InjectJS(WinExist("wintitle"), "javascript:var x=document.getElementsByTagName(""td"");var jsvar=x[0].innerHTML;","jsvar")
msgbox % AHKvar


basically any javascripting that can be saved in one line can be executed this way on any window



That is my code.
http://www.autohotkey.com/forum/viewtopic.php?t=25473
I am going to stop posting on the forum too, i think.
Evil or Very Mad
_________________
Back to top
View user's profile Send private message
tank



Joined: 21 Dec 2007
Posts: 679

PostPosted: Sat Jan 26, 2008 11:25 pm    Post subject: Reply with quote

Hey ahklerner
Im sorry, if you read that i said in that post i found else where and i couldnt remember where later when someone told me who it was i geve the kudo's
I just tagged it in in a related post
man Im sorry ill post anywhere you want each time i talk about it now i post that its your work
tell me how i can atone with you on this and ill do it
i wasnt trying to steal anything from you
in short please accept the apology of a villiage idiot if i have offended you in any way
_________________
Read this
Com
Automate IE7 with Tabs
Back to top
View user's profile Send private message
ahklerner



Joined: 26 Jun 2006
Posts: 1213
Location: USA

PostPosted: Sun Jan 27, 2008 12:01 am    Post subject: Reply with quote

its ok....lots of people are starting to do it lately, though....just is kind of annoying.
_________________
Back to top
View user's profile Send private message
tank



Joined: 21 Dec 2007
Posts: 679

PostPosted: Sun Jan 27, 2008 7:02 am    Post subject: Reply with quote

really its not ok but i appreciate your politeness
it was very wrong of me
_________________
Read this
Com
Automate IE7 with Tabs
Back to top
View user's profile Send private message
Jero3n



Joined: 19 Jan 2007
Posts: 151

PostPosted: Fri Feb 01, 2008 9:39 pm    Post subject: Reply with quote

I have another problem with it... Sad
I have 2 (and later more) gui windows, the 'main' window, with tabs, and some other windows like properties etc.
In the main window, I want to embed an ie control, but I can't get it working :S
Someone knows how I can do this?
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 5893

PostPosted: Sun Feb 17, 2008 9:10 pm    Post subject: Reply with quote

Dear daonlyfreez, Smile

Re: Your post : http://www.autohotkey.com/forum/viewtopic.php?p=108004#108004 at the very beginning of this topic.

Redundant quote removed.

Can you please show me how to include a web control based on Mozilla ActiveX ?
I have already installed Mozilla ActiveX Control and have been reading through various topics but could not find any working code.

My requirement is very simple: I pass a url to the script and I get a full sized control displaying the contents - no buttons or any other controls required!.
And so, I would like it to run without any dependent wrapper.

Please help.

Regards, Smile


Last edited by SKAN on Thu Feb 21, 2008 9:14 pm; edited 1 time in total
Back to top
View user's profile Send private message
daniel2



Joined: 23 Jul 2007
Posts: 41

PostPosted: Wed Feb 20, 2008 10:29 pm    Post subject: Reply with quote

Sean wrote:
Quote:
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:

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

Is there a easy way to remove the scrollbar if you don't want it? I thought I saw a post for this a long time ago, but cannot seem to find it anywhere in this topic!
Back to top
View user's profile Send private message
Guest






PostPosted: Thu Feb 21, 2008 1:49 pm    Post subject: Reply with quote

daniel2 wrote:
Code:
, "Uint", 0x10000000 | 0x40000000 | 0x04200000   ; WS_VISIBLE | WS_CHILD | ...

Is there a easy way to remove the scrollbar if you don't want it? I thought I saw a post for this a long time ago, but cannot seem to find it anywhere in this topic![/quote]
WS_VSCROLL is 0x00200000 (WS_HSCROLL is 0x00100000). So, you can replace 0x04200000 with 0x04000000 if you don't want the scrollbar.
Back to top
Guest






PostPosted: Thu Feb 21, 2008 1:53 pm    Post subject: Reply with quote

SKAN wrote:
My requirement is very simple: I pass a url to the script and I get a full sized control displaying the contents - no buttons or any other controls required!.

You may replace "Shell.Explorer" with "Mozilla.Browser" in all of the examples, like:
Code:
COM_AtlAxCreateContainer(hWnd, 0, 0, 800, 600, "Mozilla.Browser")
Back to top
SKAN



Joined: 26 Dec 2005
Posts: 5893

PostPosted: Thu Feb 21, 2008 9:16 pm    Post subject: Reply with quote

Anonymous wrote:
You may replace "Shell.Explorer" with "Mozilla.Browser" in all of the examples


Thanks! I wanted to avoid the wrapper, but this is an useful hint.

Smile
Back to top
View user's profile Send private message
heresy



Joined: 11 Mar 2008
Posts: 291

PostPosted: Sun Mar 16, 2008 5:43 pm    Post subject: Losing Enterkey in embeded Internet Explorer Reply with quote

firstly, i don't know how to use COM
but i found this neat module(?) which makes everyone can put IE in gui
it shows well. but i'm having some weird problem.

what i am trying to do is putting chat room in gui using gabbly.com

1) embed IE into gui
2) embed gabbly.com chat wizet into embeded IE in gui
3) it works!
4) but the {Enter} key doesn't working in embeded IE
i can't even send a word, i can't communicate :<

i've tested with all kind of these web based chat module
and nothing works in embeded IE
hope someone could solve it

below are my simple codes
Code:
<body leftmargin='0' topmargin='0'>
<iframe src='http://cw.gabbly.com/gabbly/cw.jsp?e=1&t=blank&pw=0&priv=on' scrolling='no' style='width:100%; height:100%' frameborder='0'></iframe>

gabbly.html in local

Code:
#Include IE.ahk
OnExit, WebTerminate
SetTitleMatchMode, 2

GUI:
   Gui +0x2000000 +Lastfound
   Gui Margin, 0, 0
   Gui, Show, Center w640 h480, Gabbly Test
   GoSub, WebInit
   Return
   
WebInit:
Gosub, GuiStart
   pwb1 := IE_Add(WinExist(), 0, 0, 640, 480 - 25)
   IE_LoadURL(pwb1, "gabbly.html")
GuiStart:
   IE_Init()
Return
Return
   
GuiClose:
WebTerminate:
Gui, Destroy
COM_Release(pwb)
IE_Term()
ExitApp

pulling gabbly.html from local then it shows gabbly chat room
but the {Enter} key doesn't works....
Back to top
View user's profile Send private message
paulwarr



Joined: 21 Sep 2006
Posts: 30

PostPosted: Wed Mar 19, 2008 9:13 pm    Post subject: Re: Losing Enterkey in embeded Internet Explorer Reply with quote

heresy wrote:
4) but the {Enter} key doesn't working in embeded IE
i can't even send a word, i can't communicate :<

The failure of {tab} and {enter} keys (among others) to work as expected is a known problem for WebBrowser controls that are hosted within ATL or MFC applications. The outer GUI (within which the internet explorer window is embedded) has the focus for these keystrokes. See, for example:While googling, I found bits and pieces of C and VB code about that solve this (intercepting the keystrokes passed to the parent window and passing them back to the WebBrowser control using TranslateAccelerator). But I'm unaware of anyone who's solved this problem in AHK.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3 ... 9, 10, 11, 12  Next
Page 10 of 12

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group