Jump to content

Visual Basic 6


AC130
 Share

Recommended Posts

Hello, I am trying to use AutoitX with visual basic 6.

I already registered the DLL, and called it in my general section.

What I'm trying to do is MouseMove to a location in calculator.

cAutoit.Opt ("MouseCoordMode,2")

But whenever I try to run this, it says;

"Invalid Outside Procedure"

Could someone help me out here?

Link to comment
Share on other sites

Ok I'll try that. Do I put it in general section?

How to make it only work in calculator?

Do I need WinGetHandle?

If so, how do I use that? Thanks for replying also.

Edit: When I use your code it says, "Compile error, Expected: ="

Edited by AC130
Link to comment
Share on other sites

Hello everyone again. Just a few questions.

Does PixelSearch automatically search for a pixel in the active window, or is it the whole screen?

Also, could someone post an example of using PixelSearch using AutoItX.

In Autoit, I use:

PixelSearch ( 0, 0, 500, 500, 0x000000, DEFAULT, DEFAULT, $hwnd)

However this is not working in Visual Basic. I tried removing the parentheses.

I have definitely tried...

Edited by AC130
Link to comment
Share on other sites

However this is not working in Visual Basic.

Private Sub Form_Load()
Dim cAutoIt As New AutoItX3
Dim c() As Variant
c = cAutoIt.PixelSearch(0, 0, 500, 500, &HFF0000, -1, -1)
MsgBox c(0) & vbCrLf & c(1)
End Sub
Link to comment
Share on other sites

What exactly you can not? Have you even tried to run in Visual Basic 6 the code posted above?

That was a working example of how to use that PixelSearch function in VB6, not a full-blown one.

Link to comment
Share on other sites

Well thanks guys. Everything is working good now. Could you help me do one more thing though?

I'm trying to pixelsearch until the pixel is found. so far I have

Do Until Not Error
c = cAutoIt.PixelSearch(0, 0, 500, 500, &HFF0000, -1, -1)
Loop
MsgBox ( "Pixel Found" )

This I guess isn't working though, considering that I now the pixel is there, and it isn't message boxing.

Thanks in advance. :)

Link to comment
Share on other sites

ok well in AutoIt i use this:

Func Search ()
Do
PixelSearch ( 0, 0, 50, 50, 0x000000, DEFAULT, DEFAULT)
Until Not @Error
MsgBox (0, "Success", "Pixel Found" )
EndFunc

This code keeps pixelsearching in that area until 0x000000 color is found, and then once it's found it Message boxes, Pixel Found.

I'm trying to do that in VB6.

Link to comment
Share on other sites

Ok here is my current code:

Do Until NonError
PixelSearch = cAutoIt.PixelSearch ( 1000, 1000, 1000, 1000, &H0000000)
Loop
MsgBox ( "Pixel Found" )

NonError:
PixelSearch1 = cAutoIt.PixelSearch ( 1000, 1000, 1000, 1000, &H0000000) = True
EndSub

But it's not working, even though I know the pixel is there. Thanks in advance...

Edited by AC130
Link to comment
Share on other sites

Case vbKeyF1
PixelSearch = 0
Do While PixelSearch = 0
    PixelSearch = cAutoit.PixelSearch(1000, 1000, 1000, 1000, &H0)
Loop
MsgBox ("Pixel Found")
End Select

Whenver I run this, it automatically says Pixel Found even if it's not there.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...