VB6.0操作XML文件
<?xml version=”1.0″ encoding=”gb2312″?>
<testlist>
<test>
<id>1</id>
<name>自由飞翔</name>
<time>2007-12-7</time>
</test>
<test>
<id>2</id>
<name>自由</name>
<time>2007-12-7</time>
</test>
</testlist>
以下是VB6.0的代码:
<?xml version=”1.0″ encoding=”gb2312″?>
<testlist>
<test>
<id>1</id>
<name>自由飞翔</name>
<time>2007-12-7</time>
</test>
<test>
<id>2</id>
<name>自由</name>
<time>2007-12-7</time>
</test>
</testlist>
以下是VB6.0的代码:
许多刚接触 VS2008 的程序员,编写应用程序会遇到这种情况,即在开发用的机器上可以正常运行,但是换了没装VS2008的机器,你写的程序就有可能运行不了了。其实当初我也是遇到这个问题,但是对于MFC程序来说,如果采用MFC静态链接发布,那么这个问题将会被简单解决。但是如果换了Win32项目,情况就不同了,因为它没有使用MFC,但是编译出来的程序,同样无法独立运行。这个问题本人曾在网上寻找过答案,不过没有找到对题的答案。
有一天,我在研究用于使用DLL的导入库LIB的兼容性问题(VC6使用VS2008产生的库时,总会发生一些链接错误)。解决了这个菜鸟问题。
VS2008编译的Win32程序独立运行的解决方案是: 阅读全文…
ClipCursor
ClipCursorByNum
Option Explicit
Dim R As RECT
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function ClipCursor Lib “user32″ (lpRect As RECT) As Long
‘lpRect-鼠标光标限制到的矩形
Private Declare Function ClipCursorByNum Lib “user32″ Alias “ClipCursor” (lpRect As Long) As Long
‘lpRect-传0,取消鼠标光标限制
Private Declare Function SetRect Lib “user32″ (lpRect As RECT, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Sub Form_Load() ‘窗体载入后,鼠标只能在窗体范围内移动
SetRect R, Left / Screen.TwipsPerPixelX, Top / Screen.TwipsPerPixelY, (Left + Width) / Screen.TwipsPerPixelX, (Top + Height) / Screen.TwipsPerPixelY
ClipCursor R
End Sub
Private Sub Form_Unload(Cancel As Integer) ‘窗体退出时,取消鼠标光标限制范围
ClipCursorByNum 0
End Sub
1 VBA中的字符串
2 VBA中处理字符串的函数
2.1 比较字符串
2.2 转换字符串
2.3 创建字符串
2.4 获取字符串的长度
2.5 格式化字符串
2.6 查找字符串
2.7 提取字符/字符串
2.8 删除空格
2.9 返回字符代码
2.10 返回数值代表的相应字符
2.11 使用字节的函数
2.12 返回数组的函数
2.13 连接字符串
2.14 替换字符串
2.15 反向字符串
函数SetLayeredWindowAttributes
使用这个函数,可以轻松的实现半透明窗体。按照微软的要求,透明窗体窗体在创建时应使用WS_EX_LAYERED参数(用CreateWindowEx),或者在创建后设置该参数(用SetWindowLong),我选用后者。全部函数、常量声明如下:
Private Declare Function GetWindowLong Lib “user32″ Alias “GetWindowLongA” (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib “user32″ Alias “SetWindowLongA” (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib “user32″ (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long