Jump to content
Sign in to follow this  
Mat

GUICtrlCreateFinder

Recommended Posts

Mat

NEW VERSION -->

Based on lazycats example, this makes it very easy to use the cool little icon we all use in the window info tool. I have tried to make it as simple as possible to use, so all the users need to do is create the control, and treat the messages as you would any other control. You can also use the follwing variables to see whats happening:

* $FINDER_OPEN - Returns True if the control is currently searching

* $FINDER_HWND - The handle to the control it is currently (or last) over.

* $FINDER_CLASS - The class.

* $FINDER_PARENT - the parent of the control (handle)

* $FINDER_TITLE - The title of the window.

Posted Image

example 1: Simple notification:

#Include "GUIFinder.au3"

$hGUI = GUICreate ("Test")

$hFinder = GUICtrlCreateFinder (2, 2)

GUISetState ()

While 1
   Switch GUIGetMsg ()
      Case -3
         Exit
      Case $hFinder
         MsgBox (0, "Finder tool used", WingetTitle ($FINDER_PARENT) & @CRLF & $FINDER_CLASS)
   EndSwitch
WEnd

Example 2: Checking in a loop for changes.

#Include "GUIFinder.au3"

$hGUI = GUICreate ("Test")

$hFinder = GUICtrlCreateFinder (2, 2)

$hHwndInp = GUICtrlCreateInput ("", 40, 40, 100, 20)
$hClassInp = GUICtrlCreateInput ("", 40, 62, 100, 20)
$hParInp = GUICtrlCreateInput ("", 40, 84, 100, 20)
$hTitleInp = GUICtrlCreateInput ("", 40, 106, 100, 20)

GUISetState ()

While 1
   Switch GUIGetMsg ()
      Case -3
         Exit
   EndSwitch
   If $FINDER_OPEN And (String ($FINDER_HWND) <> GUICtrlRead ($hHwndInp)) Then
      GUICtrlSetData ($hHwndInp, $FINDER_HWND)
      GUICtrlSetData ($hClassInp, $FINDER_CLASS)
      GUICtrlSetData ($hParInp, $FINDER_PARENT)
      GUICtrlSetData ($hTitleInp, $FINDER_TITLE)
   EndIf
WEnd

And a download link for a zip:

http://code.google.com/p/m-a-t/downloads/detail?name=GUIFinder.zip

Mat

Edited by Mat

Share this post


Link to post
Share on other sites
AlmarM

Sweet! :)


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites
AlmarM

Just you wait till you see what i'm doing with it ;)

Mat

Sounds interesting... Im waiting :)

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites
Mat

Sounds interesting... Im waiting :)

I'm busy building in a control outline thingy like the real thing, and thats coming along nicely ;)read here.

As for whats going to happen with it... A more simple example is almost finished, its going to be a key sender, that has the added advantage of being able to send to hidden controls. So you can now spam people on MSN or whatever you want to whilst the window is hidden.

Mat

Share this post


Link to post
Share on other sites
Dolemite50

Nicely done, Mat! You've been a kicking out some good stuff.

Share this post


Link to post
Share on other sites
wraithdu

I've got a version here from another project with control highlighting (if you need inspiration). It uses GDI+ instead of the GUI method in your linked post.

http://www.autoitscript.com/forum/index.php?showtopic=102870

Edited by wraithdu

Share this post


Link to post
Share on other sites
Mat

Nicely done, Mat! You've been a kicking out some good stuff.

Thanks!

I've got a version here from another project with control highlighting (if you need inspiration). It uses GDI+ instead of the GUI method in your linked post.

http://www.autoitscript.com/forum/index.php?showtopic=102870

Yep. Its a lot cleaner and its taken me very little time to see exactly what its doing :) Not completelu sure about the colour though, Black or red seems a much better choice than your light blue.

Share this post


Link to post
Share on other sites
Dolemite50

I've got a version here from another project with control highlighting

Nice, wraithdu. That highlighting is smooooth. The only beef I had was that it didn't provide classes in realtime but that shouldn't be too hard for me to tweak. I liked the blue, those red highlights make me think error.

Share this post


Link to post
Share on other sites
Mat

Nice, wraithdu. That highlighting is smooooth. The only beef I had was that it didn't provide classes in realtime but that shouldn't be too hard for me to tweak. I liked the blue, those red highlights make me think error.

Kk, Black? I don't know how well it'll stand out though... I think reds good because very few programs do use it (except for errors) so it should stand out. How about an option for it... That'll be better.

Mat

Share this post


Link to post
Share on other sites
yashrai

i.waant.make.GUICtrlCreateFinder text.finder(mache)........

in..with........inputbox............

pls........help...me

Share this post


Link to post
Share on other sites
Mat

....kk....Is.this.it? :)

#Include "GUIFinder.au3"

$hGUI = GUICreate ("Test")

$hFinder = GUICtrlCreateFinder (2, 2)

$hTextInp = GUICtrlCreateEdit ("", 40, 40, 200, 300)

GUISetState ()


$curHwnd = 0
While 1
   Switch GUIGetMsg ()
      Case -3
         Exit
   EndSwitch
   If $FINDER_OPEN And ($FINDER_HWND <> $curHwnd) Then
      $curHwnd = $FINDER_HWND
      GUICtrlSetData ($hTextInp, ControlGetText ($FINDER_HWND, "", ""))
   EndIf
WEnd

Mat

Share this post


Link to post
Share on other sites
wraithdu

I went with the slightly transparent blue to stand out. Black blends in too much. It was an arbitrary choice and can be changed in the _Init() function where the GDI+ pen is created. Now, the app Sandboxie has a version of this too, but its highlights use some kind of sligtly transparent inverse color border that looks pretty slick. I have no idea how to create that though.

@Dolemite50

The purpose of my script is to get the text from password obscured input/edit controls, so yeah it only gives info after you've selected a control. But yes, you could easily tweak it to update whatever info you need on the fly.

I also adapted that script from Lazycat's example :)

Share this post


Link to post
Share on other sites
Mat

I like the way you used .ico files (and a cursor file) instead of the resources thing Lazycat did. That looks very tidy, but i'm not sure its ideal for a UDF to do that.

I am building in a funtction called "GUICtrlFinderSetOpt" or something along those lines, that'll look similar to autoits "Opt".

If you want something in there just ask, its just a big switch statement with current options: "FrameColour" and "FrameDisplay", as well as one called "NotifyOn", which will change when a message is sent to the dummy control.

Mat

Share this post


Link to post
Share on other sites
corgano

How do I nominate for MVP?

does it return anything besides $FINDER_HWND, $FINDER_CLASS, $FINDER_PARENT, and $FINDER_TITLE ?


0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Share this post


Link to post
Share on other sites
Mat

How do I nominate for MVP?

does it return anything besides $FINDER_HWND, $FINDER_CLASS, $FINDER_PARENT, and $FINDER_TITLE ?

No... Since it's actually only returning things found out from $FINDER_HWND, you should be able to do that for yourself (see my example 2 posts below to get the control text).

What is it you need?

heres what it does now.

$FINDER_HWND   = $hWndUnder
   $FINDER_PARENT = _GUI_FINDER_GET_PARENT ($hWndUnder)
   $FINDER_CLASS  = _GUI_FINDER_GET_CLASS ($hWndUnder)
   $FINDER_TITLE  = WinGetTitle ($hWndUnder)

Mat

Edited by Mat

Share this post


Link to post
Share on other sites
wraithdu

That looks very tidy, but i'm not sure its ideal for a UDF to do that.

I agree, not ideal for a UDF. But I didn't like the temporary files Lazycat was using, so decided to go with embedded resources, which is a great route for a final distribution.

Share this post


Link to post
Share on other sites
Mat

Agreed. I could do something clever and embed the resources on compile. Detecting and changing resources depending on @Compiled would not be a problem, so If I could find a way to embed them, could I use the Run_Before command, to create the resources, embed them like you have, and then delete them afterwards.

I then need to check if said resources exist, as they may not have used Au3Wrapper to compile...

I reckon its possible. :)

Mat

Share this post


Link to post
Share on other sites
Mat

updated!! Thanks a lot to Wraithdu and his amazing GDI+ frame creation stuff! very helpful.

You can set to show the frame, what colour it should be (I kept default as black :)), and you can now also set when to be notified. Current times are start and finish. Default is finish only.

New example:

#Include "GUIFinder.au3"

$hGUI = GUICreate ("Test")

$hFinder = GUICtrlCreateFinder (2, 2)

_FinderSetOpt ("FrameColour", 0xFFFF0000)

GUISetState ()

While 1
   Switch GUIGetMsg ()
      Case -3
         Exit
   EndSwitch
WEnd

Next up, embedding resources on compile! If I can get that working then I might just get some sleep tonight.

Mat

Share this post


Link to post
Share on other sites
131738

Based on lazycats example, this makes it very easy to use the cool little icon we all use in the window info tool. I have tried to make it as simple as possible to use, so all the users need to do is create the control, and treat the messages as you would any other control. You can also use the follwing variables to see whats happening:

* $FINDER_OPEN - Returns True if the control is currently searching

* $FINDER_HWND - The handle to the control it is currently (or last) over.

* $FINDER_CLASS - The class.

* $FINDER_PARENT - the parent of the control (handle)

* $FINDER_TITLE - The title of the window.

Posted Image

example 1: Simple notification:

#Include "GUIFinder.au3"

$hGUI = GUICreate ("Test")

$hFinder = GUICtrlCreateFinder (2, 2)

GUISetState ()

While 1
   Switch GUIGetMsg ()
      Case -3
         Exit
      Case $hFinder
         MsgBox (0, "Finder tool used", WingetTitle ($FINDER_PARENT) & @CRLF & $FINDER_CLASS)
   EndSwitch
WEnd

Example 2: Checking in a loop for changes.

#Include "GUIFinder.au3"

$hGUI = GUICreate ("Test")

$hFinder = GUICtrlCreateFinder (2, 2)

$hHwndInp = GUICtrlCreateInput ("", 40, 40, 100, 20)
$hClassInp = GUICtrlCreateInput ("", 40, 62, 100, 20)
$hParInp = GUICtrlCreateInput ("", 40, 84, 100, 20)
$hTitleInp = GUICtrlCreateInput ("", 40, 106, 100, 20)

GUISetState ()

While 1
   Switch GUIGetMsg ()
      Case -3
         Exit
   EndSwitch
   If $FINDER_OPEN And (String ($FINDER_HWND) <> GUICtrlRead ($hHwndInp)) Then
      GUICtrlSetData ($hHwndInp, $FINDER_HWND)
      GUICtrlSetData ($hClassInp, $FINDER_CLASS)
      GUICtrlSetData ($hParInp, $FINDER_PARENT)
      GUICtrlSetData ($hTitleInp, $FINDER_TITLE)
   EndIf
WEnd

And a download link for a zip:

http://m-a-t.googlecode.com/files/GUIFinder.zip

Mat

It seems can not detect "Static" control, and would undermine the "Static" control. Thanks!

Share this post


Link to post
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
Sign in to follow this  

×