Jump to content

How get the ID of an object when mouse was clicked


BennyB
 Share

Recommended Posts

First excuse my english, it isn't my foreign language.

I woult like to get the ID of an object when the mouse button was pressed.

Or when a keystroke was done.

Have anybody an idea?

Thanks for help

DllCall() and Win API function WindowFromPoint() http://msdn.microsoft.com/library/en-us/wi....asp?frame=true

Cheers

Kurt

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

I'm not a specialist in programming whit windows components.

I've tried following .vbs code:

Option Explicit
Dim oShell
Dim oAutoIt

Dim temp
Dim temp2

Set oShell = WScript.CreateObject("WScript.Shell")
Set oAutoIt = WScript.CreateObject("AutoItX3.Control")
Set oTemp = WScript.CreateObject("user32.dll")

oAutoIt.Run "c:\windows\notepad.exe"

oAutoIt.WinWait "Unbenannt",""
oAutoIt.ControlSend "Unbenannt ", "", 15, "{ENTER}"

temp2 = MouseGetPos()
temp = oTemp.WindowFromPoint(temp2)

oAutoTi.ControlSend "Unbenannt ", "", 15, temp

WScript.Quit

Error: "An automaticclass with the name user32.dll wasn't found"

My aim is, that i would like to have the ID of an Button in a variable.

Thanks for helping me

Link to comment
Share on other sites

OK.

I solve a part of my problem, but..

At the moment I can get the position of the mouse and the controlname of the item under it.

But I can't verify if the mouse was clicked.

I would not have the name of the controls I mouseover.

I hope you understand me.

A part of my code below (c++):

mousepos.x = AU3_MouseGetPosX();
        mousepos.y = AU3_MouseGetPosY();
        window = WindowFromPoint(mousepos);

        GetWindowText(window, pcWinTitle, 255);
Link to comment
Share on other sites

@Larry has a some samples in Example Scripts showing how to do this in autoit.

What you can do in c++

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...