Three ways to use directly
1. PB Internal Objects Inet object
2. API functions
3. Microsfot Web Browser Object in OLE
One, Inet object:
1. Inet Object
The Inet object provides the ability to display a Web page in the default browser, access the HTML for a specified page, a nd send data to a CGI, ISAPI, or NSAPI program. The above is the clarification of PB Helper, translated into Chinese is: provides the Windows default reader to display the Web page, as well as to support CGI,ISAPI,NSAPI the use of the program to send data. It doesn't seem to know how to get HTML, and I don't understand if you don't know that she needs to be internetresult with another object.
2. Internetresult Object
Well, let's keep looking at what Internetresult object is, and briefly say we can think of it as a buffer to absorb the asynchronous data transfer object, that is, it's a buffer, for accepting and hosting HTML code things, it's easy to understand.
Internetresult object cannot be used directly, such as directly defined
Internetresult lnet_ Internetresult//It's illegal, let's take a look at its help
The Internetresult object acts as a buffer, gear pump, receiving and caching asynchronous data, as it is returned using the Inter NET in response to the GetURL and PostURL function calls. The Internetresult object also provides the ability to process this data.
To use an Internetresult object, create a standard class user object defines a Internetdata function to process the Passed HTML.
We look at the italics section, and the helper tells us that we have to create a standard class to use it, and why it's so troublesome, I understand, is that it's actually a new "thread" created with the help of creating a Use object. Then use this new object to accept the data returned by the Geturl?? New thread to complete the asynchronous data absorption, otherwise it will block the existing exploit.
3. Another thing that must be explained Internetdata
This is a function of internetresult, the scale of the notation is: ServiceReference. Internetdata (Blob data). Okay, nice. We have a function, PB again, distillation equipment, this function is not directly used, it will not return anything. Forget it, we don't post help, anyway, this is a cover function. If you are using a version below 6.5, you must define the function Internetdata () on the continuation object of the Internetresult as the shrouded function of the function with the same name in the base class. The enveloped function must include a parameter of type blob that takes a pass-through method and whose return value is required to be of type Integer. Dispose of the data parameter in the body of the function: If you apply more than 7.0 of the version, the system will proactively help you create this shrouded function, power plant desulfurization, you just have some code in it.
4, start the code bar
1) Create a Internetresult standard class and name it N_internetresult.
2) Create an instance variable in N_internetresult string is_data
3) write the following code in the N_internetresult:internetdata () function
Is_data = string (data, encodingutf8!)
It must be clarified here that the string specifies that the character set is valid only after version 9.0, and if applied on the previous version, congratulations, you can only invoke the API function directly to convert the
4) All right, get a window, get a button, write the code in the button.
N_internetresult N_ir
inet Inet_base
String ls_url = ' http://www.google.com '
Inet_base. GetURL (Ls_url, N_ir)
MessageBox (' www.google.com:html ', n_ir.is_data)
5) You can run it.
5, very important, must be clarified some of the rules
1) inet can not get more than 65535 of the source code, it will be directly truncated it, very gloom it.
2) Some sites will determine the browser, you will not be able to access its source code. Related Topic articles:
- Two kinds of love
- Sea winds
- Religious practitioners
PowerBuilder programming tips on how to get HTML source for Web pages