change the "&" to "and" . should work
Hey all, i'm working on a program, wich has to change from picture on some mouseclicks. heres my code:
now everthing works fine, except for this code:Code:Declare Function GetKeyState Lib "user32.dll" (ByVal KeyCode As Long) As Integer Const VK_LBUTTON = &H1 Const VK_RBUTTON = &H2 Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer4.Tick If GetAsyncKeyState(VK_LBUTTON) Then Form3.BackgroundImage = My.Resources.pic2 ElseIf GetAsyncKeyState(VK_RBUTTON) & GetAsyncKeyState(VK_LBUTTON) Then Form3.BackgroundImage = My.Resources.pic4 ElseIf GetAsyncKeyState(VK_RBUTTON) Then Form3.BackgroundImage = My.Resources.pic3 Else Form3.BackgroundImage = My.Resources.pic1 End If End Subi want it to change to pic4, when i click L AND R button, but when i do, it just changes to pic2....Code:ElseIf GetAsyncKeyState(VK_RBUTTON) & GetAsyncKeyState(VK_LBUTTON) Then Form3.BackgroundImage = My.Resources.pic4
Any help please?
Last edited by Acinonyx Backup; 03-03-2011 at 07:55 AM.
Currently banned for 1337 posts
till 28-4-2013
Sex is like a joke, some people get it, some people don't
change the "&" to "and" . should work
omg :O i'll try
naha, not working
Last edited by Acinonyx Backup; 03-03-2011 at 08:15 AM.
Currently banned for 1337 posts
till 28-4-2013
Sex is like a joke, some people get it, some people don't
how bout changing it to this, just a hunch
i think the problem is, it already went inside the 1st if, so it will make it pic2, it doesnt have the chance to check 2nd if condition,Code:Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer4.Tick If GetAsyncKeyState(VK_LBUTTON) Then If GetAsyncKeyState(VK_RBUTTON) Form3.BackgroundImage = My.Resources.pic4 Else Form3.BackgroundImage = My.Resources.pic2 ElseIf GetAsyncKeyState(VK_RBUTTON) Then Form3.BackgroundImage = My.Resources.pic3 Else Form3.BackgroundImage = My.Resources.pic1 End If End Sub
if u want, u can make the 1st if condition to check if L and R is press, then the 2nd if is for if L is pressed
Last edited by karldeovbnet; 03-03-2011 at 08:27 AM.
VB.Noob
i'm here to learn and contribute as much as i can to the community
~ako si karl deo~
i'll try thx
you need 2 end if's ofc.
Error 1 'ElseIf' must be preceded by a matching 'If' or 'ElseIf'.
Error 2 'Else' must be preceded by a matching 'If' or 'ElseIf'.
Last edited by Acinonyx Backup; 03-03-2011 at 08:41 AM.
Currently banned for 1337 posts
till 28-4-2013
Sex is like a joke, some people get it, some people don't
or using ur original code:Code:Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer4.Tick If GetAsyncKeyState(VK_LBUTTON) Then If GetAsyncKeyState(VK_RBUTTON) Form3.BackgroundImage = My.Resources.pic4 Else Form3.BackgroundImage = My.Resources.pic2 End If < Forgot to add this end if ElseIf GetAsyncKeyState(VK_RBUTTON) Then Form3.BackgroundImage = My.Resources.pic3 Else Form3.BackgroundImage = My.Resources.pic1 End If End Sub
Code:Declare Function GetKeyState Lib "user32.dll" (ByVal KeyCode As Long) As Integer Const VK_LBUTTON = &H1 Const VK_RBUTTON = &H2 Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer4.Tick If GetAsyncKeyState(VK_LBUTTON) Then < make this 2nd condition Form3.BackgroundImage = My.Resources.pic2 ElseIf GetAsyncKeyState(VK_RBUTTON) & GetAsyncKeyState(VK_LBUTTON) Then < make this 1st condition Form3.BackgroundImage = My.Resources.pic4 ElseIf GetAsyncKeyState(VK_RBUTTON) Then Form3.BackgroundImage = My.Resources.pic3 Else Form3.BackgroundImage = My.Resources.pic1 End If End Sub
Last edited by karldeovbnet; 03-03-2011 at 08:45 AM.
VB.Noob
i'm here to learn and contribute as much as i can to the community
~ako si karl deo~
Acinonyx Backup (03-03-2011)
Not working :S
got it working myself, thx for trying to help me, thanks to you i found a way through it...
working code:
Code:If GetAsyncKeyState(VK_RBUTTON) Then If GetAsyncKeyState(VK_LBUTTON) Then Form3.BackgroundImage = My.Resources.pic4 Else Form3.BackgroundImage = My.Resources.pic3 End If ElseIf GetAsyncKeyState(VK_LBUTTON) Then Form3.BackgroundImage = My.Resources.pic2 Else Form3.BackgroundImage = My.Resources.pic1 End If
Currently banned for 1337 posts
till 28-4-2013
Sex is like a joke, some people get it, some people don't
That's why people mostly learn the basics before going to advanced stuff
Try this next time:
That stops you from coding with 1oo wordsCode:Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer4.Tick If GetAsyncKeyState(VK_LBUTTON) Then Form3.BackgroundImage = My.Resources.pic2 Else Form3.BackgroundImage = My.Resources.pic4 End If If GetAsyncKeyState(VK_RBUTTON) Then Form3.BackgroundImage = My.Resources.pic3 Else Form3.BackgroundImage = My.Resources.pic1 End If If GetAsyncKeyState(VK_LBUTTON) and GetAsyncKeyState(VK_RBUTTON) Then Form3.BackgroundImage = "" Else Form3.BackGroundImage = My.Resourse.pic1 End If End Sub 'That worked for me just fine :D
Last edited by Skinnlaw; 03-03-2011 at 09:20 AM.
I actually learned the basics, and i'm known as an advanced coder @ many other forums...
just didn't know this yet. i got stuck be4 on 2 ifs in 1, and i fixed it, but that didn't work here either :S im kinda tired aswell....
Yes, i tried that b4, and that doesn't work... as you can see in the previous posts...
Currently banned for 1337 posts
till 28-4-2013
Sex is like a joke, some people get it, some people don't
You can win the rat race,Originally Posted by Jeremy S. Anderson
But you're still nothing but a fucking RAT.
++Latest Projects++
[Open Source] Injection Library
Simple PE Cipher
FilthyHooker - Simple Hooking Class
CLR Injector - Inject .NET dlls with ease
Simple Injection - An in-depth look
MPGH's .NET SDK
eJect - Simple Injector
Basic PE Explorer (BETA)
Blubb1337 (03-04-2011)
Currently banned for 1337 posts
till 28-4-2013
Sex is like a joke, some people get it, some people don't
AndAlso
& is used to join strings
[highlight=vb.net]If True = True AndAlso True <> False Then MsgBox("LOL!")[/highlight]
Last edited by master131; 03-03-2011 at 10:07 PM.
Donate:
BTC: 1GEny3y5tsYfw8E8A45upK6PKVAEcUDNv9
Handy Tools/Hacks:
Extreme Injector v3.7.3
A powerful and advanced injector in a simple GUI.
Can scramble DLLs on injection making them harder to detect and even make detected hacks work again!
Minion Since: 13th January 2011
Moderator Since: 6th May 2011
Global Moderator Since: 29th April 2012
Super User/Unknown Since: 23rd July 2013
'Game Hacking' Team Since: 30th July 2013
--My Art--
[Roxas - Pixel Art, WIP]
[Natsu - Drawn]
[Natsu - Coloured]
All drawings are coloured using Photoshop.
--Gifts--
[Kyle]
ChocoBoyJr (03-04-2011)