 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
majkinetor
Joined: 24 May 2006 Posts: 3544 Location: Belgrade
|
Posted: Thu May 31, 2007 8:58 pm Post subject: |
|
|
LOL
Nothing but the truth.  _________________
 |
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2328
|
Posted: Fri Jun 01, 2007 3:09 am Post subject: |
|
|
| Chris wrote: | | For the next release, JGR has written the code to support built-in callbacks. I also hope to work on the mechanism for the standard library and a built-in Extract/InsertInteger. |
| Chris wrote: | | In v1.0.46.17, A_UserName was fixed (it had been broken by v1.0.46.16). |
Callbacks . Can you tell I'm anxious?  |
|
| Back to top |
|
 |
olfen
Joined: 04 Jun 2005 Posts: 99 Location: Stuttgart, Germany
|
Posted: Fri Jun 01, 2007 6:30 pm Post subject: |
|
|
| Thanks a lot for the 1.0.46.16 update and coming callback feature! |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10450
|
Posted: Sun Jun 10, 2007 9:45 pm Post subject: |
|
|
In case anyone has time to try it out, here's a test release that contains RegisterCallback():
(Update: The latest release has RegisterCallback.)
Thanks to JGR for developing it.
The documentation is at http://www.autohotkey.com/docs/commands/RegisterCallback.htm
Improvements to the documentation or syntax are welcome.
This sample release also contains NumGet() and NumPut(), as well as minor improvements to OnMessage() and Critical.
The next step is to add the stdlib mechanism, after which 1.0.47 will be released.
Last edited by Chris on Sun Jun 24, 2007 12:37 pm; edited 1 time in total |
|
| Back to top |
|
 |
Tuncay
Joined: 07 Nov 2006 Posts: 379 Location: Berlin
|
Posted: Sun Jun 10, 2007 9:57 pm Post subject: |
|
|
Hey that is a good idea giving us the chance to test in beta status. So those who want to can help you.
Why don`t you release beta versions on every big change, which would be a critical update?
I will download and test/play some around with that new feature. (can`t wait longer `till stdlib capability) |
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2328
|
Posted: Mon Jun 11, 2007 12:51 am Post subject: |
|
|
| Thanks for the opportunity to test drive the test version. I'll understand if it isn't but thought I'd ask anyway... Is the source available for the test version? |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1141
|
Posted: Mon Jun 11, 2007 1:13 am Post subject: |
|
|
| Chris wrote: | | In case anyone has time to try it out, here's a test release that contains RegisterCallback(): |
Thanks for the test build. It works fine so far.
BTW, would Fast mode better be the default?
I suppose most callback functions would work that way.
| Code: | DetectHiddenWindows, On
DllCall("EnumWindows", "Uint", RegisterCallback("Window", "Fast"), "Uint", 1)
Window(hWnd, lParam)
{
WinGetTitle, sTitle, ahk_id %hWnd%
WinGetClass, sClass, ahk_id %hWnd%
OutputDebug, % "hWnd: ". hWnd . "`tTitle: " . sTitle . "`tClass: " . sClass . (lParam ? "----------" : "")
If lParam
DllCall("EnumChildWindows", "Uint", hWnd, "Uint", A_EventInfo, "Uint", 0)
Return 1
}
|
|
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 3877 Location: Pittsburgh
|
Posted: Mon Jun 11, 2007 2:53 am Post subject: |
|
|
| Fantastic! Callbacks work perfectly in the TCClib script (which call the dll version of the Tiny C Compiler, with a C program in an AHK variable.) Error messages and warnings are returned via callbacks. A MsgBox in an AHK function shows now the TCC messages, if they are any. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10450
|
Posted: Mon Jun 11, 2007 3:41 am Post subject: |
|
|
Thanks for the feedback.
| Tuncay wrote: | | Why don`t you release beta versions on every big change, which would be a critical update? | It's a good practice, though sometimes the timing is such that it would significantly delay a release. Fortunately there are other tools such as polls that can help make the right design decisions.
| corrupt wrote: | | Is the source available for the test version? | It hasn't been packaged because there may be some polishing done. Also, JGR hasn't had a chance to review and approve the recent syntax changes, nor has the stdlib mechanism been added. 1.0.47 should be out within a week, but if you need it sooner I can put it together and e-mail it to you.
| Sean wrote: | would Fast mode better be the default?
I suppose most callback functions would work that way. | Originally it was the default but I intentionally reversed it to make its use a conscious/deliberate decision. If it becomes the default and is ever used by mistake, the script might begin displaying unpredictable behavior that would be very difficult to track down and isolate.
On the other hand, if it's felt that fast mode will be used more than 80% of the time, perhaps the convenience outweighs the risk of accidents.
Also, don't forget that every call to RegisterCallback() creates a new callback address -- even when the target function is the same as that of a previous call. Therefore, scripts should generally avoid calling RegisterCallback() more than once for a particular function (otherwise, it's usually a memory leak). |
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2328
|
Posted: Mon Jun 11, 2007 4:04 am Post subject: |
|
|
| Chris wrote: | | corrupt wrote: | | Is the source available for the test version? | It hasn't been packaged because there may be some polishing done. Also, JGR hasn't had a chance to review and approve the recent syntax changes, nor has the stdlib mechanism been added. 1.0.47 should be out within a week, but if you need it sooner I can put it together and e-mail it to you. | If it's not too much trouble I'd appreciate it. If it would take a considerable amount of time to put together then I'll wait. |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 3877 Location: Pittsburgh
|
Posted: Mon Jun 11, 2007 6:08 am Post subject: |
|
|
| I also tested Sean's keyboard hook script, with low level keyboard handler callback function. It also works perfectly. |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1141
|
Posted: Mon Jun 11, 2007 8:28 am Post subject: |
|
|
It also worked well with SetWinEventHook.
The omission of EVENT_OBJECT_VALUECHANGE (:0x800E) was intentional, as it made DbgView.exe irresponsive.
| Code: | hHook := SetWinEventHook(3, 3, pfn := RegisterCallback("WinEvent", "Fast"))
hHook1:= SetWinEventHook(0x8000, 0x800D, pfn)
hHook2:= SetWinEventHook(0x800F, 0x8012, pfn)
DetectHiddenWindows, On
OnExit, Unhook
#Esc::
Unhook:
OnExit
UnhookWinEvent(hHook)
UnhookWinEvent(hHook1)
UnhookWinEvent(hHook2)
ExitApp
WinEvent(hHook, nEvent, hWnd, idObject, idChild, nEventThread, nEventTime)
{
Critical
WinGetTitle, sTitle, ahk_id %hWnd%
WinGetClass, sClass, ahk_id %hWnd%
OutputDebug, % nEvent . "|" . "`thWnd: ". hWnd . "`tTitle: " . sTitle . "`tClass: " . sClass . "`tidObject: " . idObject . " idChild: " . idChild
}
SetWinEventHook(eventMin, eventMax, pfn)
{
Return DllCall("SetWinEventHook", "Uint", eventMin, "Uint", eventMax, "Uint", 0, "Uint", pfn, "Uint", 0, "Uint", 0, "Uint", 0)
}
UnhookWinEvent(hHook)
{
Return DllCall("UnhookWinEvent", "Uint", hHook)
}
/*
EVENT_MIN = 0x00000001
EVENT_SYSTEM_SOUND = 0x00000001
EVENT_SYSTEM_ALERT = 0x00000002
EVENT_SYSTEM_FOREGROUND = 0x00000003
EVENT_SYSTEM_MENUSTART = 0x00000004
EVENT_SYSTEM_MENUEND = 0x00000005
EVENT_SYSTEM_MENUPOPUPSTART = 0x00000006
EVENT_SYSTEM_MENUPOPUPEND = 0x00000007
EVENT_SYSTEM_CAPTURESTAR = 0x00000008
EVENT_SYSTEM_CAPTUREEND = 0x00000009
EVENT_SYSTEM_MOVESIZESTART = 0x0000000A
EVENT_SYSTEM_MOVESIZEEND = 0x0000000B
EVENT_SYSTEM_CONTEXTHELPSTART = 0x0000000C
EVENT_SYSTEM_CONTEXTHELPEND = 0x0000000D
EVENT_SYSTEM_DRAGDROPSTART = 0x0000000E
EVENT_SYSTEM_DRAGDROPEND = 0x0000000F
EVENT_SYSTEM_DIALOGSTART = 0x00000010
EVENT_SYSTEM_DIALOGEND = 0x00000011
EVENT_SYSTEM_SCROLLINGSTART = 0x00000012
EVENT_SYSTEM_SCROLLINGEND = 0x00000013
EVENT_SYSTEM_SWITCHSTART = 0x00000014
EVENT_SYSTEM_SWITCHEND = 0x00000015
EVENT_SYSTEM_MINIMIZESTART = 0x00000016
EVENT_SYSTEM_MINIMIZEEND = 0x00000017
EVENT_OBJECT_CREATE = 0x00008000
EVENT_OBJECT_DESTROY = 0x00008001
EVENT_OBJECT_SHOW = 0x00008002
EVENT_OBJECT_HIDE = 0x00008003
EVENT_OBJECT_REORDER = 0x00008004
EVENT_OBJECT_FOCUS = 0x00008005
EVENT_OBJECT_SELECTION = 0x00008006
EVENT_OBJECT_SELECTIONADD = 0x00008007
EVENT_OBJECT_SELECTIONREMOVE = 0x00008008
EVENT_OBJECT_SELECTIONWITHIN = 0x00008009
EVENT_OBJECT_STATECHANGE = 0x0000800A
EVENT_OBJECT_LOCATIONCHANGE = 0x0000800B
EVENT_OBJECT_NAMECHANGE = 0x0000800C
EVENT_OBJECT_DESCRIPTIONCHANGE = 0x0000800D
EVENT_OBJECT_VALUECHANGE = 0x0000800E
EVENT_OBJECT_PARENTCHANGE = 0x0000800F
EVENT_OBJECT_HELPCHANGE = 0x00008010
EVENT_OBJECT_DEFACTIONCHANGE = 0x00008011
EVENT_OBJECT_ACCELERATORCHANGE = 0x00008012
EVENT_CONSOLE_CARET = 0x00004001
CONSOLE_CARET_SELECTION = 0x00000001
CONSOLE_CARET_VISIBLE = 0x00000002
EVENT_CONSOLE_UPDATE_REGION = 0x00004002
EVENT_CONSOLE_UPDATE_SIMPLE = 0x00004003
EVENT_CONSOLE_UPDATE_SCROLL = 0x00004004
EVENT_CONSOLE_LAYOUT = 0x00004005
EVENT_CONSOLE_START_APPLICATION = 0x00004006
CONSOLE_APPLICATION_16BIT = 0x00000001
EVENT_CONSOLE_END_APPLICATION = 0x00004007
EVENT_MAX = 0x7FFFFFFF
*/
|
|
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 3877 Location: Pittsburgh
|
Posted: Mon Jun 11, 2007 5:04 pm Post subject: |
|
|
| This works flawlessly, too. Does it mean that we don't need wineventhook.dll any more? |
|
| Back to top |
|
 |
JGR
Joined: 15 Jun 2006 Posts: 52 Location: Unavailable until ~30th August
|
Posted: Mon Jun 11, 2007 6:08 pm Post subject: |
|
|
callback.dll,wineventhook.dll & wineventhookq.dll are all superfluous with built in callbacks.
However cbthook.dll still necessary for CBT hooks, as they require dll injection...
JGR |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 5957 Location: Pacific Northwest, US
|
Posted: Mon Jun 11, 2007 7:25 pm Post subject: |
|
|
| Sean wrote: | It also worked well with SetWinEventHook.
The omission of EVENT_OBJECT_VALUECHANGE (:0x800E) was intentional, as it made DbgView.exe irresponsive.
| Code: | hHook := SetWinEventHook(3, 3, pfn := RegisterCallback("WinEvent", "Fast"))
hHook1:= SetWinEventHook(0x8000, 0x800D, pfn)
hHook2:= SetWinEventHook(0x800F, 0x8012, pfn)
... |
|
I think this answers a common Ask for Help question: "Can I detect another program making a sound?" Please correct me if I'm wrong. _________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|