 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
NewGuest Guest
|
Posted: Mon Dec 28, 2009 4:13 pm Post subject: How to Drag icon over another window |
|
|
I would really appreciate if someone could help me with this one. I want to basically create a GUI window where I would like to place a icon, which can be dragged over say another window, and based on which window I drag the icon to, it would perform certain action.
Example:
A small utility that I have seen is a password unmask, where if we drag a crosseye icon to the field which is a password, it would reveal the password for us. I hope you understand what I mean.
Another example:
For those who have used Winspector, I have just happened to install and just see what it is, not really worked extensively with this software, however in this software there is a small cross icon which can be clicked-dragged over another application/software window and it would detect various properties of that window etc.
Well basically I want to do something like that, I want to create a GUI which will have a small icon/image, which I will click and drag on an embedded flash element on a website & it would detect the html code and xpos, ypos, width, height of the embedded flash element.
Please someone help, or at least give me a clue how to begin with. I dont want the code how to get the html code or the coordinates of the flash but I want the click-drag icon/image feature and upon drop of the image over the target window it should detect it.
Thanks in advance. |
|
| Back to top |
|
 |
Roland
Joined: 08 Jun 2006 Posts: 307
|
Posted: Mon Dec 28, 2009 5:30 pm Post subject: |
|
|
Something like this I imagine:
| Code: | #NoEnv
#SingleInstance force
Gui, -caption +0x800000
Gui, Margin, 5, 5
Gui, Add, Pic, vpic gpicClicked icon110, shell32.dll
Gui, 2: +toolwindow +lastfound
Gui, 2: Margin, 0, 0
WinSet, Transparent, 230
Gui, 2:-caption +0x800000
Gui, 2: Add, Pic, icon110, shell32.dll
Gui, Show
return
picClicked:
Gui, 1:+lastfound
WinGetPos, x, y
Gui, 2:Show, % "x" x+5 "y" y+5
Gui, 2:+lastfound
; see http://www.autohotkey.com/forum/viewtopic.php?p=64185#64185
PostMessage, 0xA1, 2
KeyWait, LButton, Up
Gui, 2:hide
return
GuiClose:
exitApp |
|
|
| Back to top |
|
 |
Learning one
Joined: 04 Apr 2009 Posts: 1001 Location: Croatia
|
Posted: Mon Dec 28, 2009 6:50 pm Post subject: |
|
|
| Roland's example is excellent, but if you want something that looks better, study GDI+ |
|
| Back to top |
|
 |
NewGuest Guest
|
Posted: Tue Dec 29, 2009 2:39 am Post subject: |
|
|
Thank you Roland & Learning one for the code as well as the tutorial link, however what I am looking for is a normal GUI which has a small image / icon with other normal gui controls like button, text etc. But when I click on the image / icon and drag it on to another window say notepad, it should show me the details of the notepad window such as the window title, height and width of the window etc.
This is just an example for understanding, though this is not my real purpose.
My real purpose is to make such a program and drag the icon on a flash game on internet after which the program can give me the information about height, width, top, bottom coordinates of that embedded flash on the website.
Thanks in advance. |
|
| Back to top |
|
 |
Roland
Joined: 08 Jun 2006 Posts: 307
|
Posted: Tue Dec 29, 2009 2:56 pm Post subject: |
|
|
My script is just an example, you'll need to modify it. I used a GUI without titlebar and borders so the code to calculate the offset would be simple.
What you do when the user "drops" the icon is up to you (you probably want to start by getting the window under the mouse with MouseGetPos). |
|
| Back to top |
|
 |
NewGuest Guest
|
Posted: Wed Dec 30, 2009 6:59 am Post subject: |
|
|
| Thanks Roland, I have now been able to perform the task with your help. Hats off to you. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|