Welcome Guest.   Make a donation to an author on the site December 19, 2014, 01:18:02 AM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
The N.A.N.Y. Challenge 2014! Download dozens of custom programs!
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: Use AutoHotkey to add button to existing window?  (Read 4050 times)
rsteward
Supporting Member
**
Posts: 15

View Profile Give some DonationCredits to this forum member
« on: June 09, 2012, 01:39:06 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?
Logged
MilesAhead
Member
**
Posts: 5,143



View Profile WWW Give some DonationCredits to this forum member
« Reply #1 on: June 09, 2012, 02:49:59 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.

http://www.donationcoder.com/Software/Skrommel/

All his AHK apps come with source.
Logged

"It's only called research if you didn't find it the first time."
-- MilesAhead
Nod5
Supporting Member
**
Posts: 749



View Profile Give some DonationCredits to this forum member
« Reply #2 on: June 11, 2012, 02:11: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.
[copy or print]
Control, Hide,,Button37, ahk_class CalcFrame
ControlSetText, Button38,:-), ahk_class CalcFrame

#IfWinActive, ahk_class CalcFrame
LButton::
WinGet, x, ID, ahk_class CalcFrame
MouseGetPos,,, xwin, xcontrol
if ( x == xwin AND xcontrol = "Button38")
ToolTip, hello world
else
 Click
return
#IfWinActive
« Last Edit: June 11, 2012, 02:19:58 PM by Nod5 » Logged
Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.027s | Server load: 0.28 ]