基于VB6.0的曲柄滑塊機構(gòu)的參數(shù)化設(shè)計與實現(xiàn)
基于VB6.0的曲柄滑塊機構(gòu)的參數(shù)化設(shè)計與實現(xiàn),基于,vb6,曲柄,機構(gòu),參數(shù),設(shè)計,實現(xiàn)
INTERNET used to build VB applications
【Abstract】 Development of Internet technology as the programmer to provide a broader space for their skill. Earlier "Internet Applications" is the word refer to those with FTP protocol to download files or browse the HTML page tool, now use Visual Basi c, not only the development of applications for the Internet, but also the integration of Internet technology as part of large-scale solutions in.
【Key Words】 Internet; Visual Basic; ActiveX components; technology; procedures.
The development of Internet technology as the programmer to provide a broader space for their skill. Earlier "Internet Applications" is the word refer to those with FTP protocol to download files or browse the HTML page tool, now use Visual Basic, not only the development of applications for the Internet, but also the integration of Internet technology as part of large-scale solution .
Here the questions to be discussed is the use of Visual Basic to create applications for the Internet play an important role in the ActiveX component. For example, the creation of ActiveX controls can be used for HTML pages; the development of ActiveX documents can be used in Internet browsers and other components integrated together and HTML pages; other ActiveX code components (formerly known as OLE server), can be deployed the client or server computer, for background processing.
A, Internet Development Environment
Internet is the use of TCP / IP protocol, a global non-centralized management of computer networks. If for the local, the so-called "Internet Technology" and local LAN can be used in the same technology.
On the one hand, Internet technology developers to provide a space for their skill. If the Web connection and the use of ActiveX components, although the specific methods to achieve different, such as the use of HTML and VB Script code in order to achieve security, but still call the method, set properties, handle events and so on. This, VB developers of all knowledge and skills have been used in Internet environment. On the other hand, an extension of the application of Internet technology development. Such as ActiveX components and Internet technologies have the following benefits: easier to maintain - as a Web part of the necessary components can be downloaded without the user run a setup program to upgrade; will feature extended to the Internet - through the General Agreement, the user will not see in between the Internet and Intranet switch.
Second, Internet client / server
Can use client / server to test the relationship between the Internet development environment, client and server can have "static" and "the" two states. The activities of the client or the server may change its internal state and dynamically, or run a script to change their behavior; static client or the server is only incentive to respond to the outside world.
Internet development, including four cases: a static and passive client server; static client server and activities; the activities of the client and the server static; activities and activities of the client server.
Third, the use of ActiveX components Web .ActiveX components for Internet technology brings new features. Downloaded through the Internet components, super-connected, the menu features a variety of consultations, the ActiveX components and Internet integration, and content and applications has become increasingly blurred line between; another site due to (in the client and server between) the distribution function, you can create a more scalable and flexible site.
Internet applications in the use of ActiveX documents, can be developed and the Internet / Intranet site of the other elements of the tight integration of Visual Basic applications. Developed the use of these components of the application, users can transparently in the HTML pages and Active X documents migration between.
ActiveX documents can be as a Visual Basic application for the Internet to provide almost standard now to complete the work of the application can achieve using ActiveX documents. As an HTML page elements, if the user's client does not install ActiveX documents, and can be downloaded from the Internet automatically; if the client on the older version can also be automatically upgraded. ?? ActiveX document provides many features to install and navigation performance, and to ensure continued consistency:
Internet component download - can create a link to the ActiveX document, so that the browser can automatically find and download all the required components.
Ultra-connected objects - in a super-connected packet-aware container, you can use Visual Basic to connect the super-object properties and methods, Jump to a given URL or through the navigation history list.
Menu and consultation - as a result can get Word or Excel document, Visual Basic provides the ActiveX Document embedding its menu in your browser menu functions. For example, when being loaded into the document in Internet Explorer, the browser's menu will be created with the ActiveX document mixed menu.
PropertyBag - When in Internet Explorer in the deployment of ActiveX document, Propert yBag can maintain the consistency of data objects.
In Internet Explorer in the deployment of an ActiveX document to HTML page through a super-connection to connect to the ActiveX document.
1.To use HTML to create quote connect the ActiveX document. Document will be as a result of ActiveX in Internet Explorer to replace the HTML page, so to OBJECT tags on components of another HTML page. When the Jump to the page, once the ActiveX document is loaded, it will immediately disappear.
2.Using HTML for the browser available for download, registration and navigation to the way the ActiveX document. OBJECT tag in the ActiveX document should indicate the type of ID and the CODEBASE attribute.
3. In the same page, Internet Explorer using VBScript instructions immediately through the appropriate navigation vbd file to the ActiveX document.
Fourth, in the Internet applications use ActiveX controls .ActiveX control for a dynamic HTML page: the adoption of HTML and VBScript, in an HTML page can use ActiveX controls, set its properties, call its methods and its events; a control that contains the HTML page as if the design of a Visual Basic the window, ActiveX controls can provide more vivid and interactive user interface features to make HTML pages more dynamic.
General HTML and VBScript by means of a comprehensive reference and control the behavior of ActiveX controls. The use of HTML for the browser available for download, registration and reference channels quoted ActiveX controls. HTML code in the OBJECT tag to include:
1.Control the type of ID, in order to process the registry in Windows to find them;
2.ID attributes in order to invoke the control in VBScript (Visual Basic is similar to the Name attribute);
3.CODEBASE attribute to tell if the component is not the browser client to find where to go;
4.PARAM NAME label, set the properties of the control parameters.
Prepared to deal with and then use VBScript code click events so that each control by click, the program can be used for the corresponding action.
isual Basic Professional Edition also includes three pre-designed packages for control of Internet related technologies, to expand existing applications, they are:
Internet Transfer Control - three parcels of common Internet protocol: HTTP, FTP and Gopher;
WebBrowser Control - includes many available through the Internet Explorer features;
WinSock Control - can connect to a remote machine, and then through the UDP or TCP to exchange data.
Through the use of these controls can be added automatically from the FTP site to download files, Visual Basic IDE can also provide Web browser Add-in.
Internet applications in the use of ActiveX code components, whether the client or the server side, you can use ActiveX code components (dll or exe files), so as to add features HTML page.
The deployment of code on the client components, there is no need as a result of user commands are transmitted over the network back to the server, so can greatly improve the speed. Server-side component can also display the user interface functions of visual elements. By downloading a DLL, can be added in the HTML page the user interface elements, such as a log on dialog box; also provide behind-the-scenes client processing power, such as a library with VBScript.
Another DLL and Internet technology will be combined with the way it deployed in the server-side. If there is Internet Information Server (IIS) (included in Windows NT Server 4.0 in), through Visual Basic customs Tools disk directory Oleisapi2 dll in Visual Basic to call DLL built-in function.
Oleisapi2 dll contains all the functions ISAPI. DLL can be deployed in the HTTP server, and HT ML page information sent to call its methods. Oleisapi2 dll as a client, the request to the interface between the DLL. Based on due to code HTML, these requests is only a simple URL.
Through server-side DLL, can provide customers with customized parameters back to the client's HTML page, but also can manage the database connection, the request to receive and return the results of the collation and organization.
References
[1] Chen. Visaul Basic Programming [M]. Central Radio and Television University Press, 2000.
[2] Jin Maozhong. NET Programming [M]. Central Radio and TV Press, 2004.
[3]Ding AIping. Visaul Basic Programming (2nd edition) [M]. Publishing House of Electronics Industry, 2004.
[4] Wenyuan Pavilion studio. Reamweaver XM 2004 cheat extension with [M]. China Railway Publishing House, 2005.
用VB構(gòu)建INTERNET的應(yīng)用
【摘要】 發(fā)展 Internet技術(shù)為編程人員提供了更廣泛的施展身手的空間。早先“Internet 應(yīng)用 程序 " 這個詞只是指一些用FTP協(xié)議下載文件或瀏覽HTML頁面的工具,如今使用Visual Basi c,不僅可為Internet開發(fā)應(yīng)用程序,還可把Internet技術(shù)作為一部分融入大型的 解決方案中。
【關(guān)鍵詞】Internet;Visual Basic;ActiveX組件;技術(shù);程序
發(fā)展Internet技術(shù)為編程人員提供了更廣泛的施展身手的空間。早先“Internet應(yīng)用程序 " 這個詞只是指一些用FTP協(xié)議下載文件或瀏覽HTML頁面的工具,如今使用Visual Basic,不僅可為Internet開發(fā)應(yīng)用程序,還可把Internet技術(shù)作為一部分融入大型的 解決方案中。
這里所要討論的 問題 是利用Visual Basic創(chuàng)建面向Internet應(yīng)用起重要作用的ActiveX組件。例如,所創(chuàng)建的ActiveX控件可用于HTML頁面;開發(fā)ActiveX文檔可以在Internet瀏覽器中使用并與其他組件一起和HTML頁面集成;另外ActiveX代碼組件( 以前被稱為OLE服務(wù)器), 可以被部署在客戶端或服務(wù)器端的 計算 機上,用于后臺的處理。
一、Internet開發(fā)環(huán)境
Internet是使用TCP/IP協(xié)議、全球性非集中管理的計算機 網(wǎng)絡(luò) 。如果用于局部, 所謂“Internet技術(shù)"完全可以和本地局域網(wǎng)中所使用的技術(shù)一樣。
一方面, Internet技術(shù)為開發(fā)人員提供了一個施展身手的空間。如果和Web連接時使用 了ActiveX組件,盡管具體實現(xiàn)的 方法 有所不同,如采用了HTML和VB Script代碼以實現(xiàn)安全性等,但仍然在調(diào)用方法、設(shè)置屬性、處理事件等等。這 樣,VB開發(fā)人員所有的知識和技能都被用于Internet環(huán)境。另一方面,應(yīng)用Internet技術(shù)可延伸開發(fā)工作。如將ActiveX組件和Internet技術(shù)綜合 有以下益處:更簡單維護(hù)——作為Web一部分的組件可以根據(jù)需要下載,無須用戶運行一個setup程序進(jìn) 行升級;將功能延伸至Internet——通過通用協(xié)議,用戶將看不見在Internet和Intranet之間的切換。
二、Internet客戶/服務(wù)器
可以借用客戶機/服務(wù)器的關(guān)系來考查Internet的開發(fā)環(huán)境,客戶端和服務(wù)器端都可以有“ 靜 態(tài)的"和“活動的"兩種狀態(tài)?;顒拥目蛻魴C或服務(wù)器可據(jù)其內(nèi)部狀態(tài)的改變而動態(tài)地運 行一個腳本或是改變其行為;靜態(tài)的客戶機或服務(wù)器僅僅只是對外界激勵作出反應(yīng)。
Internet開發(fā)包括四種情形:靜態(tài)的客戶機和靜態(tài)的服務(wù)器;靜態(tài)的客戶機和活動的服務(wù)器;活動的客戶機和靜態(tài)的服務(wù)器;活動的客戶機和活動的服務(wù)器。
三、在Web上使用ActiveX組件
ActiveX組件為Internet技術(shù)帶來新功能。通過Internet組件的下載、超連接、菜單協(xié)商等各種功能,將ActiveX組件和Internet集成起來, 內(nèi)容 和應(yīng)用程序之間的界線越來越模糊;另外由于在站點上(在客戶機和服務(wù)器之間)分布功能函數(shù),則可創(chuàng)建更具擴展性 和靈活性的站點。
在Internet應(yīng)用程序中使用ActiveX文檔,可以開發(fā)和Internet/Intranet站點的其他元素緊密集成的Visual Basic的應(yīng)用程序。利用這些組件開發(fā)出來的應(yīng)用程序,用戶可以透明地在HTML頁面和Active X文檔之間遷移。
可以把ActiveX文檔作為Visual Basic為Internet提供的應(yīng)用,幾乎現(xiàn)在用標(biāo)準(zhǔn)應(yīng)用程 序完成的工作都可以用ActiveX文檔實現(xiàn)。作為HTML頁面中的一個元素,如果在用戶的客戶機上沒有安裝ActiveX文檔, 用時可以自動 地從網(wǎng)上下載;如果客戶機上的版本較舊, 也可自動升級。??ActiveX文檔的許多特性提供了安裝和導(dǎo)航性能,并可以保證持續(xù)一致性:
Internet組件的下載——可創(chuàng)建一個到ActiveX文檔的連接,使瀏覽器可以自動找到并下載所有需要的組件。
超連接對象——在一個超連接感知的包容器中,可使用Visual Basic的超連接對象的屬性和方法,跳轉(zhuǎn)到一個給定的URL或是通過 歷史 記錄清單進(jìn)行導(dǎo)航。
菜單和協(xié)商——由于可以從Word或Excel中獲得文檔,Visual Basic的ActiveX文檔提供了將 其菜單嵌入瀏覽器中的菜單的功能。例如當(dāng)文檔被裝載入Internet Explorer中后,瀏覽器 的菜單將與該ActiveX文檔創(chuàng)建的菜單混合。
PropertyBag——當(dāng)在Internet Explorer中部署ActiveX文檔時, 可以通過Propert yBag對象保持?jǐn)?shù)據(jù)的一致性。
在Internet Explorer中部署一個ActiveX文檔,要通過一個 HTML頁面中的超連接連接到這個ActiveX文檔上。
1. 用HTML創(chuàng)建引用這個ActiveX文檔的連接。由于ActiveX文檔將在Internet Explorer中取代HTML頁面,所以要將組件的OBJECT標(biāo)簽 放在另一個HTML頁面中。當(dāng)跳轉(zhuǎn)到該頁面后,一旦ActiveX文檔被裝載,它就會立刻消失。
2. 用HTML為瀏覽器提供下載、注冊以及導(dǎo)航到這個ActiveX文檔的途徑。在OBJECT標(biāo)簽中應(yīng) 該說明ActiveX文檔的類ID和CODEBASE屬性。
3. 在同一頁面上, 使用VBScript指示Internet Explorer立刻通過相應(yīng)的vbd文件導(dǎo)航到 該ActiveX文檔上。
四、在Internet應(yīng)用程序中使用ActiveX控件
ActiveX控件為HTML頁面帶來了活力:通過HTML和VBScript, 可在一個HTML頁面上 使用ActiveX控件, 設(shè)置其屬性,調(diào)用其方法并處理其事件;一個包含控件的 的HTML頁面仿佛一個Visual Basic的設(shè)計窗口,ActiveX控件可以提供更多交互式且生動的 用戶界面特性,使HTML頁面變得更加有活力。
一般需要通過HTML和VBScript的綜合手段引用并控制ActiveX控件的行為。使用HTML為瀏覽 器提供下載,注冊并引用ActiveX控件引用的途徑。在HTML代碼的OBJECT標(biāo)簽中需要包括:
1.控件的類別ID, 以使程序能在Windows的注冊表中找到它們;
2.、ID的屬性,以便在VBScript中引用該控件(類似于Visual Basic中的Name屬性);
3.CODEBASE屬性,告訴瀏覽器如果組件不在客戶機上該去哪兒找;
4.PARAM NAME標(biāo)簽,設(shè)置控件的屬性參數(shù)。
然后用VBScript編寫處理單擊事件的代碼,使每一個控件被單擊后,程序可以作相應(yīng)的動作。
Visual Basic專業(yè)版中還包括了三個已預(yù)先設(shè)計好的用于包裹Internet相關(guān)技術(shù)的控件, 能夠擴展已有的 應(yīng)用 程序,它們是:
Internet Transfer Control——包裹了三種通用的Internet協(xié)議:HTTP、FTP和Gopher;
WebBrowser Control——包含了許多通過Internet Explorer可以獲得的功能;
WinSock Control——可以連接到一臺遠(yuǎn)程的機器, 然后通過UDP或TCP交換數(shù)據(jù)。
通過使用這些控件, 可以添加從FTP站點自動下載文件的功能,還可以為Visual Basic IDE提供Web瀏覽器的Add-in。
在Internet應(yīng)用程序中使用ActiveX代碼組件,無論是在客戶端或是在服務(wù)器端, 都可以使用ActiveX代碼組件(dll或exe文件),從而為HTML頁面添加功能。
在客戶端部署代碼組件, 由于用戶命令無須通過 網(wǎng)絡(luò) 傳輸回服務(wù)器,于是可以大大提高運行速度。服務(wù)器端的組件同樣也可以有顯示用戶界面可視化元素的功能。通過下載一個DLL, 可以在HTML頁面上添加用戶界面的元素,如一個登錄對話框; 還可以提供幕后的客戶端處 理能力,如一個伴隨VBScript的函數(shù)庫。
另一種將DLL和Internet技術(shù)結(jié)合的方法是將它部署在服務(wù)器端。如果有Internet Information Server (IIS)(包含在Windows NT Server 4.0中), 可以通過Visual Basic關(guān)盤中 的Tools目錄下的Oleisapi2 dll調(diào)用Visual Basic中內(nèi)置的DLL函數(shù)。
Oleisapi2 dll中包含了ISAPI中的所有函數(shù)??梢园袲LL部署在HTTP服務(wù)器上, 并通過HT ML頁面上發(fā)送的信息調(diào)用其方法。Oleisapi2 dll作為客戶,請求到DLL之間的中介。由于代碼基于HTML,這些請求僅僅是簡單的URL。
通過服務(wù)器端的DLL,可以由客戶提供的參數(shù)定制返回給客戶的HTML頁面,還可以管理數(shù)據(jù)庫的連接,對接受到的請求和返回的結(jié)果進(jìn)行整理和編組。
參考文獻(xiàn)
[1]陳明.Visaul Basic程序設(shè)計[M].中央廣播電視大學(xué)出版社,2000.
[2]金茂忠.NET編程基礎(chǔ)[M].中央廣播電視出版社,2004.
[3]丁愛萍.Visaul Basic程序設(shè)計(第2版)[M]. 電子 工業(yè) 出版社,2004.
[4]文淵閣工作室.reamweaver XM 2004擴展程序與密技[M]. 中國 鐵道出版社,2005.
收藏