当前位置:首页
开发技术指南» 文章正文
    引言:
 

 

 ·难过,放分    »显示摘要«
    摘要: 真的好想出去,可是还要上班,今天过了,明天回家睡个二天二夜~~~~~~~~~~~~~~~~~~ ......
    摘要: win2000pro +pb8.0 总是出现如下错误 pb80.exe 产生了错误,会被windows关闭,您需要重新启动程序。正在创建错误日志!! 出现这种错误太频繁了,我都没法用它了 怎么办?? 哪里有pb8。0的升级和补丁呀! ......


分数肯定的再加,关键是高手你能否拿得到

我现在有一千九百多分,遇到一个难题。对于高手来说是不难的。请告诉我它的工作流程和程序解释说明。.分数肯定加  
  一:窗体程序  
    EZ-USB   Bulk   Transfer   Example  
    copyright   (c)   2000   Cypress   Semiconductor  
   
    file:   frmBulk.frm  
   
  Option   Explicit  
   
  Public   strBuffer   As   String  
   
  Private   Sub   Form_Load()  
  Dim   Index   As   Integer  
  Dim   sDriverName   As   String  
  Dim   hDriver   As   Long  
   
          find   all   the   attached   EZ-USB   devices   and  
          add   them   to   the   devices   drop-down   list  
          For   Index   =   0   To   MAX_USB_DEV_NUMBER   -   1  
                  sDriverName   =   "Ezusb-"   &   Index  
                  hDriver   =   OpenDriver(sDriverName)  
                  If   hDriver   >   0   Then  
                          cmbDriverName.AddItem   sDriverName  
                          CloseHandle   hDriver  
                  End   If  
          Next  
           
          If   cmbDriverName.ListCount   >   0   Then  
                  cmbDriverName.Text   =   cmbDriverName.List(0)  
          Else  
                  ErrMsg   (eBadDriver)  
                  End  
          End   If  
  End   Sub  
   
  Private   Sub   Label1_Click(Index   As   Integer)  
   
  End   Sub  
   
  Private   Sub   txtIn_Change()  
   
          Dim   buffer(63)   As   Byte  
          Dim   result   As   Long  
          Dim   i   As   Integer  
          Dim   lDataLen   As   Long  
          Dim   sDriverName   As   String  
                   
            keep   track   of   new   text   added   to   input   text  
          strBuffer   =   strBuffer   +   Right(txtIn,   1)  
           
            have   we   hit   the   "xfer   trigger"?  
          If   Len(strBuffer)   =   Val(txtBlkSize.Text)   Then  
           
                    put   new   string   data   into   byte   buffer  
                  lDataLen   =   Len(strBuffer)  
                  For   i   =   1   To   lDataLen  
                          buffer(i   -   1)   =   Asc(Mid(strBuffer,   i,   1))  
                  Next  
                  strBuffer   =   ""  
                   
                  sDriverName   =   cmbDriverName.Text  
                   
                    write   the   data   to   the   EZ-USB   board  
                  result   =   DoBulkXfer(sDriverName,   eWrite,   buffer,   lDataLen)  
                  If   result   <>   1   Then:   ErrMsg   (result):   Exit   Sub  
   
                    clear   out   buffer  
                  For   i   =   0   To   63     no   rabbits   up   my   sleeve  
                          buffer(i)   =   0  
                  Next  
           
                    get   text   back   from   EZ-USB   board  
                  result   =   DoBulkXfer(sDriverName,   eRead,   buffer,   lDataLen)  
                  If   result   <>   1   Then:   ErrMsg   (result):   Exit   Sub  
                   
                    move   characters   from   buffer   to   output   text   area  
                  For   i   =   1   To   lDataLen  
                          txtOut.Text   =   txtOut.Text   +   Chr(buffer(i   -   1))  
                  Next  
                   
          End   If     xfer   trigger   reached  
           
  End   Sub  
   
  Private   Sub   txtBlkSize_Change()  
  Dim   temp   As   Integer  
            coerce   input   to   text   representing   number   between   1   and   64  
          temp   =   Val(txtBlkSize)  
           
          If   temp   <   0   Or   temp   >   64   Then  
                  MsgBox   "Enter   a   valid   Bulk   Transfer   block   size   between   1   and   64.",   vbInformation,   "Input   Error"  
                  txtBlkSize.SelStart   =   0  
                  txtBlkSize.SelLength   =   3  
          End   If  
  End   Sub  
   
  Private   Sub   cmdClearIn_Click()  
          txtIn.Text   =   ""  
  End   Sub  
   
  Private   Sub   cmdClearOut_Click()  
          txtOut.Text   =   ""  
  End   Sub  
   
  Private   Sub   Form_Activate()  
          txtBlkSize.SetFocus  
  End   Sub  
   
 

NO.1   作者: qingming81

代码没有测试,但可以将其英文注释翻译出来,也许可以看吧。  
   
  一:窗体程序  
   
    EZ-USB   Bulk   Transfer   Example  
  EZ-USB批量传递例程  
    copyright   (c)   2000   Cypress   Semiconductor  
   
    file:   frmBulk.frm  
   
  Option   Explicit  
   
  Public   strBuffer   As   String  
   
  Private   Sub   Form_Load()  
  Dim   Index   As   Integer  
  Dim   sDriverName   As   String  
  Dim   hDriver   As   Long  
   
          find   all   the   attached   EZ-USB   devices   and  
          add   them   to   the   devices   drop-down   list  
        查找所有连接的EZ-USB设备并添加这些设备到下拉列表中。  
          For   Index   =   0   To   MAX_USB_DEV_NUMBER   -   1  
                  sDriverName   =   "Ezusb-"   &   Index  
                  hDriver   =   OpenDriver(sDriverName)  
                  If   hDriver   >   0   Then  
                          cmbDriverName.AddItem   sDriverName  
                          CloseHandle   hDriver  
                  End   If  
          Next  
           
          If   cmbDriverName.ListCount   >   0   Then  
                  cmbDriverName.Text   =   cmbDriverName.List(0)  
          Else  
                  ErrMsg   (eBadDriver)  
                  End  
          End   If  
  End   Sub  
   
  Private   Sub   Label1_Click(Index   As   Integer)  
   
  End   Sub  
   
  Private   Sub   txtIn_Change()  
   
          Dim   buffer(63)   As   Byte  
          Dim   result   As   Long  
          Dim   i   As   Integer  
          Dim   lDataLen   As   Long  
          Dim   sDriverName   As   String  
                   
            keep   track   of   new   text   added   to   input   text  
          让新文本添加至输入文本中。  
          strBuffer   =   strBuffer   +   Right(txtIn,   1)  
           
            have   we   hit   the   "xfer   trigger"?  
          我们是否到达“xfer板机”  
          If   Len(strBuffer)   =   Val(txtBlkSize.Text)   Then  
           
                    put   new   string   data   into   byte   buffer  
                  将新字符串数据加入字节缓冲器  
                  lDataLen   =   Len(strBuffer)  
                  For   i   =   1   To   lDataLen  
                          buffer(i   -   1)   =   Asc(Mid(strBuffer,   i,   1))  
                  Next  
                  strBuffer   =   ""  
                   
                  sDriverName   =   cmbDriverName.Text  
                   
                    write   the   data   to   the   EZ-USB   board  
                  写数据到EZ-USB板  
                  result   =   DoBulkXfer(sDriverName,   eWrite,   buffer,   lDataLen)  
                  If   result   <>   1   Then:   ErrMsg   (result):   Exit   Sub  
   
                    clear   out   buffer  
                  清空缓冲器  
                  For   i   =   0   To   63     no   rabbits   up   my   sleeve  
                          buffer(i)   =   0  
                  Next  
           
                    get   text   back   from   EZ-USB   board  
                  从EZ-USB板取回文本  
                  result   =   DoBulkXfer(sDriverName,   eRead,   buffer,   lDataLen)  
                  If   result   <>   1   Then:   ErrMsg   (result):   Exit   Sub  
                   
                    move   characters   from   buffer   to   output   text   area  
                  将字符从缓冲器移至输出文本区。  
                  For   i   =   1   To   lDataLen  
                          txtOut.Text   =   txtOut.Text   +   Chr(buffer(i   -   1))  
                  Next  
                   
          End   If     xfer   trigger   reached     到达xfer板机  
           
  End   Sub  
   
  Private   Sub   txtBlkSize_Change()  
  Dim   temp   As   Integer  
            coerce   input   to   text   representing   number   between   1   and   64  
          强制输入表示数字1-64之间的文本  
          temp   =   Val(txtBlkSize)  
           
          If   temp   <   0   Or   temp   >   64   Then  
                  MsgBox   "Enter   a   valid   Bulk   Transfer   block   size   between   1   and   64.",   vbInformation,   "Input   Error"  
                  txtBlkSize.SelStart   =   0  
                  txtBlkSize.SelLength   =   3  
          End   If  
  End   Sub  
   
  Private   Sub   cmdClearIn_Click()  
          txtIn.Text   =   ""  
  End   Sub  
   
  Private   Sub   cmdClearOut_Click()  
          txtOut.Text   =   ""  
  End   Sub  
   
  Private   Sub   Form_Activate()  
          txtBlkSize.SetFocus  
  End   Sub  
   
   
  二:模块程序  
   
    &acute;&laquo;&Ecirc;&auml;&Ecirc;&yacute;&frac34;&Yacute;  
   
    EZ-USB   Bulk   Transfer   Example  
  EZ-USB批量传递例程  
    copyright   (c)   2000   Cypress   Semiconductor  
    file:   BulkXfer.bas  
   
  Option   Explicit  
   
    =   =   =   =   W   I   N   A   P   I     =   =   =   =  
   
  Public   Declare   Function   CreateFile   Lib   "kernel32"   Alias   "CreateFileA"   (ByVal   lpFileName   As   String,   ByVal   dwDesiredAccess   As   Long,   ByVal   dwShareMode   As   Long,   lpSecurityAttributes   As   Any,   ByVal   dwCreationDisposition   As   Long,   ByVal   dwFlagsAndAttributes   As   Long,   ByVal   hTemplateFile   As   Long)   As   Long  
  Public   Declare   Function   CloseHandle   Lib   "kernel32"   (ByVal   hObject   As   Long)   As   Long  
  Public   Declare   Function   DeviceIoControl   Lib   "kernel32"   (ByVal   hDevice   As   Long,   ByVal   dwIoControlCode   As   Long,   lpInBuffer   As   Any,   ByVal   nInBufferSize   As   Long,   lpOutBuffer   As   Any,   ByVal   nOutBufferSize   As   Long,   lpBytesReturned   As   Long,   ByVal   lpOverlapped   As   Long)   As   Long  
  Public   Declare   Function   GetLastError   Lib   "kernel32"   ()   As   Long  
   
    =   =   =   =   C   O   N   S   T   A   N   T   S   =   =   =   =  
   
  Public   Const   GENERIC_READ   =   &H80000000  
  Public   Const   GENERIC_WRITE   =   &H40000000  
  Public   Const   FILE_SHARE_READ   =   &H1  
  Public   Const   FILE_SHARE_WRITE   =   &H2  
  Public   Const   OPEN_EXISTING   =   3  
   
  Public   Const   METHOD_BUFFERED   =   0  
  Public   Const   METHOD_IN_DIRECT   =   1  
  Public   Const   METHOD_OUT_DIRECT   =   2  
   
  Public   Const   MAX_PIPES   =   16  
  Public   Const   MAX_USB_DEV_NUMBER   =   32  
   
  Enum   ErrorEnum  
          eBadParam   =   -1  
          eBadDriver   =   -2  
          eBadPipe   =   -3  
  End   Enum  
   
  Enum   EZ_ReadOrWrite  
          eWrite   =   1  
          eRead   =   0  
  End   Enum  
   
  Public   Type   SECURITY_ATTRIBUTES  
          nLength   As   Long  
          lpSecurityDescriptor   As   Long  
          bInheritHandle   As   Boolean  
  End   Type  
   
    =   =   =   =   I   O   C   T   L     D   E   F   I   N   I   O   N   S   =   =   =   =  
  I   O   C   T   L定义  
    Set   the   base   of   the   IOCTL   control   codes  
  设置I   O   C   T   L控制码  
  Private   Const   Ezusb_IOCTL_INDEX   =   &H800  
   
    (DeviceType)   <<   16)   |   ((Access)   <<   14)   |   ((Function)   <<   2)   |   (Method)  
    note:   DeviceType   for   each   control   code   is   FILE_DEVICE_UNKNOWN  
  每个控制码设备类型是FILE_DEVICE_UNKNOWN  
                FILE_DEVICE_UNKNOWN   *   2^16   =   &H220000  
                Access   =   FILE_ANY_ACCESS   =   0  
   
  Public   Const   IOCTL_Ezusb_GET_PIPE_INFO   =   _  
          &H220000   +   METHOD_BUFFERED   +   (Ezusb_IOCTL_INDEX   +   0)   *   4  
   
  Private   Const   IOCTL_Ezusb_GET_DEVICE_DESCRIPTOR   =   _  
          &H220000   +   METHOD_BUFFERED   +   (Ezusb_IOCTL_INDEX   +   1)   *   4  
   
  Public   Const   IOCTL_EZUSB_BULK_READ   =   _  
          &H220000   +   METHOD_OUT_DIRECT   +   (Ezusb_IOCTL_INDEX   +   19)   *   4  
   
  Public   Const   IOCTL_EZUSB_BULK_WRITE   =   _  
          &H220000   +   METHOD_IN_DIRECT   +   (Ezusb_IOCTL_INDEX   +   20)   *   4  
   
    =   =   =   =   U   S   B       R   e   q     d     D   a   t   a     T   y   p   e   s   =   =   =   =  
  Public   Type   USBDeviceDescriptorType     USB   device   descriptor  
          bDescriptorLength   As   Byte  
          bDescriptor   As   Byte  
          iSpecRelease   As   Integer  
          bDeviceClass   As   Byte  
          bDeviceSubClass   As   Byte  
          bDeviceProtocol   As   Byte  
          bMaxPacketSize   As   Byte  
          iVendorID   As   Integer  
          iProductID   As   Integer  
          iDeviceRelease   As   Integer  
          bManufacturer   As   Byte  
          bProduct   As   Byte  
          bSerialNumber   As   Byte  
          bNumberConfigurations   As   Byte  
          fill(128)   As   Byte  
  End   Type  
   
 


 ·sqlparameter异常(内详)    »显示摘要«
    摘要: 我用数据库记录构造一个类,在类中有几个sqlparameter成员变量,用于在类的方法中操作数据库。但是在update中,第二次调用时出现参数异常,错误如下: 未处理的“system.argumentexception”类型的异常出现在 system.data.dll 中 其他信息:另一个 sqlparametercollection 已包含带有 parametername“@_depar......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE