易截截图软件、单文件、免安装、纯绿色、仅160KB

VB使用CopyMemory字符串处理

不能直接使用CopyMemoryStr,应该将字符串转为byte数组,然后使用CopyMemory
Property Get item() As String
    If h = 0 Then ErrRaise ERROR_INVALID_DATA
    'BugAssert p <> pNull
    Dim c As Long, ptr0 As Long
    Dim ab() As Byte
    '取出BSTR的长度
    CopyMemory c, ByVal p, 4
    If c > 0 Then
        ReDim ab(c - 1)
        CopyMemory ByVal VarPtr(ab(0)), ByVal (p + 4), c
        item = ab
    End If
End Property
Property Let item(s As String)
    If h = 0 Then ErrRaise ERROR_INVALID_DATA
    'BugAssert p <> pNull
    Dim c As Long
    Dim ab() As Byte
    c = LenB(s)
    ab = s
    ' 重新将BSTR放回内存中
    CopyMemory ByVal p, c, 4
    CopyMemory ByVal (p + 4), ByVal VarPtr(ab(0)), c
End Property


相关文档:

vb 保存图片到数据库

'读数据到二进制字段
Public Sub ReadfromBLOB(filed As ADODB.Field, Filen As String)
Dim DataFile As Integer, Fl As Long, Chunks As Integer
Dim Fragment As Integer, Chunk() As Byte, i As Integer
'传送块单位大小
Const ChunkSize As Integer = 16384
Dim MediaTemp As String
Dim lngOffset As Long
Di ......

使用VB将Excel导入到Sql中

使用VB把Excel导入到Sql数据库中,其实有几种方法。
下面我介绍的这种方法,较为简单。
其实这种方法的话,是直接使用T-SQL操作的,因此,到了VB里面,直接eccute这个代码就OK了的。
-----------------------------------------------------下面是在T-sql中的语句
if object_id('NewTable') is not null/*判断表NewTabl ......

重拾VB之二,毫秒篇

重拾VB之二,毫秒篇
PMP 关劲松
   
    鬼使神差,09年12月入职的公司仍使用VB开发软件,虽然并非专职开发,但也不得不在事隔4年之后,重新使用VB。
    在vb中如何获得毫秒精度级别的时间?vb的时间函数不支持毫秒,需要利用windows的基本API,编写程序才能获取毫秒级 ......

VB 取得指定exe文件版本号

【函数】  
  GetFileVersionInfo  
   
  【操作系统】  
  Win9X:Yes  
  WinNT:Yes  
   
  【声明】  
  GetFileVersionInfo   Lib   "version.dll"     Alias   "GetFileVersionInfoA" &n ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号