Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to make Windows CGI Application Program with VB

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "how VB makes Windows CGI applications". In daily operation, I believe many people have doubts about how VB makes Windows CGI applications. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "how VB makes Windows CGI applications". Next, please follow the editor to study!

The following is a more complex and practical WindowsCGI program, which is composed of four sub-procedures: CGI_Main (), EnterGuest (), ReturnForm () and Inter_Main (); its function is: the server sends a form to the Web client who applies for connection, the Web client fills in the form and sends it back to the server, and the server receives the Web client's data and writes them into a file for storage, while sending a receipt to the Web client. The workflow of the WindowsCGI application is as follows: when the Web client requests the CGI connection, the server runs the CGI program, first executes the CGI_Main () procedure, and the CGI_Main () procedure calls ReturnForm () to send a form to the Web client, if the Web customer fills in the opinion form And press the key to send it back to the server (at this time, the CGI_RequestMethod= "POST" in the process CGI_Main () is established), then the CGI_Main () procedure calls EnterGuest () to get the data sent by the customer and put it into the file guestbk.csv, and returns an information reply bar to the Web customer indicating that the customer form has been received.

Since the compilation and use of this CGI program is exactly the same as above, only the source code is given below:

OptionExplicit ConstBOOK_FILE= "guestbk.csv" files that store customer data are automatically generated. You can use Excel97 to access DeclareSubSleepLib "kernel32" (ByValdwMillisecondsAsLong) SubCGI_Main () IfCGI_RequestMethod= "POST" Then EnterGuest Beep Else ReturnForm EndIf EndSub'.

As soon as the Web customer requests a CGI connection, the server executes ReturnForm () and sends out a form asking for suggestions:

SubReturnForm () Send "Content-type:text/html" Send "Send (" Guizhou University TITLE > HEAD > ") Send (" Welcome to the WWW site of the Institute of computer Software and Theory of Guizhou University H1 > ") Send (" our e-mail is lixiang@gzu.edu.cn:A > ") Send (") Send ("Please fill in the form below Leave your valuable suggestions: ") Send (") Send ("your name:") Send ("E-mail address:") Send ("your suggestions to us:") Send ("TEXTAREA > PRE >") Send ("Please click here to send us your suggestions:") Send (") Send (" FORM > BODY > HTML > ") EndSub'to get customer suggestion form data Save the filled data into the file guestbk.csv and return a message to the customer SubEnterGuest () DimiLockTriesAsInteger DimsDateAsString DimsNameAsString DimsEmailAsString DimsCommentsAsString 'DimsBrowserAsString DimsFirstNameAsString DimfnAsInteger' to extract the proposed data: sName=GetSmallField ("name") sEmail=GetSmallField ("email") sComments=GetSmallField ("comments") iLockTries=0 fn=FreeFile OnErrorGoTogLockFail gRetryLock: OpenApp.Path+ "\" + BOOK_FILEFor AppendLockReadWriteAs#fn OnErrorGoTo0 sDate=Now Write#fn,sDate,sName,sEmail, sComments,CGI_RemoteAddr Close#fn sFirstName=Trim$ (Left$ (sName, InStr (sName) ") IfsFirstName"ThensFirstName=sFirstName&", "Send (" Content-type:text/html ") Send (") Send (" Thank you! TITLE > HEAD > ") Send (" date: "& sDate) Send (" name: "& sName) Send (" E-Mail: "& sEmail) Send (" Hostaddress: ["& CGI_RemoteAddr&"] ") Send (" suggestion: PRE > ") Send (sComments) Send (" Thank you! H2 > ") Send (" BODY > HTML > ") ExitSub gLockFail: Sleep (1000) iLockTriesiLockTries=iLockTries+1 ResumegRetryLock EndSub SubInter_Main () MsgBox" this is the CGI program. It needs to be run in a Web server. " , 16, "CGI.BAS" EndSub, this is the end of the study on "how VB makes Windows CGI applications". I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report