AutoHotkey Community

It is currently May 27th, 2012, 10:23 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 12 posts ] 
Author Message
PostPosted: August 8th, 2007, 3:55 am 
Hello, could someone please see where I am missing some logic in the first block? IT should initatilize 3 sub-windows.... if you click OPEN you will see the 1,2 work... but with my 3rd seems to break when loading. Can you see where the problem is? :)

Code:

  ; ---------------·-------------- Init
  ; Settings
  #NoEnv
  SendMode Input
  SetBatchLines, -1
 
  OnExit, ByeBye
 
  ; ---------------·-------------- Includes before
 
  #Include Gui_BrwsControl.ahk
 
  ; ---------------·--------- Variables
 
 
  ; ---------------·--------------- Gui
 
 
  Gui, +LastFound
   mgH := WinExist()

  Brws_Init()
   Brws_Add(mgH, 1, 0, 10, 10, 300, 400, "about:blank")
   Brws_Add(mgH, 2, 0, 320, 10, 300, 400, "about:blank")
        Brws_Add(mgH, 3, 0, 630, 10, 300, 400, "about:blank")


  Gui, Add, Button, x10  y420 w60 h22 gB1, Open
  Gui, Add, Button,      y420 w60 h22 gB2, Home
  Gui, Add, Button,      y420 w60 h22 gB3, Info
  Gui, Add, Button,      y420 w60 h22 gB4, Prop
 
  Gui, Add, Button, x320 y420 w60 h22 gB5, Open
  Gui, Add, Button,      y420 w60 h22 gB6, Home
  Gui, Add, Button,      y420 w60 h22 gB7, Info
  Gui, Add, Button,      y420 w60 h22 gB8, Prop

  Gui, Add, Button, x630 y420 w60 h22 gB9, Open
  Gui, Add, Button,      y420 w60 h22 gB10, Home
  Gui, Add, Button,      y420 w60 h22 gB11, Info
  Gui, Add, Button,      y420 w60 h22 gB12, Prop

  Gui, Show, w960 h480, 3 Browsercontrols?
 
 
 
  ; ---------------·-------------- Flow
 
  ;XXX
 
 
 
 
  ; /AutoExecute
Return


; -----------------·-------------------·-------------------·---------- Routines

B1:
Brws_LoadURL(1, "http://www.autohotkey.com/support/")
Return

B2:
Brws_GoHome(1)
Return

B3:
curT := Brws_GetTitle(1)
curU := Brws_GetUrl(1)
msgbox % curT . "`n`n" . curU
Return

B4:
Brws_Properties(1)
Return

B5:
Brws_LoadURL(2, "http://www.autohotkey.com/forum/")
Return

B6:
Brws_GoHome(2)
Return

B7:
curT := Brws_GetTitle(2)
curU := Brws_GetUrl(2)
msgbox % curT . "`n`n" . curU
Return

B8:
Brws_Properties(2)
Return

B9:
Brws_LoadURL(3, "http://www.autohotkey.com/docs/")
Return

B10:
Brws_GoHome(3)
Return

B11:
curT := Brws_GetTitle(3)
curU := Brws_GetUrl(3)
msgbox % curT . "`n`n" . curU
Return

B12:
Brws_Properties(3)
Return


; -----------------·----------- ExitApp
ByeBye:
GuiClose:
GuiEscape:
  ; ------- Cleanup
 
  Brws_Cleanup(3)


  ExitApp
Return


; -----------------·-------------------·-------------------·----------- Hotkeys

; -----------------·------------ Reload
  ; for debugging 
  !r::Reload


; -----------------·-------------------·-------------------·---------- Includes

;#Include XXX

; -----------------·-------------------·-------------------·--------------- End






you also need this

Code:

Brws_Init()
{
  CoInitialize()
}

; mgH = main gui handle (handle of the gui to attach the control to)
; i = index (the index of the control, as number)
; t = type (default and 0: Internet Explorer, use t = 1 for Mozilla ActiveX)
; x,y,w,h = control position and size in gui
; u = url to load (default: empty page)

Brws_Add(mgH, i, t, x, y, w, h, u)
{
  Global pwb1, hCtrl1, pwb2, hCtrl2
 

 
  If (t=1) ; User wants Mozilla ActiveX
  {
    If Brws_CheckMozActiveX() ; ActiveX is installed
      GUID4String(CLSID_WebBrowser, "{1339B54C-3453-11D2-93B9-000000000000}")
  }
  Else ; Internet Explorer
    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%i% := DllCall("CreateWindowEx"
    , "Uint", 0x200            ; WS_EX_CLIENTEDGE
    , "str",  "AtlAxWin"         ; ClassName
    , "str",  CLSID_WebBrowser      ; WindowName
    , "Uint", 0x10000000 | 0x40000000 | 0x04200000   ; WS_VISIBLE | WS_CHILD | ...
    , "int",  x            ; Left
    , "int",  y            ; Top
    , "int",  w            ; Width
    , "int",  h            ; Height
    , "Uint", mgH            ; hWndParent
    , "Uint", 0            ; hMenu
    , "Uint", 0            ; hInstance
    , "Uint", 0)
 
  DllCall("atl\AtlAxGetControl", "Uint", hCtrl%i%, "UintP", punk)
  pwb%i% := QueryInterface(punk, IID_IWebBrowser2)
  Release(punk)
 
  Brws_LoadURL(i, u)
  Return pwb%i%
}

Brws_CheckMozActiveX()
{

Return true ; test

}



Brws_Move(i, x, y, w, h)
{
   Global hCtrl1, hCtrl2
   if (i=1)
      thisC := hCtrl1
   if (i=2)
      thisC := hCtrl2
   WinMove, ahk_id %thisC%, , x, y, w, h
}

Brws_LoadURL(i, u)
{
   Global pwb1, pwb2
   Ansi2Unicode(u, wUrl)
   DllCall(VTable(pwb%i%, 11), "Uint", pwb%i%, "str", wUrl, "Uint", 0, "Uint", 0, "Uint", 0, "Uint", 0)
}

Brws_GoBack(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 7), "Uint", pwb%i%)
}

Brws_GoForward(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 8), "Uint", pwb%i%)
}

Brws_GoHome(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 9), "Uint", pwb%i%)
}

Brws_GoSearch(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 10), "Uint", pwb%i%)
}

Brws_GoRefresh(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 12), "Uint", pwb%i%)
}

Brws_GoStop(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 14), "Uint", pwb%i%)
}

Brws_GetTitle(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 29), "Uint", pwb%i%, "UintP", pName)
   Unicode2Ansi(pName, sName)
   SysFreeString(pName)
   Return sName
}

Brws_GetURL(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 30), "Uint", pwb%i%, "UintP", pUrl)
   Unicode2Ansi(pUrl, sUrl)
   SysFreeString(pUrl)
   Return sUrl
}

Brws_Visible(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 40), "Uint", pwb%i%, "intP", bVis)
   DllCall(VTable(pwb%i%, 41), "Uint", pwb%i%, "int" , bVis ^ 1)
}

Brws_Offline(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 47), "Uint", pwb%i%, "intP", bOff)
   DllCall(VTable(pwb%i%, 48), "Uint", pwb%i%, "int" , bOff ^ 1)
}

Brws_Open(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 54), "Uint", pwb%i%, "Uint", 1, "Uint", 0, "Uint", 0, "Uint", 0)
}

Brws_New(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 54), "Uint", pwb%i%, "Uint", 2, "Uint", 0, "Uint", 0, "Uint", 0)
}

Brws_Save(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 54), "Uint", pwb%i%, "Uint", 3, "Uint", 0, "Uint", 0, "Uint", 0)
}

Brws_SaveAs(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 54), "Uint", pwb%i%, "Uint", 4, "Uint", 0, "Uint", 0, "Uint", 0)
}

Brws_Print(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 54), "Uint", pwb%i%, "Uint", 6, "Uint", 0, "Uint", 0, "Uint", 0)
}

Brws_PrintPreview(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 54), "Uint", pwb%i%, "Uint", 7, "Uint", 0, "Uint", 0, "Uint", 0)
}

Brws_PageSetup(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 54), "Uint", pwb%i%, "Uint", 8, "Uint", 0, "Uint", 0, "Uint", 0)
}

Brws_Properties(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 54), "Uint", pwb%i%, "Uint", 10, "Uint", 0, "Uint", 0, "Uint", 0)
}

Brws_Cut(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 54), "Uint", pwb%i%, "Uint", 11, "Uint", 0, "Uint", 0, "Uint", 0)
}

Brws_Copy(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 54), "Uint", pwb%i%, "Uint", 12, "Uint", 0, "Uint", 0, "Uint", 0)
}

Brws_Paste(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 54), "Uint", pwb%i%, "Uint", 13, "Uint", 0, "Uint", 0, "Uint", 0)
}

Brws_SelectAll(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 54), "Uint", pwb%i%, "Uint", 17, "Uint", 0, "Uint", 0, "Uint", 0)
}

Brws_Find(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 54), "Uint", pwb%i%, "Uint", 32, "Uint", 0, "Uint", 0, "Uint", 0)
}

Brws_DoFontSize(i, s)
{
   Global pwb1, pwb2
   VarSetCapacity(var, 8 * 2)
   EncodeInteger(&var + 0, 3)
   EncodeInteger(&var + 8, s - 1)
   DllCall(VTable(pwb%i%, 54), "Uint", pwb%i%, "Uint", 19, "Uint", 2, "Uint", &var, "Uint", &var)
}

Brws_InternetOptions(i)
{
   CGID_MSHTML(i, 2135)
}

Brws_ViewSource(i)
{
   CGID_MSHTML(i, 2139)
}

Brws_AddToFavorites(i)
{
   CGID_MSHTML(i, 2261)
}

Brws_MakeDesktopShortcut(i)
{
   CGID_MSHTML(i, 2266)
}

Brws_SendEMail(i)
{
   CGID_MSHTML(i, 2288)
}

Brws_ClearHistory()
{
/*
   GUID4String( CLSID_CUrlHistory, "{3C374A40-BAE4-11CF-BF7D-00AA006946EE}")
   GUID4String(IID_IUrlHistoryStg, "{3C374A41-BAE4-11CF-BF7D-00AA006946EE}")
   puh := CreateObject(CLSID_CUrlHistory, IID_IUrlHistoryStg)
   DllCall(VTable(puh, 9), "Uint", puh)
   DllCall(VTable(puh, 2), "Uint", puh)
*/
   Brws_GetHistory(1)
}

Brws_GetHistory(bDelete = 0)
{
   GUID4String( CLSID_CUrlHistory, "{3C374A40-BAE4-11CF-BF7D-00AA006946EE}")
   GUID4String(IID_IUrlHistoryStg, "{3C374A41-BAE4-11CF-BF7D-00AA006946EE}")

   puh := CreateObject(CLSID_CUrlHistory, IID_IUrlHistoryStg)

   DllCall(VTable(puh, 7), "Uint", puh, "UintP", psu)

   VarSetCapacity(var, 40)
   EncodeInteger(&var, VarSetCapacity(var))
   
   Loop
   {
      If DllCall(VTable(psu, 3), "Uint", psu, "Uint", 1, "Uint", &var, "Uint", 0)
         Break

      pUrl   := DecodeInteger(&var + 4)
      pTitle := DecodeInteger(&var + 8)

      If !bDelete
      {
         Unicode2Ansi(pUrl  , sUrl  )
         Unicode2Ansi(pTitle, sTitle)
         sHistory .= sUrl . "|" . sTitle . "`n"
      }
      Else
         DllCall(VTable(puh, 4), "Uint", puh, "Uint", pUrl, "Uint", 0)

      SysFreeString(pUrl  )
      SysFreeString(pTitle)
   }

   DllCall(VTable(psu, 2), "Uint", psu)
   DllCall(VTable(puh, 2), "Uint", puh)

   Return sHistory
}

Brws_Cleanup(nr)
{
  Loop %nr%
    Release(pwb%A_Index%)
  CoUninitialize()
}

CGID_MSHTML(i, nCmd, nOpt = 0)
{
   Global pwb1, pwb2
   GUID4String(CGID_MSHTML          , "{DE4BA900-59CA-11CF-9592-444553540000}")
   GUID4String(IID_IOleCommandTarget, "{B722BCCB-4E68-101B-A2BC-00AA00404770}")
   pct := QueryInterface(pwb%i%, IID_IOleCommandTarget)
   DllCall(VTable(pct, 4), "Uint", pct, "str", CGID_MSHTML, "Uint", nCmd, "Uint", nOpt, "Uint", 0, "Uint", 0)
   Release(pct)
}

#Include CoHelper.ahk




Finally, this requires the UPDATED CoHelper.ahk, so please re-copy it. [/url]


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 8th, 2007, 6:01 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Add the following at the start of the script.
You don't have to declare Global for pwb1 etc inside the functions, then.

Code:
Loop, 3
  pwb%A_Index%:=0, hCtrl%A_Index%:=0


BTW, you used a very old version of Gui_IE.ahk.
I recommend updating to the more recent IEControl.ahk, or using Invoke() instead without any wrapper, as there is a bug with the old Gui_IE although it doesn't affect the results.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 8th, 2007, 8:01 am 
Code:
Loop, 3
  pwb%A_Index%:=0, hCtrl%A_Index%:=0

Brws_Init()
{
  CoInitialize()
}

; mgH = main gui handle (handle of the gui to attach the control to)
; i = index (the index of the control, as number)
; t = type (default and 0: Internet Explorer, use t = 1 for Mozilla ActiveX)
; x,y,w,h = control position and size in gui
; u = url to load (default: empty page)

Brws_Add(mgH, i, t, x, y, w, h, u)
{

 
 
  If (t=1) ; User wants Mozilla ActiveX
  {
    If Brws_CheckMozActiveX() ; ActiveX is installed
      GUID4String(CLSID_WebBrowser, "{1339B54C-3453-11D2-93B9-000000000000}")
  }
  Else ; Internet Explorer
    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%i% := DllCall("CreateWindowEx"
    , "Uint", 0x200            ; WS_EX_CLIENTEDGE
    , "str",  "AtlAxWin"         ; ClassName
    , "str",  CLSID_WebBrowser      ; WindowName
    , "Uint", 0x10000000 | 0x40000000 | 0x04200000   ; WS_VISIBLE | WS_CHILD | ...
    , "int",  x            ; Left
    , "int",  y            ; Top
    , "int",  w            ; Width
    , "int",  h            ; Height
    , "Uint", mgH            ; hWndParent
    , "Uint", 0            ; hMenu
    , "Uint", 0            ; hInstance
    , "Uint", 0)
 
  DllCall("atl\AtlAxGetControl", "Uint", hCtrl%i%, "UintP", punk)
  pwb%i% := QueryInterface(punk, IID_IWebBrowser2)
  Release(punk)
 
  Brws_LoadURL(i, u)
  Return pwb%i%
}

Brws_CheckMozActiveX()
{

Return true ; test

}



Brws_Move(i, x, y, w, h)
{
   WinMove, ahk_id hCtrl%A_Index%, , x, y, w, h
}

Brws_LoadURL(i, u)
{
   Global pwb1, pwb2
   Ansi2Unicode(u, wUrl)
   DllCall(VTable(pwb%i%, 11), "Uint", pwb%i%, "str", wUrl, "Uint", 0, "Uint", 0, "Uint", 0, "Uint", 0)
}

Brws_GoBack(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 7), "Uint", pwb%i%)
}

Brws_GoForward(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 8), "Uint", pwb%i%)
}

Brws_GoHome(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 9), "Uint", pwb%i%)
}

Brws_GoSearch(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 10), "Uint", pwb%i%)
}

Brws_GoRefresh(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 12), "Uint", pwb%i%)
}

Brws_GoStop(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 14), "Uint", pwb%i%)
}

Brws_GetTitle(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 29), "Uint", pwb%i%, "UintP", pName)
   Unicode2Ansi(pName, sName)
   SysFreeString(pName)
   Return sName
}

Brws_GetURL(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 30), "Uint", pwb%i%, "UintP", pUrl)
   Unicode2Ansi(pUrl, sUrl)
   SysFreeString(pUrl)
   Return sUrl
}

Brws_Visible(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 40), "Uint", pwb%i%, "intP", bVis)
   DllCall(VTable(pwb%i%, 41), "Uint", pwb%i%, "int" , bVis ^ 1)
}

Brws_Offline(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 47), "Uint", pwb%i%, "intP", bOff)
   DllCall(VTable(pwb%i%, 48), "Uint", pwb%i%, "int" , bOff ^ 1)
}

Brws_Open(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 54), "Uint", pwb%i%, "Uint", 1, "Uint", 0, "Uint", 0, "Uint", 0)
}

Brws_New(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 54), "Uint", pwb%i%, "Uint", 2, "Uint", 0, "Uint", 0, "Uint", 0)
}

Brws_Save(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 54), "Uint", pwb%i%, "Uint", 3, "Uint", 0, "Uint", 0, "Uint", 0)
}

Brws_SaveAs(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 54), "Uint", pwb%i%, "Uint", 4, "Uint", 0, "Uint", 0, "Uint", 0)
}

Brws_Print(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 54), "Uint", pwb%i%, "Uint", 6, "Uint", 0, "Uint", 0, "Uint", 0)
}

Brws_PrintPreview(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 54), "Uint", pwb%i%, "Uint", 7, "Uint", 0, "Uint", 0, "Uint", 0)
}

Brws_PageSetup(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 54), "Uint", pwb%i%, "Uint", 8, "Uint", 0, "Uint", 0, "Uint", 0)
}

Brws_Properties(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 54), "Uint", pwb%i%, "Uint", 10, "Uint", 0, "Uint", 0, "Uint", 0)
}

Brws_Cut(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 54), "Uint", pwb%i%, "Uint", 11, "Uint", 0, "Uint", 0, "Uint", 0)
}

Brws_Copy(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 54), "Uint", pwb%i%, "Uint", 12, "Uint", 0, "Uint", 0, "Uint", 0)
}

Brws_Paste(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 54), "Uint", pwb%i%, "Uint", 13, "Uint", 0, "Uint", 0, "Uint", 0)
}

Brws_SelectAll(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 54), "Uint", pwb%i%, "Uint", 17, "Uint", 0, "Uint", 0, "Uint", 0)
}

Brws_Find(i)
{
   Global pwb1, pwb2
   DllCall(VTable(pwb%i%, 54), "Uint", pwb%i%, "Uint", 32, "Uint", 0, "Uint", 0, "Uint", 0)
}

Brws_DoFontSize(i, s)
{
   Global pwb1, pwb2
   VarSetCapacity(var, 8 * 2)
   EncodeInteger(&var + 0, 3)
   EncodeInteger(&var + 8, s - 1)
   DllCall(VTable(pwb%i%, 54), "Uint", pwb%i%, "Uint", 19, "Uint", 2, "Uint", &var, "Uint", &var)
}

Brws_InternetOptions(i)
{
   CGID_MSHTML(i, 2135)
}

Brws_ViewSource(i)
{
   CGID_MSHTML(i, 2139)
}

Brws_AddToFavorites(i)
{
   CGID_MSHTML(i, 2261)
}

Brws_MakeDesktopShortcut(i)
{
   CGID_MSHTML(i, 2266)
}

Brws_SendEMail(i)
{
   CGID_MSHTML(i, 2288)
}

Brws_ClearHistory()
{
/*
   GUID4String( CLSID_CUrlHistory, "{3C374A40-BAE4-11CF-BF7D-00AA006946EE}")
   GUID4String(IID_IUrlHistoryStg, "{3C374A41-BAE4-11CF-BF7D-00AA006946EE}")
   puh := CreateObject(CLSID_CUrlHistory, IID_IUrlHistoryStg)
   DllCall(VTable(puh, 9), "Uint", puh)
   DllCall(VTable(puh, 2), "Uint", puh)
*/
   Brws_GetHistory(1)
}

Brws_GetHistory(bDelete = 0)
{
   GUID4String( CLSID_CUrlHistory, "{3C374A40-BAE4-11CF-BF7D-00AA006946EE}")
   GUID4String(IID_IUrlHistoryStg, "{3C374A41-BAE4-11CF-BF7D-00AA006946EE}")

   puh := CreateObject(CLSID_CUrlHistory, IID_IUrlHistoryStg)

   DllCall(VTable(puh, 7), "Uint", puh, "UintP", psu)

   VarSetCapacity(var, 40)
   EncodeInteger(&var, VarSetCapacity(var))
   
   Loop
   {
      If DllCall(VTable(psu, 3), "Uint", psu, "Uint", 1, "Uint", &var, "Uint", 0)
         Break

      pUrl   := DecodeInteger(&var + 4)
      pTitle := DecodeInteger(&var + 8)

      If !bDelete
      {
         Unicode2Ansi(pUrl  , sUrl  )
         Unicode2Ansi(pTitle, sTitle)
         sHistory .= sUrl . "|" . sTitle . "`n"
      }
      Else
         DllCall(VTable(puh, 4), "Uint", puh, "Uint", pUrl, "Uint", 0)

      SysFreeString(pUrl  )
      SysFreeString(pTitle)
   }

   DllCall(VTable(psu, 2), "Uint", psu)
   DllCall(VTable(puh, 2), "Uint", puh)

   Return sHistory
}

Brws_Cleanup(nr)
{
  Loop %nr%
    Release(pwb%A_Index%)
  CoUninitialize()
}

CGID_MSHTML(i, nCmd, nOpt = 0)
{
   Global pwb1, pwb2
   GUID4String(CGID_MSHTML          , "{DE4BA900-59CA-11CF-9592-444553540000}")
   GUID4String(IID_IOleCommandTarget, "{B722BCCB-4E68-101B-A2BC-00AA00404770}")
   pct := QueryInterface(pwb%i%, IID_IOleCommandTarget)
   DllCall(VTable(pct, 4), "Uint", pct, "str", CGID_MSHTML, "Uint", nCmd, "Uint", nOpt, "Uint", 0, "Uint", 0)
   Release(pct)
}

#Include CoHelper.ahk



What did I miss? I thought I took out the routines for the old global variable setups, and put your lines of code.

Also see:

Code:


Brws_Move(i, x, y, w, h)
{
   WinMove, ahk_id hCtrl%A_Index%, , x, y, w, h
}





When you say the latest version "IEControl.ahk", does the one I have a major malfunction somehow?....., or using Invoke() instead without any wrapper,..... << what :shock:

can you possibility post a link? :)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 8th, 2007, 8:37 am 
Offline

Joined: March 16th, 2005, 10:33 pm
Posts: 969
Location: Frisia
I think you used an "old" version of mine, in which I attempted to create a multi-browser in AHK too.

You should get the latest version from this thread, and adapt accordingly:

Embed an Internet Explorer control in your AHK Gui via COM

_________________
Image mirror 1mirror 2mirror 3ahk4.me • PM or Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 8th, 2007, 9:26 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Silliogram wrote:
What did I miss? I thought I took out the routines for the old global variable setups, and put your lines of code.

Not here. Add it at the top of the first script. If you want to add here, then, just use the following instead:

Code:
pwb1:=pwb2:=pwb3:=0, hCtrl1:=hCtrl2:=hCtrl3:=0


Quote:
Code:
Brws_Move(i, x, y, w, h)
{
   WinMove, ahk_id hCtrl%A_Index%, , x, y, w, h
}

Try this:

Code:
  WinMove, % "ahk_id " . hCtrl%i%, , x, y, w, h


Quote:
When you say the latest version "IEControl.ahk", does the one I have a major malfunction somehow?....., or using Invoke() instead without any wrapper,..... << what :shock:

No, it would affect the result only at start-up, none afterwards.
Invoke() is inside the latest CoHelper.ahk, so you can use like this:

Code:
Invoke(pwb1, "Navigate", "http://www.autohotkey.com/forum")
Invoke(pwb2, "GoBack")
Invoke(pwb3, "GoHome")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 8th, 2007, 2:33 pm 
aie, ok, i got you now.. there isn't a solid place, or at least a hallmark download center on this site? , actual links where to find the best edition of cohelper and iecontrol.ahk? :O) i think these mods are helpful :) Thank you! BEST-Jerry


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 13th, 2007, 5:04 pm 
Offline

Joined: November 26th, 2006, 8:10 pm
Posts: 77
thank you very much for pointers. Below is what I am working with. I made some mods to it so it's simplified down to what I am trying to do.

What I want it to do is this: When I open the URL on the #1 browser, the #2 should completely open it also, and without messing with it, completely mirror whatever I do in the 1st browser, what links I click, etc.

Can this be done? :) :)

Code:

pwb1:=pwb2:=0, hCtrl1:=hCtrl2:=0

  ; ---------------·-------------- Init
  ; Settings
  #NoEnv
  SendMode Input
  SetBatchLines, -1
 
  OnExit, ByeBye
 
  ; ---------------·-------------- Includes before
 
  #Include Gui_BrwsControl.ahk
 
  ; ---------------·--------- Variables
 
 
  ; ---------------·--------------- Gui
 
 
  Gui, +LastFound
   mgH := WinExist()

  Brws_Init()
   Brws_Add(mgH, 1, 0, 10, 10, 300, 400, "about:blank")
   Brws_Add(mgH, 2, 0, 320, 10, 300, 400, "about:blank")



  Gui, Add, Button, x10  y420 w60 h22 gB1, Open

  Gui, Add, Button, x320 y420 w60 h22 gB5, Open

  Gui, Show, w650 h480, 2 Browsercontrols?
 
 
 
  ; ---------------·-------------- Flow
 
  ;XXX
 
 
 
 
  ; /AutoExecute
Return


; -----------------·-------------------·-------------------·---------- Routines

B1:
Brws_LoadURL(1, "http://www.autohotkey.com/support/")
Return

B5:
Brws_LoadURL(2, "http://www.autohotkey.com/support/")
Return


; -----------------·----------- ExitApp
ByeBye:
GuiClose:
GuiEscape:
  ; ------- Cleanup
 
  Brws_Cleanup(3)


  ExitApp
Return


; -----------------·-------------------·-------------------·----------- Hotkeys

; -----------------·------------ Reload
  ; for debugging 
  !r::Reload


; -----------------·-------------------·-------------------·---------- Includes

;#Include XXX

; -----------------·-------------------·-------------------·--------------- End





Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 14th, 2007, 1:40 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
AngieX wrote:
What I want it to do is this: When I open the URL on the #1 browser, the #2 should completely open it also, and without messing with it, completely mirror whatever I do in the 1st browser, what links I click, etc.

OK, now I can see what you want to do.
It'd be complicated to set up, although it may not be impossible.
You have to set up COM event, DWebBrowserEvents2 in this case.
And, depending on the extent you want to control, you may need to deal with DOM also.
Good luck.

PS. If you determine to try the COM event, I'll update the CoEvent.ahk a little, some improvements can be done to it.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 14th, 2007, 1:51 am 
Offline

Joined: November 26th, 2006, 8:10 pm
Posts: 77
Hey!!! :) :) Hope you are having a great day. Hopefully it is not as advanced to the point where nobody will help me. COM goes way above my head :( .... but at the simplest, I don't want to control the 'preview' window in any advanced way, pull data or anything, just have it duplicate results of the 1st one and that is it.


Sean, if this isn't too easy, if anyone else can see what Sean envisions please help me, or maybe can inch me further.

I appreciate it so much. I am sure after this I will understand COM and DOM more how it relates to this from a program standpoint. I am just getting past DLL's at this point, but I am always pushing my learning curve :) :)

SINCEREST REGARDS, ANGIE.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 14th, 2007, 5:34 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
AngieX wrote:
Sean, if this isn't too easy, if anyone else can see what Sean envisions please help me, or maybe can inch me further.

I posted one example code here:
http://www.autohotkey.com/forum/viewtopic.php?t=20979


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 2nd, 2007, 4:11 pm 
Sean wrote:
You have to set up COM event, DWebBrowserEvents2 in this case. And, depending on the extent you want to control, you may need to deal with DOM also. Good luck.

PS. If you determine to try the COM event, I'll update the CoEvent.ahk a little, some improvements can be done to it.
@Sean, could you step over how to use invoke to set up a DWebBrowserEvents2 COM event ?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 2nd, 2007, 4:50 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
AFH wrote:
@Sean, could you step over how to use invoke to set up a DWebBrowserEvents2 COM event ?

Haven't you read the examples in the link on my post just before your one?


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], chaosad, robotkoer and 67 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