-
Declare Function SetCursorPosition& Lib "user32" _
(ByVal x As Long, ByVal y As Long)
Sub setpos(txt1 As TextBox, txt2 As TextBox)
If txt2.Text = "200" Then
txt1.Text = txt1.Text + 1
txt2.Text = "0"
Else
If txt1.Text = "200" Then
txt1.Text = "0"
Else
t& = SetCursorPos(txt1.Text, txt2.Text)
End If
End If
End Sub
-
I don't know what purpose this Routine serves, but there are a few mistakes..
First of all, your declaration is wrong plus it's a function, yet you haven't defined a return type, then you're mixing your Data Types without converting them, anyhow, here's the code in working order:
Code:
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Sub setpos(txt1 As TextBox, txt2 As TextBox)
If txt2.Text = "200" Then
txt1.Text = Val(txt1.Text) + 1
txt2.Text = "0"
Else
If txt1.Text = "200" Then
txt1.Text = "0"
Else
Call SetCursorPos(Val(txt1.Text), Val(txt2.Text))
End If
End If
End Sub
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
i stell keep getting a sub or funcition not defind
-
XxEvilxX
Can you write which sub or fuction is said as undefined by the Visual Basic Compiler?
Then we can think about the real problem if it is related to the system DLL's.
-
Is on the SetCursorPostion
-
The API call is NOT:
Code:
Declare Function SetCursorPosition& Lib "user32" (ByVal x As Long, ByVal y As Long)
It is:
Code:
Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Notice that SetCursorPosition is wrong... it is SetCursorPos.
You may however do the following:
Code:
Declare Function SetCursorPosition Lib "user32" Alias "SetCursorPos" (ByVal x As Long, ByVal y As Long) As Long
and use SetCursorPosition.
------------------
Tom Young, 14 Year Old
[email protected]
ICQ: 15743470
AIM: TomY10
PERL, JavaScript and VB Programmer
-
Aaron:
Even though the API SetCursorPosition doesn't exist...
Declare Function SetCursorPosition&
Here Evil did define a return data type. The & ampersand is a shortcut to As Long.
------------------
Yonatan
Teenage Programmer
E-Mail: [email protected]
ICQ: 19552879