--- In [email protected], "Sheri" <sheri...@...> wrote:
>
> The below referenced autohotkey script creates some open space on an 
> application's window below its menu (for a toolbar).  It also creates a 
> toolbar.


Someone once posted a link to an app that did this, and I had assumed the only 
way to make the extra space stick was something like to hook the target 
application's main window and add your own client window in the apps process 
space, then somehow hook it and draw on top.

But how could an autokeyscript do that?

It turns out that it is much simpler.  All the app does is get the menu handle 
of the menubar associated with the window and add a new row to that menu.  Then 
it draws a tool bar on that.  I was very surprised that this seems to work, at 
least in XP.  Don't know about Vista and beyond.

To test it, I created a win plugin service
win.addmenurow(handle) 
which adds a new (blank) row to that window with given window handle (must be a 
top level window, I suspect).  The plugin normally returns 0, but if it has to 
create a new menu bar, it returns that menu handle (this resource will need to 
be freed if the underlying window goes, and the caller must do that)

If you want to experiment with this, I uploaded the win plugin to the webeddie 
download folder.

http://powerpro.webeddie.com/download/win.dll



You could create a bar with subbars depending on the active window, and then 
move it to either just below the caption (if the target window had no menubar 
to start with) or otherwise to below that caption + menu bar height (available 
from win.getsystemmetrics(15));

As with the autokeyscript, you would have to use an event to reposition bar 
each time the active window changed.  If you only want to affect certain 
windows, you'd have to keep a list of them somehow.  You have to remember the 
handles of windows which already have extra row added. Finally, you should 
destroy any return hmenus if the window they are associated with is destroyed.  
Since you have to keep a list of affected windows, if you find handles on the 
list which are now invalid, then any associated hmenu created by the win plugin 
should be destroyed.

I may look at expanding format contextif at some point to handle this, but I'd 
be interested in anything you learn by scripting a solution, if you want to 
play with it.



Reply via email to