Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clarion 5 and web browse

Status
Not open for further replies.

richi85

Programmer
Dec 12, 2010
1
GB
Is it possible to view in clarion 5b window any web page? I need to show only linked pictures (banners). I have seen I can use OLE (internet explorer) control in a Clarion window, but I do not know how to do it. Thanks.
 
Hi!

Looks like using an OLE control of IE is your only choice in C5. It could be a bit flakey though as OCX/OLE controls stabilized a lot in C6.

Below is an example of using OLE control. Modify it to your needs.

Code:
**Local Data Embed**

EVENT:OpenBrowser               EQUATE(EVENT:User + 200)
EVENT:LoadPage1                 EQUATE(EVENT:User + 201)
EVENT:ProcessPage1              EQUATE(EVENT:User + 202)
EVENT:LoadPage2                 EQUATE(EVENT:User + 203)
EVENT:ProcessPage2              EQUATE(EVENT:User + 204)
EVENT:LoadPage3                 EQUATE(EVENT:User + 205)
EVENT:ProcessPage3              EQUATE(EVENT:User + 206)

WebBrowser                      LONG,AUTO
Status                          BYTE,AUTO

szUserName                      CSTRING(20)
szPassWord                      CSTRING(20)
URLString                       CSTRING(256)

Window WINDOW('Website Processor'),AT(,,396,333),FONT('MS Sans
Serif',,,,CHARSET:ANSI),GRAY,DOUBLE
     END

**CODE Embed***

  UrlString = '[URL unfurl="true"]https://www.website.org/'[/URL]
  szUserName = CLIP(GLO:UserName)
  szPassWord = CLIP(GLO:PassWord)
  OPEN(Window)
  0{PROP:Hide} = True

  ACCEPT
    CASE EVENT()
    OF EVENT:OpenWindow
      POST(EVENT:OpenBrowser)

    OF EVENT:OpenBrowser
      WebBrowser              = CREATE(0,CREATE:OLE)
      WebBrowser{PROP:Create} = 'InternetExplorer.Application'
      WebBrowser{'Visible'}   = True
      WebBrowser{'Navigate(' & UrlString & ')'}
      POST(EVENT:LoadPage1)

    OF EVENT:LoadPage1
      !Loading Main WebPage
      Status = WebBrowser{'Busy'}
      IF Status = 0
        POST(EVENT:ProcessPage1)
      ELSE
        POST(EVENT:LoadPage1)
      END

    OF EVENT:ProcessPage1
      !UserName is the id (Name) of the username entry field in the html page
      WebBrowser{'Document.GetElementByID(' & chr(34) & 'UserName' & chr(34) & ').Value'} = chr(34) & szUserName & chr(34)

      !Password is the id (Name) of the password entry field in the html page
      WebBrowser{'Document.GetElementByID(' & chr(34) & 'Password' & chr(34) & ').Value'} = chr(34) & szPassWord & chr(34)

     !chkbxAgree is the id (Name) of the checkbox field in the html page
      WebBrowser{'Document.GetElementByID(' & chr(34) & 'chkbxAgree' & chr(34) & ').Checked'} = True

      !Use This if it is not a form-based submit button
      !buttonSubmit is the id (Name) of the submit button in the html page
      WebBrowser{'Document.GetElementByID(' & chr(34) & 'BtnAgreeLogin' & chr(34) & ').Click()'}

      !Use This if it is a form-based submit button
      !LoginForm is the id (Name) of the form section in the html page
      !WebBrowser{'Document.forms("LoginForm").submit()'}

      POST(EVENT:LoadPage2)

    OF EVENT:LoadPage2
      !Submitting User/Pass
      Status = WebBrowser{'Busy'}
      IF Status = 0
          POST(EVENT:ProcessPage2)
      ELSE
        POST(EVENT:LoadPage2)
      END

    OF EVENT:ProcessPage2
      !Deactivate Browser Control - But Browser stays open for review
      WebBrowser{PROP:Deactivate}
      DESTROY(WebBrowser)
      POST(EVENT:CloseWindow)

    OF EVENT:CloseWindow
      BREAK
    END
  END

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top