|
-
Jun 20th, 2005, 06:19 PM
#1
Thread Starter
Lively Member
Group of commands
for a command button, i made it do 14 different commands... how can i make sure they all go in the order i put it all in? because it isn't working.. and i've tried 1 command at a time, and they all worked...
can sum1 plz help me?
thnx in advance,
Phil.D.
-
Jun 20th, 2005, 06:25 PM
#2
Re: Group of commands
Please post your code because (subject to If/Else statements) the code will run always run in the order that it appears.
-
Jun 20th, 2005, 06:28 PM
#3
Thread Starter
Lively Member
Re: Group of commands
i found out tht it is doing it in the right order, but it does it all at once, so there is a problem, even when i put "Sleep 1000" after every command it still doesn't do it properly... and as i said, every command works seperately.. what should i do?
-
Jun 20th, 2005, 06:37 PM
#4
Re: Group of commands
If you only want it to execute one command at a time, you should create a BtnCount variable, and then separate each statement using this logic. You could do something like this:
VB Code:
sub Button1_Click()
select case BtnCount
case 1
' Do Command 1
case 2
' Do Command 2
'-
'-
case else
' anything extra
end select
BtnCount = BtnCount +1
end sub
-
Jun 20th, 2005, 06:40 PM
#5
Thread Starter
Lively Member
Re: Group of commands
i don't know if tht will matter now, because it works in order now... it just doesn't work if i have more than 2 commands on it... y?
-
Jun 20th, 2005, 06:42 PM
#6
Re: Group of commands
Please explain what you mean by "it doesn't work".
-
Jun 20th, 2005, 06:44 PM
#7
Thread Starter
Lively Member
Re: Group of commands
it won't do the commands!!! it does the first command and tht's it.. then the computer freezes until i press "Ctrl+Alt+Del"... once i press those buttons, it does the second command...
-
Jun 20th, 2005, 08:00 PM
#8
Re: Group of commands
 Originally Posted by smart_phil_dude1
it won't do the commands!!! it does the first command and tht's it.. then the computer freezes until i press "Ctrl+Alt+Del"... once i press those buttons, it does the second command...
OK, then let me suggest again that you post your code.
-
Jun 20th, 2005, 08:32 PM
#9
Re: Group of commands
Might be that the first command you executed is run then the second one is run too and they messed up each other, post your code so we could take a look at it...
-
Jun 21st, 2005, 04:12 PM
#10
Thread Starter
Lively Member
Re: Group of commands
ok, sure... here it is :
VB Code:
Private Sub Command16_Click()
If List1.ListIndex <> -1 Then
P.X = -30
P.Y = -30
ret& = ClientToScreen&(Form1.hwnd, P)
P.X = P.X + Me.ScaleWidth / 2
P.Y = P.Y + Me.ScaleHeight / 2
ret& = SetCursorPos&(P.X, P.Y)
Sleep 1000
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0&, 0&, cButt, dwEI
Sleep 1000
P.X = -72
P.Y = -72
ret& = ClientToScreen&(Form1.hwnd, P)
P.X = P.X + Me.ScaleWidth / 2
P.Y = P.Y + Me.ScaleHeight / 2
ret& = SetCursorPos&(P.X, P.Y)
Sleep 1000
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0&, 0&, cButt, dwEI
Sleep 1000
SendKeys (ReadINI("Autologin", "Name" & List1.ListIndex + 1, ini_path) & "{enter}" & Decrypt(" " & ReadINI("Autologin", "Pass" & List1.ListIndex + 1, ini_path)))
Sleep 1000
P.X = -30
P.Y = -40
ret& = ClientToScreen&(Form1.hwnd, P)
P.X = P.X + Me.ScaleWidth / 2
P.Y = P.Y + Me.ScaleHeight / 2
ret& = SetCursorPos&(P.X, P.Y)
Sleep 1000
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0&, 0&, cButt, dwEI
End If
End Sub
-
Jun 21st, 2005, 06:19 PM
#11
Re: Group of commands
What you are doing is unfamiliar to me but here are some things I found with some research on the web.
- You should check your ret values for 0 (fail).
- mouse_event function has been superseded and you should use SendInput instead
What are you trying to do with that SendKeys line?
Which specific command doesn't work?
-
Jun 24th, 2005, 02:54 PM
#12
Thread Starter
Lively Member
Re: Group of commands
ok, well... all commands work alone, but together, nothing happens...
and the SendKeys is to loggin to a game.. tht's what it's for..
-
Jun 24th, 2005, 03:03 PM
#13
Re: Group of commands
 Originally Posted by smart_phil_dude1
ok, well... all commands work alone, but together, nothing happens....
Not possible.
-
Jun 24th, 2005, 06:37 PM
#14
Thread Starter
Lively Member
Re: Group of commands
what do u mean it's not possible? not possible to make it go in order?
-
Jun 24th, 2005, 11:50 PM
#15
Re: Group of commands
No I mean that it's not possible that they work seperately but not together.
Have you tried F8-ing through the code?
Have you looked at the screen while doing that to see if anything has happened?
-
Jun 25th, 2005, 12:00 AM
#16
Re: Group of commands
Just a thought, why dont you try splitting up your code into several subs then call those subs from a "main" sub?
-
Jun 26th, 2005, 02:17 PM
#17
Thread Starter
Lively Member
Re: Group of commands
well, i'm not tht good with vb and not sure how to work with subs...
but it does work alone, and not together... and what does F8 do?
-
Jun 26th, 2005, 02:28 PM
#18
Re: Group of commands
 Originally Posted by smart_phil_dude1
... and what does F8 do?
Here's a short lesson on debugging.
- Place your cursor on the first line of code in the Command16_Click sub and press F9. You can also just click in the margin to the left of the line. Either of those ways will put a breakpoint on the line as indicated by the red bullet in the left margin.
- Run you program and click Command16 and the code will stop at that line.
- Highlight List1.ListIndex and then click the Quick Watch button (the pair of eyeglasses) in the menu bar. That will reveal the value of the ListIndex.
- Press F8. That will take you to the next line of code.
-
Jun 29th, 2005, 11:31 AM
#19
Thread Starter
Lively Member
Re: Group of commands
ah, i c, thnx man,
peace out,
Phil.D.
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
|