Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[VB6] Invalid procedure call or argument [Closed]

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
LiquidNeon
Cheater
Reputation: 0

Joined: 26 Oct 2007
Posts: 32

PostPosted: Fri Jan 04, 2008 8:11 am    Post subject: [VB6] Invalid procedure call or argument [Closed] Reply with quote

My original idea was to execute a program then focusing on the particular program while this program sends keys that were set to the execute program.

However, I keep getting an error;

Runtime error '5'
Invalid procedure call or argument


Here's the code.
Code:

Private Sub execute_Click()
Shell "App Location", vbNormalFocus
End Sub

Private Sub Form_Load()
Label1.Caption = "Text"
Label2.Caption = "Text"
Label3.Caption = "Text"
Label4.Caption = "Text"
Label5.Caption = "Text"
Label6.Caption = "Text"
End Sub

Private Sub Timer1_Timer()
SendKeys "abc"
Timer1 = 10
End Sub

Private Sub stop_Click()
Timer1 = 0
End Sub

Private Sub start_Click()
AppActivate "App Name"
Timer1 = 1
End Sub


Help is very much appreciated.[/code]


Last edited by LiquidNeon on Fri Jan 04, 2008 9:14 am; edited 1 time in total
Back to top
View user's profile Send private message
Pseudo Xero
I post too much
Reputation: 0

Joined: 16 Feb 2007
Posts: 2607

PostPosted: Fri Jan 04, 2008 8:21 am    Post subject: Re: [VB6] Invalid procedure call or argument Reply with quote

LiquidNeon wrote:
My original idea was to execute a program then focusing on the particular program while this program sends keys that were set to the execute program.

However, I keep getting an error;

Runtime error '5'
Invalid procedure call or argument


Here's the code.
Code:

Private Sub execute_Click()
Shell "App Location", vbNormalFocus
End Sub

Private Sub Form_Load()
Label1.Caption = "Text"
Label2.Caption = "Text"
Label3.Caption = "Text"
Label4.Caption = "Text"
Label5.Caption = "Text"
Label6.Caption = "Text"
End Sub

Private Sub Timer1_Timer()
SendKeys "abc"
Timer1 = 10
End Sub

Private Sub stop_Click()
Timer1 = 0
End Sub

Private Sub start_Click()
AppActivate "App Name"
Timer1 = 1
End Sub


Help is very much appreciated.[/code]

Where is the error?
Back to top
View user's profile Send private message
Blader
I post too much
Reputation: 2

Joined: 19 Jan 2007
Posts: 2049

PostPosted: Fri Jan 04, 2008 8:23 am    Post subject: Reply with quote

Is Timer1 a string or something?
Maybe it should be Timer1.Interval?

_________________
Back to top
View user's profile Send private message
LiquidNeon
Cheater
Reputation: 0

Joined: 26 Oct 2007
Posts: 32

PostPosted: Fri Jan 04, 2008 8:49 am    Post subject: Reply with quote

Timer1_Timer() is not a string.

@ Xeno - That's the thing. I don't know where the error is.
Back to top
View user's profile Send private message
Blader
I post too much
Reputation: 2

Joined: 19 Jan 2007
Posts: 2049

PostPosted: Fri Jan 04, 2008 8:50 am    Post subject: Reply with quote

I mean this:
Timer1 = 10

_________________
Back to top
View user's profile Send private message
LiquidNeon
Cheater
Reputation: 0

Joined: 26 Oct 2007
Posts: 32

PostPosted: Fri Jan 04, 2008 8:53 am    Post subject: Reply with quote

@ Blader - I've tested it using a notepad and it does gives out any error. But, when I test it with a online game, it does.
Back to top
View user's profile Send private message
Blader
I post too much
Reputation: 2

Joined: 19 Jan 2007
Posts: 2049

PostPosted: Fri Jan 04, 2008 8:58 am    Post subject: Reply with quote

What are you trying to do with the timer?
I see you have:
Code:
Timer1 = 10

Timer1 = 0

Timer1 = 1


Btw, do you mean it works for notepad, but not online games?

_________________
Back to top
View user's profile Send private message
Pseudo Xero
I post too much
Reputation: 0

Joined: 16 Feb 2007
Posts: 2607

PostPosted: Fri Jan 04, 2008 9:03 am    Post subject: Reply with quote

It should highlight the error, or show you where it is.
Did you purposely make the Shell execute string "AppLocation?"
Back to top
View user's profile Send private message
Blader
I post too much
Reputation: 2

Joined: 19 Jan 2007
Posts: 2049

PostPosted: Fri Jan 04, 2008 9:06 am    Post subject: Reply with quote

I compiled it, and it showed an error here:
Code:
AppActivate "App Name"


I think you might have got the wrong application name, try checking it again

_________________
Back to top
View user's profile Send private message
LiquidNeon
Cheater
Reputation: 0

Joined: 26 Oct 2007
Posts: 32

PostPosted: Fri Jan 04, 2008 9:09 am    Post subject: Reply with quote

@ Xeno - It does not. And, yes.

Btw, I think its most probably the SendKeys thingy. Coz when I changed it to SendKeys "{Space}"
It gives out the similar error.
But, if I used the code as I've written in the first post, it doesn't.

So, do you have any suggestion on doing a -Space- using the sendkey function? Like {Space} or something else?

@ Blader - Still shows an error.

Nvm, I'll close this thread for a while now.
Back to top
View user's profile Send private message
Pseudo Xero
I post too much
Reputation: 0

Joined: 16 Feb 2007
Posts: 2607

PostPosted: Fri Jan 04, 2008 9:14 am    Post subject: Reply with quote

Code:
SendKeys " "
Back to top
View user's profile Send private message
LiquidNeon
Cheater
Reputation: 0

Joined: 26 Oct 2007
Posts: 32

PostPosted: Fri Jan 04, 2008 9:16 am    Post subject: Reply with quote

But, how can you put in CTRL & Space in the same time?
Back to top
View user's profile Send private message
Pseudo Xero
I post too much
Reputation: 0

Joined: 16 Feb 2007
Posts: 2607

PostPosted: Fri Jan 04, 2008 9:19 am    Post subject: Reply with quote

LiquidNeon wrote:
But, how can you put in CTRL & Space in the same time?

Code:
SendKeys "^( )"
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Fri Jan 04, 2008 6:24 pm    Post subject: Reply with quote

I see a lot of issues with this code. Firstly, you have 'Timer1' as Blader pointed out. This will do nothing since you don't use it anywhere other then giving it a value. If you are trying to alter the interval of the timer, you need to use Timer1.Interval. If you are trying to do something else with the timer, please state what you are trying to do with it.

As for AppActivate, the syntax for it is:

Quote:
AppActivate( Title, [Wait])


Meaning the Title is required, and the wait time is optional. The wait time is the time to have the program 'pause' before pulling the program into focus. For example:

Quote:
Private Sub Form_Load()
AppActivate "Untitled - Notepad", 5000
End Sub


The reason for your error? AppActive raises an error if it fails. The error that is raised is invalid procedure call meaning the first param, the title, was invalid and not found. You can either add:

Quote:
On Error Resume Next


Or add error handling to fail without crashing if this error arises.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites