News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Sending click buttons.

Started by Nilrem, May 05, 2005, 09:15:17 PM

Previous topic - Next topic

Nilrem

Sorry about another thread but I am really stuck.

If I had a normal window with edit controls etc I could find the dialog info and send a message to it, never done it but I think I understand the concept.
However in a browser window on a webpage a button is often an image, for example the reply button or search button on this forum. How could I click that, would I some how have to find it using a pixel match algorithm? I know I could find the x,y position but they could easily change on other resolutions or Hutch actually moved them. I know it isn't impossible because I know some programs that already do this. I could have the user click and set the position but users prefer to be as lazy as possible. ;)

Mark Jones

Where is this going? Executable files auto-clicking webpages... sounds like a very bad thing. I don't see the point WHY this would be desireable. What comes to mind is autonomous account registration/abuse, spam mailers, bots, D.O.S. attacksi, etcetera.
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

Nilrem

Just because the code could be for malicious intentions doesn't mean I shouldn't be helped. Remember the word maybe. Anything could be turned into malicious code. In another thread I stated it was for a game on pogo.com, this is still the case, it could actually be useful for other stuff, actually most webpages require an authentication number to be inserted. I understand your concerns but I shouldn't be one of them. 8-)

Nilrem

GetPixel and SetCursor are the only logical apis that spring to mind, but it seems a long way moving by a pixel at a time and then using get pixel.

QvasiModo

IMHO you should either parse the HTML file, or use the IE APIs. GetPixel seems like a bad idea anyway, if the target webpage changes the "submit" button you have to rewrite your app. But I'm just guessing... never tried to write an app like this.

Nilrem

HTML uses <br> to position images right? Not actual co-ords. Thanks though.
I have a knew theory I think:

Get the window position and fill a rect struct.
Then from there get the co-ords of the image that needs to be clicked. Make sure it matches with get pixel.

Only problem is will have to write it for various resolutions if I wanted to give it out.

QvasiModo

Not only that, HTML code may render differently if the browser window is resized. :(

Another idea: how about enumerating the browser's child windows?

Nilrem

Could you please expand on that please? Thankyou.


pbrennick

#9
Nilrem,
The <BR> tag can be loosely interpreted to mean 'Begin Rule' and just tells the browser to begin a new line.

This is very far from what you said!!

Stay well,
Paul

Nilrem

Sorry for been stupid, but is this what it means it will get the handle of each child window, of for example Internet Explorer, it is used instead of GetWindows in a loop, right?

If there is different sizes I can just send a message to restore, or maximize it, I have tested this and it works. Therefore I could position it at 0,0 of the screen resoloution. Then find out what screen resolution is been used and act accordingly. However I do not prefer this method because it is not efficient to have different sets of code to act on certain resolutions. However it is the only solution I can think of unless I put the window in the top left (0,0) of the screen then use GetPixel to try and find the button. This really is an interesting topic. 8-)

Tedd

Would it be possible to use GetChildWindow, to try to 'find' the button - so you can then get its co-ordinates?



Paul - <BR> could also be taken as meaning BReak :bdg
No snowflake in an avalanche feels responsible.

Nilrem

Well it isn't a window, it's probably a bitmap or jpeg, or even a gif, well doesn't matter about the format, it's an image so I don't think that would work. Unless it's written in java? I can't right click the button to see if it is an image you see.... 8-S

Tedd

Okay, so a slightly more mischevious way would be to find part of the image by matching it against the same part held in memory :green
This means you take a snapshot of the part of the image you want to find and store that in your program executable. Then, search the image of the window until you find pixels that match with this image - presto! It does require a little more coding though :bdg
No snowflake in an avalanche feels responsible.

Nilrem

I already said something similar, but this wasn't storing part of it in memory, hopefully can get away with useing GetPixel (to get the colour code initially) then set the window as the foreground and check for the pixel at different positions. 8-)