Featured

    Featured Posts

Creating Internet Programs In VC++ and Visual Basic (VB).

Creating Internet Program in VC++ :-

       Including a web browser in VC++.  Creating your own web browser in VC++ is easy, because the Microsoft internet explorer which is the foundation application of the info-viewer in VC++ can be used as a control in our program.
       To display the Microsoft home page in our web browser we need to add a new Microsoft web browser control to our program, creating a member object for it & we use its navigate() method.

Steps are :->

  1. Create a new dialog-based program called "browser".
  2. Select Project -> Add Project -> Components and control.  This opens the VC++ components and control gallery.
  3. Now double click the entry marked registered ActiveX controls to open the list of ActiveX controls in your system.
  4. Select the Microsoft web browser control and then click on Insert button.
  5. VC++ asks you what class you want for this new control, accept the default suggestion! CwebBrowser.  This adds the web browser control to the dialog editors toolbox.
  6. Open the main dialog window in dialog editor.
  7. Drag the browser control which appears at the bottom in the toolbox to the dialog window under design.  This gives the browser control the ID : IDC-EXPLORER.
  8. Using class wizard, connect a member variable to the browser control, naming that variable m-browser.
  9. Add a button with caption Browse: to the dialog window and connect an event handler method OnButton1() to that button.
  10. When the user clicks the Browse button we can navigate our web browser to www.microsoft.com.  For this, we use the web browser control method Navigate() ( in which, the last four parameters are flags that we set to 0 ).
Void CBrowser Dlg : : OnButton1()
  m_browser.Navigate ( " http:\\ www.microsoft.com ",0,0,0,0 )
}
Run the program.



Creating Internet Program In Visual Basic

Including a web browser :->
      Create a new project, and then go to "Project" on the menu click components and find the component "Microsoft Internet Controls", check it, and click "Apply" and then "Close". ( Project -> Components -> Microsoft Internet Explorer controls ).  Click the icon (web browser) that was just added in the tool box and draw a large sized window with it.  This is going to be where you view webpages through your web browser.
       Take a TextBox, this will be your URL bar where you type in addresses of the websites you want to see.  Take four command button, there are going to be your Go, Back, Forward and Refresh buttons change the captions according and name each of them Cmdgo, Cmdback, CmdForward, CmdRefresh.
Write down the following code :-
Private Sub Cmdback_click().
WebBrowser.GoBack
End Sub
Private Sub Cmdforward_Click() 
webBrowser.GoForward
End Sub
private sub Cmdgo_click()
WebBrowser.Navigate(Text.text)
End Sub.
private sub Cmdfresh_click()
WebBrowser.Refresh
end sub.

Post a Comment

www.CodeNirvana.in

www.posthatke.com. Powered by Blogger.

Google+ Followers

Copyright © www.posthatke.com | Blogger Templates | Designed By posthatke.com