AutoHotkey Community

It is currently May 26th, 2012, 4:48 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 309 posts ]  Go to page Previous  1 ... 9, 10, 11, 12, 13, 14, 15 ... 21  Next
Author Message
 Post subject:
PostPosted: March 23rd, 2008, 5:22 am 
I did changed it a little.
Code:
Gui, +Resize +LastFound
Gui, Show, w800 h600 Center, WebBrowser
hGui := WinExist()
OnMessage(WM_KEYDOWN:=0x0100, "WM_KEYDOWN")
COM_AtlAxWinInit()
pweb := COM_AtlAxCreateControl(hGui, "Shell.Explorer")
pipa := COM_QueryInterface(pweb, "{00000117-0000-0000-C000-000000000046}")
COM_Invoke(pweb, "Navigate", "http://www.google.com/")
Return

GuiClose:
Gui, Destroy
COM_Release(pipa)
COM_Release(pweb)
COM_AtlAxWinTerm()
ExitApp

WM_KEYDOWN(wParam, lParam, nMsg, hWnd)
{
;  Critical 20
  If  (wParam = 0x09 || wParam = 0x0D)
  {
      WinGetClass, Class, ahk_id %hWnd%
      If  (Class == "Internet Explorer_Server")
          {
             Global pipa
             VarSetCapacity(Msg, 28)
             NumPut(hWnd,Msg), NumPut(nMsg,Msg,4), NumPut(wParam,Msg,8), NumPut(lParam,Msg,12)
             NumPut(A_EventInfo,Msg,16), NumPut(A_GuiX,Msg,20), NumPut(A_GuiY,Msg,24)
             DllCall(NumGet(NumGet(1*pipa)+20), "Uint", pipa, "Uint", &Msg)
             Return 0
          }
  }
}


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 23rd, 2008, 1:59 pm 
Offline

Joined: September 21st, 2006, 10:04 pm
Posts: 32
Nicolas Bourbaki wrote:
I did changed it a little.
This is great! One change (to take "Del" key into account):
Code:
If  (wParam = 0x09 || wParam = 0x0D || wParam = 0x2E) ; tab, enter, del keys
And the IOleInPlaceActiveObject also lets us control some other things besides the TranslateAccelerator:
    ContextSensitiveHelp
    EnableModeless
    GetWindow
    OnDocWindowActivate
    OnFrameWindowActivate
    ResizeBorder

Thanks, Nicolas! :D


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 24th, 2008, 4:31 am 
paulwarr wrote:
If (wParam = 0x09 || wParam = 0x0D || wParam = 0x2E) ; tab, enter, del keys[/code]

I'm also using up/down arrow keys, whose vkcodes are 0x26/0x28. However, to make these to work properly must add one more OnMessage.
Code:
OnMessage(WM_KEYUP:=0x0101, "WM_KEYDOWN")


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 12th, 2008, 7:02 pm 
If I understand correctly, somebody compiled a Mozilla ActiveX Control v 2.0.1.1 (the original from here is v 1.7.1). If I'm mistaken, this is an ActiveX enabler for Mozilla, and not the Mozilla engine as an ActiveX. Can anybody confirm/deny this is what I hope it is (a later version of the ActivX control), and if so, if this version keeps working with the COM code?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 13th, 2008, 11:31 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
There was a request recently to suppress creating new IE windows from the embedded WebBrowser control in AHK. Here is one method, and other users may also find it useful.

PS. It needs the latest COM.ahk.

Code:
GoSub, GuiOpen
pweb1 := COM_AtlAxCreateControl(WinExist(), "Shell.Explorer")
pweb2 := COM_AtlAxCreateControl(WinExist(), "Shell.Explorer")
psink1:= COM_ConnectObject(pweb1, "Web_")
psink2:= COM_ConnectObject(pweb2, "Web_")
COM_Invoke(pweb1, "Silent", True)
COM_Invoke(pweb2, "Silent", True)

pweb  := pweb1
GoSub, Switch
COM_Invoke(pweb, "Navigate2", "http://www.google.com/")
Return

Switch:
WinShow, % "ahk_id " . COM_AtlAxGetContainer(pweb=pweb1 ? pweb1 : pweb2,1)
WinHide, % "ahk_id " . COM_AtlAxGetContainer(pweb=pweb2 ? pweb1 : pweb2,1)
Return

GuiOpen:
Gui, +Resize +LastFound
Gui, Show, w800 h600 Center, WebBrowser
COM_AtlAxWinInit()
Return
GuiClose:
COM_Release(psink1)
COM_Release(psink2)
COM_Release(pweb1)
COM_Release(pweb2)
Gui, Destroy
COM_AtlAxWinTerm()
ExitApp

Web_NewWindow2(prms, pres, psink)
{
   Global
   COM_AddRef(pweb:=NumGet(psink+12)<>pweb1 ? pweb1 : pweb2)
   COM_DispSetParam(pweb,prms,0,9)
   SetTimer, Switch, -10
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 14th, 2008, 2:15 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
If using OS >= XPSP2, can use NewWindow3 event which simplifies the procedure.

PS. There was an error (:misplaced ")") in COM_DispSetParam(). Please download again COM.ahk.

Code:
GoSub, GuiOpen
pweb :=   COM_AtlAxCreateControl(WinExist(), "Shell.Explorer")
psink:=   COM_ConnectObject(pweb, "Web_")
COM_Invoke(pweb, "Silent", True)
COM_Invoke(pweb, "Navigate2", "http://www.google.com/")
Return

Navigate:
COM_Invoke(pweb, "Navigate2", _URL_)
Return

GuiOpen:
Gui, +Resize +LastFound
Gui, Show, w800 h600 Center, WebBrowser
COM_AtlAxWinInit()
Return
GuiClose:
COM_Release(psink)
COM_Release(pweb)
Gui, Destroy
COM_AtlAxWinTerm()
ExitApp

Web_NewWindow3(prms)
{
   Global   _URL_:=   COM_DispGetParam(prms,4)
   COM_DispSetParam(-1,prms,1,11)
   SetTimer, Navigate, -10
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 25th, 2008, 5:03 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
n-l-i-d wrote:

Firefox 3 supports the IAccessible2 interface which extends MS's IAccessible. I suppose it's more powerful than the above.
http://support.mozilla.com/en-US/kb/New ... +Firefox+3
http://www.linuxfoundation.org/en/Acces ... ccessible2

The following tool is also of interest.
http://www.eclipse.org/actf/downloads/t ... /index.php


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 25th, 2008, 11:16 am 
@Sean: Thanks for the info! Very interesting stuff.

A true stand-alone browser option is still what I am looking for. Say I want to create a CD with a web-project presentation, which I can create for free, can be distributed (no copyleft issues), and works all-of-the-time out-of-the-box, I need atleast a:

- portable server
- portable php/mysql/perl (whatever you need for the project)
- portable modern browser

So far, I think the "old" Mozilla ActiveX is still the only option for Windows machines, but including FF3 could be a good alternative, if it is not "too modern" for older machines.

8)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 11th, 2008, 6:17 am 
Offline

Joined: June 26th, 2006, 6:14 pm
Posts: 1379
Location: USA
api for ie.ahk you can add to the file if you want.
Code:
/* api for ie.ahk
CGID_MSHTML( pwb, nCmd [ , nOpt ] )
IE_SendEMail( pwb )
IE_MakeDesktopShortcut( pwb )
IE_AddToFavorites( pwb )
IE_ViewSource( pwb )
IE_InternetOptions( pwb )
IE_DoFontSize( pwb, s )
IE_Find( pwb )
IE_SelectAll( pwb )
IE_Paste( pwb )
IE_Copy( pwb )
IE_Cut( pwb )
IE_Properties( pwb )
IE_PageSetup( pwb )
IE_PrintPreview( pwb )
IE_Print( pwb )
IE_SaveAs( pwb )
IE_Save( pwb )
IE_New( pwb )
IE_Open( pwb )
IE_ReadyState( pwb )
IE_SetStatusText( pwb [ , sText ] )
IE_GetStatusText( pwb )
IE_FullName( pwb )
IE_hWnd( pwb )
IE_Quit( pwb )
IE_Busy( pwb )
IE_GetUrl( pwb )
IE_GetTitle( pwb )
IE_Document( pwb )
IE_Stop( pwb )
IE_Refresh( pwb )
IE_GoSearch( pwb )
IE_GoHome( pwb )
IE_GoForward( pwb )
IE_GoBack( pwb )
IE_LoadHTML( pwb, h )
IE_LoadURL( pwb, u )
IE_Move( pwb, l, t, w, h )
IE_Add( hWnd, x, y, w, h )
IE_Term( )
IE_Init( )
*/

_________________
Image
ʞɔпɟ əɥʇ ʇɐɥʍ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 13th, 2008, 3:25 am 
Offline

Joined: June 7th, 2008, 12:54 pm
Posts: 2
Sean as per your pm reply i tried this way to include the referrer
But of no use..

Is i m doing any wrong in my syntax..

or is it not possible to spoof referrer..

Code:
sURL =   http://www.google.com
COM_Invoke(pweb, "Navigate", sURL, 0x1000, "", "", "Referer: yahoo
.com")


waiting for your reply.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 13th, 2008, 12:58 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
sumitallwin wrote:
Code:
sURL =   http://www.google.com
COM_Invoke(pweb, "Navigate", sURL, 0x1000, "", "", "Referer: yahoo
.com")

Why are you keeping specifying a non-trivial value to the second parameter? Where are you using this, iexplore.exe or WebBrowser control? Anyway, first test after setting it to zero, and I recommend Navigate2 over Navigate.
Code:
COM_Invoke(pweb, "Navigate2", "http://www.google.com/", 0, "", "", "Referer: http://www.yahoo.com/")

BTW, it works fine in my system.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 15th, 2008, 7:12 am 
Offline

Joined: June 7th, 2008, 12:54 pm
Posts: 2
Thanx sean for ur help..


I can now spoof the referrer..Ur trick works with both navigate and navigate2

But u asked why i hav some value for second parameter...It cos i m opening the link in a new background tab..


Code:
COM_Invoke(pweb, "Navigate2", "http://www.google.com/", 0x1000, "", "", "Referer: http://www.yahoo.com/")



And both navigate and navigate2 fails to send referrer if i open in new tab...Works only if i open in a same tab...means the second parameter is zero..I checked in my system..


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 15th, 2008, 8:56 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
sumitallwin wrote:
And both navigate and navigate2 fails to send referrer if i open in new tab...Works only if i open in a same tab...means the second parameter is zero..I checked in my system..
That's my point. If you open a new tab, it'll not be controlled by the original pweb, it'll be controlled by a new one, say pweb2, and the headers field may not be handed over to the new pweb2, and looks like really so. Although I don't know if it's an intended behavior or a design flaw, the solution is simple. First create a new tab, then obtain pweb2 for it and navigate with it.
Code:
COM_Invoke(pweb, "Navigate2", "about:blank", 0x1000)
; code to obtain pweb2 for the new tab
COM_Invoke(pweb2, "Navigate2", "http://www.google.com/", 0, "", "", "Referer: http://www.yahoo.com/")

There are several ways to obtain pweb2 for the new tab, and they were already posted in the forum, so you may search.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2008, 1:01 pm 
I found two "versions" of adding an IE control to a Gui.

Code:
pwb := COM_AtlAxGetControl(COM_AtlAxCreateContainer(WinExist(),0,0,600,400, "Shell.Explorer") )

which can place the control inside the window at specific size and coordinates
Code:
pweb := COM_AtlAxCreateControl(hGui, "Shell.Explorer")
pipa := COM_QueryInterface(pweb, "{00000117-0000-0000-C000-000000000046}")

which fills the entire Gui with the control

Only the second one however, responds to the tab/enter/delete/up/down keys with this:
Code:
WM_KEYDOWN(wParam, lParam, nMsg, hWnd)
{
;  Critical 20
tooltip % wparam
  ;If  (wParam = 0x09 || wParam = 0x0D || wParam = 0x2E || wParam = 0x26 || wParam = 0x28) ; tab enter delete up down
  If  (wParam = 9 || wParam = 13 || wParam = 46 || wParam = 38 || wParam = 40) ; tab enter delete up down
  {
      WinGetClass, Class, ahk_id %hWnd%
     
      If  (Class == "Internet Explorer_Server")
          {
             Global pipa
             VarSetCapacity(Msg, 28)
             NumPut(hWnd,Msg), NumPut(nMsg,Msg,4), NumPut(wParam,Msg,8), NumPut(lParam,Msg,12)
             NumPut(A_EventInfo,Msg,16), NumPut(A_GuiX,Msg,20), NumPut(A_GuiY,Msg,24)
             DllCall(NumGet(NumGet(1*pipa)+20), "Uint", pipa, "Uint", &Msg)
             Return 0
          }
  }
}


The necessary "pipa" variable is absent from the first example, which is why it doesn't work.

Now my question is: how can I create an IE control with specific dimensions (example 1), but still be able to use the keys (example 2), or in other words: how do I receive the "pipa" variable in the first example?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2008, 4:44 pm 
Well, I have a small Question concerning the "IE_LoadURL" Function, what I want to know is, is it possible to load an Url that exist's in an Var?
'Cause "IE_LoadUrl(pwb, "%MyVar%")" does not work for Me... :?

It would be great I someone could' answer. 8)

Thanks in Advance,
John.


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 309 posts ]  Go to page Previous  1 ... 9, 10, 11, 12, 13, 14, 15 ... 21  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: JamixZol and 10 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group