The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => Miscellaneous Projects => Topic started by: ToutEnMasm on December 10, 2010, 06:29:36 PM

Title: Reading and writing in an html page
Post by: ToutEnMasm on December 10, 2010, 06:29:36 PM
The interesting part of this sample is in the InterrogeFeuille proc
The function of IHTMLElement interface need to be more study.
To use the sample made a simple thing:
open exemple.htm with no other one html page
run html.exe
The text "chose" in the input will be change to "reussite"
Help to made it better is wellcome.
You need to donwload the ready to use sdk in
the "windows.inc project" subforum
Some modifies have been made in it ( VARIANT structure)
Title: Re: Reading and writing in an html page
Post by: ToutEnMasm on December 11, 2010, 07:19:08 PM

Here is the missing part when we find a INPUT element
Quote
;http://msdn.microsoft.com/en-us/library/aa219328(v=office.11).aspx
IDispatch QueryInterface,addr IID_IHTMLInputTextElement,addr ppvIHTMLInputTextElement
.if ppvIHTMLInputTextElement != 0
   IHTMLInputTextElement get_type,addr bstrvide
   invoke UtoA,bstrvide
   invoke lstrcmpi,addr buffer,SADR("text")
   .if eax == 0
      IHTMLInputTextElement put_value,BSTR("Reussite")
   .endif
   IHTMLInputTextElement Release
.endif
There is such an interface for each found element ,IMG and so on,see:
http://msdn.microsoft.com/en-us/library/aa219328(v=office.11).aspx


Title: Re: Reading and writing in an html page
Post by: Rockphorr on December 11, 2010, 08:27:16 PM
firefox have ignored your html.exe
Title: Re: Reading and writing in an html page
Post by: ToutEnMasm on December 12, 2010, 07:56:37 AM

Firefox isn't internet explorer.Here you see that microsoft offer more than other explorer.
Perhaps is there a typelib with firefox who can do the same ?.
The first thing to do with firefox is this one.You can also verify the names of the class windows but they are certainly differents.
If you find a typelib with firefox ,I will help you translate it for masm.
Title: Re: Reading and writing in an html page
Post by: ToutEnMasm on December 12, 2010, 08:17:28 AM

Seems that got a typelib in firefox is possible using those toolS:
http://www.mozilla.org/scriptable/typelib_tools.html
Title: ADDING element (OPTION) in a list (SELECT)
Post by: ToutEnMasm on December 18, 2010, 05:57:06 PM
This one is difficult to find because the MSDN documentation is at least confuse.
The problem is to add OPTION to a SELECT box (html listbox)
Quote
      DEF_OPTION STRUCT
         text       VARIANT <>
         value       VARIANT <>
         defaultselected    VARIANT <>
         selected       VARIANT <>      
      DEF_OPTION ENDS
Quote
;IHTMLElement get_tagName,addr Unebstr --> SELECT   
invoke lstrcmpi,addr phrase,SADR("SELECT")
.if eax == 0                  
IHTMLWindow2 get_Option,addr ppvIHTMLOptionElementFactory
.if eax == S_OK
   ;définir l'option
   mov def_option.text.n1.n2.vt,VT_BSTR
   mov def_option.text.n1.n2.n3.pbstrVal,BSTR("Une_Option")
   mov def_option.value.n1.n2.vt,VT_BSTR
   mov def_option.value.n1.n2.n3.pbstrVal,BSTR("1")
   mov def_option.defaultselected.n1.n2.vt,VT_BOOL
   mov def_option.defaultselected.n1.n2.n3.boolVal,0
   mov def_option.selected.n1.n2.vt,VT_BOOL
   mov def_option.selected.n1.n2.n3.boolVal,0
   IHTMLOptionElementFactory create,def_option.text,def_option.value,\
   def_option.defaultselected,def_option.selected,addr ppvIoptions
   .if eax != S_OK
      invoke LireEr_Com,eax
      .if eax != 0                           
         invoke MessageBox,NULL,ecx,SADR("IHTMLOptionElementFactory"),MB_OK
      .endif
   .else                           
      IDispatch QueryInterface,addr IID_IHTMLSelectElement,addr ppvIHTMLSelectElement
      .if ppvIHTMLSelectElement != 0
         IHTMLSelectElement Add1,ppvIoptions,Index_New
         .if eax != S_OK
            invoke LireEr_Com,eax
            .if eax != 0                           
               invoke MessageBox,NULL,ecx,SADR("IHTMLOptionElementFactory"),MB_OK
            .endif
         .endif                              
         IHTMLSelectElement Release                              
      .endif ;ppvIHTMLSelectElement not zero
      Ioptions Release                                                   
   .endif ;ppvIoptions not zero   
   IHTMLOptionElementFactory Release                                                            
.endif ;ppvIHTMLOptionElementFactory not zero