AutoHotkey Community

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

All times are UTC [ DST ]




Post new topic Reply to topic  [ 113 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8
Author Message
 Post subject:
PostPosted: May 16th, 2010, 3:59 pm 
You can download the original from here. The cwebpage.dll is in the /dll/example folder.

Here is a repost of my sample code:

Code:
#NoEnv
SetBatchLines, -1
SetWinDelay, 0

; Load cwebpage.dll
cwebpageHandle := DllCall("LoadLibrary", "str", "cwebpage.dll") 

; Exit handler
OnExit, Cleanup

; Create menu
Menu, browserMenu, Add, Back
Menu, browserMenu, Add, Forward
Menu, browserMenu, Add, Refresh
Menu, browserMenu, Add, Stop
Menu, browserMenu, Add, Home
Menu, browserMenu, Add, Search

; Parent window
Gui, 1: Add, Button, y8 x0 w50 gBack, Back
Gui, 1: Add, Button, y8 x50 w50 gBack, Forward
Gui, 1: Add, Button, y8 x100 w50 gRefresh, Refresh
Gui, 1: Add, Button, y8 x150 w50 gStop, Stop
Gui, 1: Add, Button, y8 x200 w50 gHome, Home
Gui, 1: Add, Button, y8 x250 w50 gSearch, Search
Gui, 1: Add, Button, y370 x0 w150 gGoExample, Open example html
Gui, 1: Add, Button, y370 x150 w150 gGoAHKCHM, Open AHK chm
Gui, 1: Add, Button, y370 x300 w150 gGoAHKHome, Go to AHK homepage
Gui, 1: Show, w600 h400, Internet Explorer container in AHK with cwebpage.dll
WinGet, mainGuiHandle, ID, A

; Child window for Browser object
Gui, 2: Margin, 0, 0
Gui, 2: +ToolWindow -Caption +Border
Gui, 2: Show, w590 h320
WinGet, browserGuiHandle, ID, A
; Set as child window to main gui
Gui, 2: +LastFound
DllCall("SetParent", "uint", WinExist(), "uint", mainGuiHandle)

; Create the Browser object
res := DLLCall("cwebpage\EmbedBrowserObject", "uint", browserGuiHandle)
If (res != 0 Or ErrorLevel != 0) ; error
  Goto, Cleanup

; Position the Browser "control" in the Gui
WinMove, ahk_id %browserGuiHandle%, , 4, 40

; Load welcome html
Gosub, GoExample

; Monitor for right clicks on browser control
; WM_CONTEXTMENU ; 0x7B
OnMessage(0x7B, "Web_WM_CONTEXTMENU")

Return

; *** Routines:

; Browser control rightclick
Web_WM_CONTEXTMENU(wParam, lParam)
{
  Menu, browserMenu, Show
}
Return

; Browser control actions
Back:
res := DLLCall("cwebpage\DoPageAction", "uint", browserGuiHandle, "uint", 0)
Return

Forward:
res := DLLCall("cwebpage\DoPageAction", "uint", browserGuiHandle, "uint", 1)
Return

Home:
res := DLLCall("cwebpage\DoPageAction", "uint", browserGuiHandle, "uint", 2)
Return

Search:
res := DLLCall("cwebpage\DoPageAction", "uint", browserGuiHandle, "uint", 3)
Return

Refresh:
res := DLLCall("cwebpage\DoPageAction", "uint", browserGuiHandle, "uint", 4)
Return

Stop:
res := DLLCall("cwebpage\DoPageAction", "uint", browserGuiHandle, "uint", 5)
Return

; Examples

; Load welcome/example html
GoExample:
HTML2Load =
(
<html><head><title>HTML Template</title></head><body>
Welcome to the <a href="http://www.codeproject.com/com/cwebpage.asp">
cwebpage.dll</a> browser control embedded into an AutoHotkey GUI<br><br>
<ol><li>Pressing the <b>Open example html</b> button will load some example html
<li>Pressing the <b>Open AHK chm</b> button will load the startpage of the AutoHotkey chm helpfile locally on your computer.<br>
<font color="green"><b>Cwebpage.dll can open and navigate in chm-files too!</b></font>
<li>Pressing the <b>Go to AHK homepage</b> button will load the AutoHotkey homepage online
<li>Pressing the <b>Open welcome html</b> button will reload this page</ol>
You can control the browser object with the top buttons and the context menu...
<br><br><br><br>
<font color="red"><b>Enjoy!</b></font>...
</body></html>
)
Gosub, LoadHTML
Return

GoAHKCHM:
URL2Load = its:%A_ProgramFiles%\AutoHotkey\AutoHotkey.chm::docs\AutoHotkey.htm
Gosub, LoadURL
Return

GoAHKHome:
URL2Load = http://www.autohotkey.com
Gosub, LoadURL
Return

; Load URL
LoadURL:
res := DLLCall("cwebpage\DisplayHTMLPage"
                  , "uint", browserGuiHandle
                  , "str", URL2Load)
If (res != 0 Or ErrorLevel != 0) ; error
  Goto, Cleanup
URL2Load =
Return

; Load HTML
LoadHTML:
res := DLLCall("cwebpage\DisplayHTMLStr"
                  , "uint", browserGuiHandle
                  , "str", HTML2Load)
If (res != 0 Or ErrorLevel != 0) ; error
  Goto, Cleanup
HTML2Load =
Return

; Cleanup and exit
Cleanup:
GuiEscape:
GuiClose:
DLLCall("cwebpage\UnEmbedBrowserObject", "uint", browserGuiHandle)
DllCall("FreeLibrary", "uint", cwebpageHandle)
ExitApp
Return


You should not use this one, though... Deprecated. Use COM/IE instead.

HTH


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 16th, 2010, 4:06 pm 
Offline

Joined: March 16th, 2005, 10:33 pm
Posts: 969
Location: Frisia
More mirrors of cwebpage.zip:

- on DropBox
- on AutoHotkey.net
- on daonlyfreez.net

HTH

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


Report this post
Top
 Profile  
Reply with quote  
PostPosted: June 20th, 2010, 4:06 pm 
Offline

Joined: February 7th, 2010, 11:02 pm
Posts: 9
Location: Wisconsin
How does this relate to autohotkey


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 21st, 2010, 8:12 am 
Quote:
How does this relate to autohotkey
Why not read the 8 pages of this thread to understand why?


Report this post
Top
  
Reply with quote  
 Post subject: tip
PostPosted: September 17th, 2010, 12:16 am 
what about add a "loading" icon on down-right side of the window?
or a loading bar? :D
well. only the loading icon is cool...
(sorry for bad english)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2010, 11:38 am 
Offline

Joined: April 19th, 2005, 10:26 am
Posts: 2250
Location: switzerland
@ n-l-i-d
navigate buttons don't work in example above ( cwebpage.dll ), (back,forward)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2010, 2:03 pm 
@garry.

Apparently the CodeProject file that is available for download (the one I mirrored), is not the same as the one from this project.

It seems the cwebpage.dll is flagged as a virus by many anti-virus programs. The reason why I lost the original.

If you get a hold on the original one (which should include the missing DLLCalls you mentioned), let us know.

Still, it would be better to switch to the COM version instead.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2010, 9:33 pm 
Offline

Joined: April 19th, 2005, 10:26 am
Posts: 2250
Location: switzerland
Quote:
If you get a hold on the original one (which should include the missing DLLCalls you mentioned), let us know.

thank you n-l-i-d for answer, I haven't the original cwebpage.dll ( so navigation-buttons not work)


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 113 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 5 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