首 页文章中心下载中心繁體中文
设为首页
加入收藏
联系我们
您当前的位置:开源盛世-源代码下载网 -> 文章中心 -> V B 专区 -> 文章内容 退出登录 用户管理
投票调查
栏目导航
· VC++专区 · V B 专区
· GIS 专区 · PDA 专区
· 其他编程 · 网站开发类
· 数据库类 · 软件应用
· 网络安全 · 论文专区
· 综合资讯
热门文章
· Tab Control控件使用...
· 学生档案管理系统
· [图文] 排列组合公式
· UTF-8与GB2312之间的...
· DirectShow下载安装...
· Virtual PC 在PAE模...
· Windows2000终端服务...
· MapInfo上的GIS系统...
· kalman filter 卡尔...
· Windows2000终端服务...
相关文章
· 使用VBScript操作Ht...
· 实例演练ASP+XML编程...
· 使用VB编写纯ASP程序...
· FTP服务器软件Serv-...
· 使用VB6.0设计Activ...
· 使用VB截获WIN98系列...
· 使用VB在WIN2000下截...
· 使用vb建立DCOM服务...
· 使用vb建立DCOM服务...
· 使用VB开发Windows环...
使用vb建立DCOM服务器端及客户端应用的详细过程(2)
作者:佚名  来源:vscodes.com整理  发布时间:2005-12-16 13:42:11  发布人:Polaris

减小字体 增大字体

使用vb建立DCOM服务器端及客户端应用的详细过程(2)

   本节介绍如何建立DCOM客户端应用,及其注意事项。(本人使用的是西文版vb6)

 

   1.打开vb,在"file"菜单单击"New Project",选择"Standard EXE"并单击"OK".

   2.在"Project"菜单, 单击"References".

   3.单击"browse",选择"C:DCOMDemoServerproDCOMDemoServer.exe",单击"ok",
     并选中该引用.

   4.在工程里插入一个模块,放置两个CommandButton, 两个textbox,以及三个label到form1上
     . 设置如下属性:

   Control         Name              Property         Value
   ------------------------------------------------------------------
   Module          Module1           Name       modDCOMDemoClient     

   Form            Form1             Name             frmDCOMDemoClient
                                            Caption          DCOM Demo - Client

   CommandButton  Command1           Name             cmdServerTime
                                                       Caption          &Get Server Time

                  Command2              Name             cmdComputeNumbers
                                                Caption          &Compute Numbers

   Text Box        Text1              Name             txtX
                                              TabStop          True
                                              TabIndex         0

                   Text2                    Name             txtY
                                                 TabStop          True
                                                TabIndex         1

   Label           Label1            Name             lblAnswerAdd
                   Label2            Name             lblAnswerSubtract
                   Label3            Name             lblServerTime
 注意:现在还不要给工程更改名称,即名称仍为"PROJECT1"
 
   5.拷贝如下代码到模块里,(不是Form1上):


      Option Explicit

 

      Public oServer As New   _ proDCOMDemoServer.clsDCOMDemoServer


   6.拷贝如下代码到frmDCOMDemoClient代码窗口:


      Option Explicit
      Private Sub Form_Load()
           '设置文本框的初始化值.
            txtX.Text = "1"
            txtY.Text = "2"
      End Sub

      Private Sub txtX_GotFocus()
            txtX.SelStart = 0
            txtX.SelLength = Len(txtX.Text)
      End Sub

      Private Sub txtY_GotFocus()
            txtY.SelStart = 0
            txtY.SelLength = Len(txtY.Text)
        End Sub

      Private Sub cmdServerTime_Click()
           '获取服务器端的程序,并将返回值显示在lblServerTime标签里.
           lblServerTime.Caption = oServer.ServerTime
      End Sub

      Private Sub cmdComputeNumbers_Click()
            lblAnswerAdd.Caption = oServer.AddNumbers _
                (CInt(txtX.Text), CInt(txtY.Text))
            lblAnswerSubtract.Caption = oServer.SubtractNumbers _
                (CInt(txtX.Text), CInt(txtY.Text))
      End Sub

      Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As _
                Integer)

            Set oServer = Nothing
      End Sub

 

   7.在"Project"菜单, 单击"Project1 Properties."


   8.单击"General",设置如下属性:

   Project Type:             Standard EXE    

   Startup Object:           frmDCOMDemoClient 

   Project Des cription:      DCOM Demo Project - Client

 


   9.单击"Make",设置如下属性:

   Application Title:                  proDCOMDemoClient

 


   10.单击"Compile",设置如下属性:

   Compile to P-Code:       <Selected>

   11.单击"OK"

   12.在"File"菜单, 单击"Save Project As",保存的文件名称如下所述:

   Directory         File       Filename           Extension
   ----------------------------------------------------------------
   C:DCOMDemoClient  Module       modDCOMDemoClient     .bas
                       Form1        frmDCOMDemoClient     .frm
                       Project      proDCOMDemoClient     .vbp


   13.按"F5"按钮,测试客户端应用

   14.测试完成,在"File"菜单, 单击"Make proDCOMDemoClient.exe".

   15.将生成的exe文件保存到C:DCOMDemoClient

   16.关闭客户端和服务器端应用.

 

                         <待续>


End of《使用vb建立DCOM服务器端及客户端应用的详细过程(2)》

[] [返回上一页] [打 印] [收 藏]
 
∷相关“使用vb建立DCOM服务器端及客户端应用的详细过程(2)”文章评论∷
(评论内容只代表网友观点,与本站立场无关!) [更多评论...]
关于本站 - 网站帮助 - 广告合作 - 下载声明 - 友情连接 - 网站目录 鄂ICP备06007162
开源盛世 版权所有Copyright © 2003-2005 VSCodes.Com. All Rights Reserved.