Jump to content

GUICtrlCreateFinder


Mat
 Share

Recommended Posts

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

How do I nominate for MVP?

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

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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!

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