|
-
Nov 4th, 1999, 09:48 AM
#1
Thread Starter
Addicted Member
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
-
Nov 4th, 1999, 10:26 AM
#2
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]
-
Nov 4th, 1999, 12:56 PM
#3
Thread Starter
Addicted Member
i stell keep getting a sub or funcition not defind
-
Nov 4th, 1999, 01:31 PM
#4
New Member
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.
-
Nov 5th, 1999, 09:32 PM
#5
Thread Starter
Addicted Member
Is on the SetCursorPostion
-
Nov 5th, 1999, 11:39 PM
#6
Hyperactive Member
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
-
Nov 6th, 1999, 01:15 AM
#7
Guru
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|