重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
不需要返回值应该用过程啊! sub
成都创新互联公司从2013年开始,我们提供高端网站建设、小程序开发、电商视觉设计、重庆APP开发公司及网络营销搜索优化服务,在传统互联网与移动互联网发展的背景下,我们坚守着用标准的设计方案与技术开发实力作基础,以企业及品牌的互联网商业目标为核心,为客户打造具商业价值与用户体验的互联网+产品。
private sub(xxx,xxx)
。。。
end sub
浮点数运算会产生误差,所以有时候(比如执行了乘除运算后)按理应该是0的浮点数变量可能并不是完全为0,会有个小误差。
所以尽可能使用整数变量来进行运算,非得有小数的,也尽量转为整数来运算,比如 1.23 可以扩大100倍变为123,运算完毕再除以100后进行输出。这样就可以最大限度减少浮点运算误差,而且整数运算的速度也比浮点运算快好多倍。
很多文章说Chr(0)是字符串结束符,表示到此字符串已经结束,不必往下读
比如添加
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim g() As Char = TextBox1.Text.ToCharArray
End Sub
在调试时何以查询g() 就可知道TextBox1到底有多少个字符
很简单,原因有二。第一,VB里long是32位,但是VB.NET里是64位,Dim ksWND As Integer才对。第二,VB在API里默认传址,而VB.NET默认传值,所以API里要添加Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long,添加"ByRef" lpRect As RECT) As Integer
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long,byref lpRect As RECT) As Integer
Private Structure RECT
Dim Left As Integer
Dim Top As Integer
Dim Right As Integer
Dim Bottom As Integer
End Structure
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim ksWND As integer
Dim ksTitle As String
Dim winS As RECT
If TextBox1.Text "" Then
ksTitle = TextBox1.Text
ksWND = FindWindow(vbNullString, ksTitle)
GetWindowRect(ksWND, winS)
MsgBox("左上角坐标(" winS.Left "," winS.Top ")" vbCrLf "右下角坐标(" winS.Right "," winS.Bottom ")" vbCrLf "窗口高" winS.Bottom - winS.Top "窗口宽" winS.Right - winS.Left)
Else
MsgBox("请填写窗口名称")
End If
End Sub