 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Nicolas Bourbaki Guest
|
Posted: Sun Mar 23, 2008 5:22 am Post subject: |
|
|
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
}
}
}
|
|
|
| Back to top |
|
 |
paulwarr
Joined: 21 Sep 2006 Posts: 30
|
Posted: Sun Mar 23, 2008 1:59 pm Post subject: |
|
|
| 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!  |
|
| Back to top |
|
 |
Guest
|
Posted: Mon Mar 24, 2008 4:31 am Post subject: |
|
|
| 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") |
|
|
| Back to top |
|
 |
n-l-i-d Guest
|
Posted: Mon May 12, 2008 7:02 pm Post subject: |
|
|
| 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? |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1336
|
Posted: Fri Jun 13, 2008 11:31 am Post subject: |
|
|
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
}
|
|
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1336
|
Posted: Sat Jun 14, 2008 2:15 am Post subject: |
|
|
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
}
|
|
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1336
|
|
| Back to top |
|
 |
n-l-i-d Guest
|
Posted: Wed Jun 25, 2008 11:16 am Post subject: |
|
|
@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.
 |
|
| Back to top |
|
 |
ahklerner
Joined: 26 Jun 2006 Posts: 1205 Location: USA
|
Posted: Fri Jul 11, 2008 6:17 am Post subject: |
|
|
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( )
*/
|
_________________
 |
|
| Back to top |
|
 |
sumitallwin
Joined: 07 Jun 2008 Posts: 2
|
Posted: Wed Aug 13, 2008 3:25 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1336
|
Posted: Wed Aug 13, 2008 12:58 pm Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
sumitallwin
Joined: 07 Jun 2008 Posts: 2
|
Posted: Fri Aug 15, 2008 7:12 am Post subject: |
|
|
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.. |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1336
|
Posted: Fri Aug 15, 2008 8:56 am Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|