The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: dougiem on October 10, 2006, 04:52:54 AM

Title: html display
Post by: dougiem on October 10, 2006, 04:52:54 AM
This displays an html page in a window. It has minimal code, using atl.dll.
With a little bit more work it could do all sorts of tricks!

dougiem

[attachment deleted by admin]
Title: Re: html display
Post by: hutch-- on October 10, 2006, 05:40:40 AM
Doug,

It works fine on my win2k box.  :U
Title: Re: html display
Post by: Brad on October 11, 2006, 12:10:06 AM
Thanks for the code! Doug :)

you havn't by chance created a browser plugin as yet?

Thx, B
Title: Re: html display
Post by: modchip on October 11, 2006, 03:19:11 AM
Thanks! I've been looking for this! Thanks again!
Title: Re: html display
Post by: dougiem on October 11, 2006, 05:44:57 AM
brad,
there's a few button commands you can use to make a simple browser,
                 ole32 pIweb2obj,offset IWebBrowser2_GoBack
                 ole32 pIweb2obj,offset IWebBrowser2_GoForward
                 ole32 pIweb2obj,offset IWebBrowser2_Navigate
I just liked the idea of having a fancy looking window for my apps. I'm glad it's of some use.

dougiem
Title: Re: html display
Post by: PBrennick on October 11, 2006, 11:56:21 AM
brad,
I was surprised to see that this lite browser supports JAVA.  Other implimentations did not. I can use this browser to make applets look like applications.  I put one together for others to see. Attached is Mahjongg.

Paul


[attachment deleted by admin]
Title: Re: html display
Post by: dougiem on October 11, 2006, 11:32:53 PM
PBrennick,
            I was dlighted to see the use you put to the masm app. (How do i play it ?)
I hope you domt mind, i have introduced a 'resource to file' module, which makes the application a
stand alone. Although in the examples we both have shown, I think it should be pointed out that if you go
web wise, you should be aware of your security. great stuff

ps your site - great!

dougiem
attach:mahjongg2.zip
Title: Re: html display
Post by: dougiem on October 11, 2006, 11:35:03 PM
sorry attachment !!!!

[attachment deleted by admin]
Title: Re: html display
Post by: PBrennick on October 12, 2006, 12:22:40 AM
dougiem,
Here is the original html file that I wrote for the game.  Scroll down to see the directions. Get the attachment.

Paul


[attachment deleted by admin]
Title: Re: html display
Post by: PBrennick on October 12, 2006, 01:33:55 AM
Dougiem,
Loading them as resources is a good idea. It did not occur to me because they are so small. I moved the program to a separate directory and when I ran it, I noticed that you unbundle the jar into the html directory but not the html file. Why is that?
Paul
Title: Re: html display
Post by: dougiem on October 12, 2006, 02:19:36 AM
ah !  Paul,
             The paths were not meant to be relative. In my prog, it assumes "THIS DIR"
to point to : change:       lline :         pHtml              db "/html/Mahjongg.html",0                      to yours

dougiem  cheers!
Title: Re: html display
Post by: PBrennick on October 12, 2006, 03:00:39 AM
Dougiem,
There is no difference between the two lines.

Paul
Title: Re: html display
Post by: dougiem on October 12, 2006, 08:59:57 AM
sorry, I had spelt the file wrong in : WM_CLOSE
                       invoke DeleteFile,SADD("html/mahjongg.jar")
so it cannot subsequently delete the dir
Title: Re: html display
Post by: PBrennick on October 12, 2006, 10:16:16 AM
ahhh. That will be a lot cleaner.

Paul
Title: Re: html display
Post by: Mark_Larson on October 12, 2006, 01:11:35 PM

  thanks for the code!  I had actually had just started working on doing the same thing yesterday so you saved me a lot of time :)

Title: Re: html display
Post by: ToutEnMasm on February 14, 2009, 07:01:06 PM
Perhaps a simple proc can help ?
It's a translation of a sdk sample
http://www.masm32.com/board/index.php?topic=10864.msg79597#msg79597
Title: Re: html display
Post by: PBrennick on February 16, 2009, 03:06:00 PM
Thank you, I was looking for something like that to show the Sudoku Worksheets.

Paul
Title: Re: html display
Post by: elmo on April 10, 2011, 01:48:19 AM
hi dougiem, that's a great app! :U
But when I pass SADD("C:\") to MultiByteToWideChar, the Windows' Form appear.
Sorry, but I think this is embarrass.
When I type C:\ on address bar of Mozilla firefox or Google Chrome  it also show file' list in directory C:\. but they not open it with Windows' Form.
How can we make your app to become like that?
or maybe would you like to give me some clue or other link?

here is other link:
http://www.masm32.com/board/index.php?topic=10904.msg80033#msg80033

thank you

sorry for my bad english.




;CREATE WEBBROWSER1
;load com libs
invoke CoInitialize,0


;initialize the Active Template Library classes: invoke AtlAxWinInit
invoke LoadLibrary,SADD("atl.dll")
mov hATLlib,eax
invoke GetProcAddress,hATLlib,SADD("AtlAxWinInit")
call eax


;Create the WebBrowser window
invoke CreateWindowEx,
NULL,
SADD("AtlAxWin"),
NULL,
WS_CHILD or WS_VISIBLE or WS_BORDER or WS_VSCROLL or WS_HSCROLL,
0,25,500,472,hWin,NULL,
400000h,NULL
mov hATLweb,eax
invoke ShowWindow,hATLweb,SW_HIDE
invoke RegisterWindowMessage,SADD("WM_ATLGETHOST")
mov WMhost,eax
invoke SendMessage,hATLweb,WMhost,0,0 ;get the host object [window]
mov HostObject,eax
ole32 HostObject,0,offset IID_IAxWinHostWindow,offset pIwebHost ;QueryInterface
;to IAxWinHostWindow vtable

;create page
;get html page address then pass it to MultiByteToWideChar
invoke MultiByteToWideChar,CP_ACP,0,SADD("C:\"),-1,addr uHtml,MAX_PATH*2
ole32 pIwebHost,IAxWinHostWindow_CreateControl,offset uHtml,hATLweb,0
invoke RegisterWindowMessage,SADD("WM_ATLGETCONTROL")
invoke SendMessage,hATLweb,eax,0,0 ;get loaded object [htmlpage]
mov browserObject,eax
ole32 browserObject,0,offset IID_IWebBrowser2,offset pIweb2obj ;QueryInterface
;to IWebBrowser2 vtable this-> to set pages
Title: Re: html display
Post by: donkey on April 10, 2011, 02:50:36 AM
Hi elmo,

The IWebBrowser interface simply loads a Microsoft Internet Explorer control into an ATL window in this case. The control will act exactly as IE does and that will always open an Explorer window when you type a local path (without a filename) into the address bar. The way its displayed is a result of how it handles the FILE: protocol when dealing with folders, which is different between the Gecko engine (which generates an XHTML file) and the IE engine.