Send HTML code to Internet Explorer from basic

vegaseat 0 Tallied Votes 185 Views Share

New to me, but MS InternetExplorer does have COM support you can access from basic code. I had to test this out and make it work. We are using BCX basic, one of the successors to Qbasic.

' add HTML code to InternetExplorer using COM support
' (you must have MS InternetExplorer installed on your computer)
' needs BCX basic ver 5.05.05 or later, download free package from:
' http://www.rjpcomputing.com/programming/bcx/devsuite.html
' COM credit goes to: Ljubisa Knezevic

BCX_SHOW_COM_ERRORS(TRUE)

dim H$            ' string H$ defaults to 2048 bytes

dim ie As Object
set ie = createobject("InternetExplorer.Application")

ie.navigate "about:blank" ' do this first!
ie.visible = true
ie.height = 300
ie.width = 550
ie.menubar = false
ie.toolbar = false
ie.statusbar = false
ie.resizable = true

' build the HTML code string ...
H$ = "<html><body><center><br><strong><font color=#A52A2A face="
' enc$() handles doublequotes within a string
H$ = H$ + enc$("comic sans ms") +">"
H$ = H$ + "--------   Church Bulletin Bloopers   ---------"
H$ = H$ + "</font></strong></center><br>"
H$ = H$ + "Don't let worry kill you -- let the church help."
H$ = H$ + "<br><br>"  
H$ = H$ + "Come hear missionary Bertha Beltsh all the way from Africa."
H$ = H$ + "<br><br>"  
H$ = H$ + "For those of you who have children and don't know it, we have a nursery downstairs."
H$ = H$ + "<br><br>" 
H$ = H$ + "This Sunday will be baptism in the South and North ends of the church. Children will be baptized at both ends."
H$ = H$ + "<br><br>" 
H$ = H$ + "Miss Judson will sing "
H$ = H$ + enc$("Put me in my little bed")
H$ = H$ + " accompanied by the pastor."
H$ = H$ + "<br><br>"  
H$ = H$ + "This Easter Sunday we will ask Mrs. Tugly to come forward and lay an egg on the altar."
H$ = H$ + "<br><br>"  
H$ = H$ + "The ladies of the church have cast off clothing of every kind.  They can be seen in the church basement Saturday."
H$ = H$ + "<br><br>"  
H$ = H$ + "A bean supper will be held on Tuesday evening in the church hall.  Music will follow."
H$ = H$ + "<br><br>"
H$ = H$ + "The Rev. Adams spoke briefly, much to the delight of his audience."
H$ = H$ + "<br><br>"
H$ = H$ + "The sermon this morning:  Jesus Walks On Water."
H$ = H$ + "<br><br>"  
H$ = H$ + "The sermon tonight:  Searching For Jesus."
H$ = H$ + "</body></html>"
 
ie.document.body.innerHTML = H$

Set ie = Nothing
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.