⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qb中cv?和mk?$两组函数对应的vb函数.txt

📁 以电子书的形式收集了VB一些常见问题解决方法,可以很方便的查找自己需要解决的问题.对一些VB初学者很用.
💻 TXT
字号:
如 果 要 模 拟 这 些 函 数 , 可 以 使 用 下 面 的 代 码 : 
     Declare Sub CopyMemory Lib "KERNEL32" Alias "RtlMoveMemory" ( _ 
     hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long) 
     Function MKI$ (x As Integer) 
     temp$ = Space$(2) 
     hmemcpy ByVal temp$, x%, 2 
     MKI$ = temp$ 
     End Function 
     
     Function CVI (x As String) As Integer 
     If Len(x) <> 2 Then 
     MsgBox "Illegal Function Call" 
     Stop 
     End If 
     hmemcpy temp%, ByVal x, 2 
     CVI = temp% 
     End Function 
     
     Function MKL$ (x As Long) 
     temp$ = Space$(4) 
     CopyMemory ByVal temp$, x&, 4 
     MKL$ = temp$ 
     End Function 
     
     Function CVL (x As String) As Long 
     If Len(x) <> 4 Then 
     MsgBox "Illegal Function Call" 
     Stop 
     End If 
     CopyMemory temp&, ByVal x, 4 
     CVL = temp& 
     End Function 
     
     Function MKS$ (x As Single) 
     temp$ = Space$(4) 
     CopyMemory ByVal temp$, x!, 4 
     MKS$ = temp$ 
     End Function 
     
     Function CVS (x As String) As Single 
     If Len(x) <> 4 Then 
     MsgBox "Illegal Function Call" 
     Stop 
     End If 
     CopyMemory temp!, ByVal x, 4 
     CVS = temp! 
     End Function 
     
     Function MKD$ (x As Double) 
     temp$ = Space$(8) 
     CopyMemory ByVal temp$, x, 8 
     MKD$ = temp$ 
     End Function 
     
     Function CVD (x As String) As Double 
     If Len(x) <> 8 Then 
     MsgBox "Illegal Function Call" 
     Stop 
     End If 
     CopyMemory temp#, ByVal x, 8 
     CVD = temp# 
     End Function 
    另 外 , 这 些 函 数 基 本 上 是 同 随 机 文 件 读 写 有 关 的 。 VB和 QB的 随 机 文 件 读 写 方 法 有 所 不 同 。 QB使 用 Field语 句 定 义 记 录 中 的 各 个 字 段 , 所 以 需 要 CV?和 MK?$两 组 函 数 。 而 VB中 使 用 用 户 定 义 类 型 来 定 义 记 录 中 的 各 个 字 段 , 自 然 无 须 CV?和 MK?$两 组 函 数 。 例 如 : 
    Type Record ' 定 义 用 户 自 定 义 数 据 类 型 。 
     ID As Integer 
     Name As String * 20 
    End Type 
     
    Dim MyRecord As Record ' 声 明 变 量 。 
    Open "TESTFILE" For Random As #1 Len = Len(MyRecord
<END>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -