Built your own web browser with C ++ Builder

zhaozj2021-02-17  86

---- Use IE and Netcape friends, have you ever thought about producing an your own browser? Use C Builde to make you easily and efficiently create your own Internet programs. Basic C Builder The language is C , so it can make anything, through the component settings of C Builder, you can build an Internet app like other applications, meaning that you can extend these components to enhance their features, if needed, it It is also possible to handle low level API details because it is based on C . If you use the API (such as ISAPI) to create an Internet app, the tool you choose must use and create a DLL, and can utilize the interfaces published by these DLLs.

---- Let's take a look at its Internet components and features:

-------------------------------------------------- -------

FTP supports THTML supports the HTML data between remote machines to support the HTML data and provide a current HTML page. Rolling View THTTP provides access to the Super Text Transfer Protocol TNTTP provides the ability to read newsgroups TPOP provides access POP3 email protocol TSMTP Support Internet The mail message group provides the SMTP server TTCP to access the WINSOCK Transfer Control Protocol (Customer and Server) TUDP Provides accessing the Winsock User Data Map Agreement (client and server)

---- Now we can start building our browser:

---- 1. Build a new project file first

---- Create a new form, set its CAPTION attribute to mybrowse, the property of the property is PoscreeCnter to place a TTABControl component at the top of the form, this control is easy to return to you have visited you. After the node, set the align's properties to Altop, so that it is always in the top of the form, then places a TPANEL and set the align property to Albottom, so that it is on the bottom, delete CAPTION in the object viewer Attribute, and set another TPANEL to 0. Add another TPANEL to the form, clear its CAPTION attribute, and place two TbitBTNs, and Caption is set to Go and Home, place a Tcombobox at the bottom of the form, and delete his text attribute, When the program is running, you will type or pull down the URL you want to access or drop down .. Finally, place a THML component on the form, which will display the web page. You can write code.

---- 2.

---- (1). Writing code for TabControl's onchange event (synchronized CBURL and TCURL): cburl-> text = tcurl-> tabs-> strings [tcurl-> tabindex]; cburl-> selectall (); bbgo -> Click (); // Make the same effect as clicking GO and point form

---- (2). Write code for THTML onbeginRetrieve event:

Cursor = (tcursor) CRHOURGLASS; if (cburl-> items-> indexof (htbrowser-> url) == - 1) {cburl-> items-> add (htbrowser-> url); / / Check if the URL keeps TcomboBox keeps Cburl-> text = htbrowser-> url; file: // contains address to be browsed>, if there is no cburl-> selectall (); // Add it to TcomboBox and TCURL-> Tabs-> add (htbrowser-> URL); // TTabControl in tcurl-> tabindex = tcurl-> tabs-> count-1; bbgo-> click ();}

---- Writing code for Thtml OneendRetrieve practice; cursor = (tcursor) crdefault; ---- 3. Write code for the onclick event for the Go button:

HTBROWSER-> EquestDoc (cburl-> EST) / / Open any URL // (CBUCL) specified in <> TcomboBox

---- 4. Writing an event for the button home on Click HOME

Htbrowser-> EquestDoc-> (HomePage) // HomePage is constant, must be defined in the program, such as // string homepage = "http://www.sohoo.com"]

---- Now you have your own browser. Fast! Try a try! - = - = - = - = - = - = - = - = - = - - = - = - = - = - = - = - = - = -

//

__________ / lb / ___ Outinn

/ _ [] _ ​​/ ____ / /

/ _________ / | () | / __ /

Http://outinn.yeah.net/

| ____ / - | __ | - / | Welcome to Visit Outinn!

| __ | == | ___ | || | __ |

- = - = - = - | _ || _ | = - FANCY,

Outinn@china.com

转载请注明原文地址:https://www.9cbs.com/read-31328.html

New Post(0)