【求助】初学API,发现问题
小弟初学API今天学习到GetWindowText函数,发现一个问题,肯请各位不吝指教。
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
sub a()
Dim stmp As String
stmp = String(100, " ")
GetWindowText Me.hwnd, stmp, 100
MsgBox stmp
end sub
以上程序结果是输出所在窗体的标题。但是lpString传入方式是ByVal,也就是按值传入,GetWindowText函数本身不会改变lpString的值,可是这里stmp的值明明被改变了。