avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 11, 2018, 03:42 AM
  • Proudly celebrating 13 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Use AutoHotkey to add button to existing window?  (Read 7366 times)


  • Supporting Member
  • Joined in 2010
  • **
  • default avatar
  • Posts: 19
    • View Profile
    • Donate to Member
Use AutoHotkey to add button to existing window?
« on: June 09, 2012, 01:39 AM »
Can you add a ahk control to a commercial app?  What I'm looking for is a little like Barnacle but not a toolbar.  Take CALC.exe for example.  Can you place a button over one of the existing buttons on the calculator?  Anybody have any examples?


  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,567
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Use AutoHotkey to add button to existing window?
« Reply #1 on: June 09, 2012, 02:49 PM »
I'm not sure about 3rd party programs. But I believe Skrommel had some where he added buttons to the Explorer window.  Maybe others. Check out Skrommel's ahk apps.


All his AHK apps come with source.


  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 921
    • View Profile
    • Donate to Member
Re: Use AutoHotkey to add button to existing window?
« Reply #2 on: June 11, 2012, 02:11 PM »
You could create a gui with buttons and then use timer commands to make it always float over the same part of the underlying application. For example, the button could always float to the right of the text "calculator" in the calc.exe titlebar. The button might lag behind a little if you drag the window though.

Another alternative: If the application has controls that AHK can operate on then you can likely also relabel and reuse buttons from the GUI. Start calc.exe and then run this test code. It hides the "sinh" button, relabels "cosh" to ":-)" and takes control over what action to do when you click ":-)", for example show the text "hello world" in a tooltip. edit: though this disables click+drag within the calc window. A better alternative might be to use middle mouse button ( Mbutton ) since click + drag is less commonly used. Then you can keep the native left click functionality of the button.
Control, Hide,,Button37, ahk_class CalcFrame
ControlSetText, Button38,:-), ahk_class CalcFrame

#IfWinActive, ahk_class CalcFrame
WinGet, x, ID, ahk_class CalcFrame
MouseGetPos,,, xwin, xcontrol
if ( x == xwin AND xcontrol = "Button38")
ToolTip, hello world
« Last Edit: June 11, 2012, 02:19 PM by Nod5 »