Jump to content

HotKeySet & underline on compile


Recommended Posts

I have written a great inventory management app for my shop (which I plan on posting in its entirety once finished for you guys), and one of the last things I wanted to do was set hotkeys for certain functions. Odd thing, when NOT compiled, I run the scrip and all underlined letters show up fine using & in the button captions. Once compiled though, the underscores do not show up, until I run a function that closes and reopens the GUI.....HUH??

Please have a quick look, maybe I should be putting my HotKeySet statements somewhere else, but I have moved them around and the same thing always happens....

#include <EditConstants.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#Include <GUIListBox.au3>
#include <GUIConstantsEx.au3>
#include <file.au3>
#include <array.au3>
#include <StaticConstants.au3>
#Include <ScreenCapture.au3>

$GUI = GUICreate("Inventory Manager Beta 30 06/30/2009", 520, 450)
GUICtrlCreateLabel("&Items:", 3, 0, 32, 17)
$Items = GUICtrlCreateList("", 0, 16, 250, 383)
$Add_Item = GUICtrlCreateButton("&Add Item", 260, 16, 75, 25)
$Delete_Item = GUICtrlCreateButton("&Delete Item", 348, 16, 75, 25)
$Edit_Item = GUICtrlCreateButton("&Edit Item", 436, 16, 75, 25)
GUICtrlCreateLabel("Item Properties:", 260, 48, 77, 17)
GUICtrlCreateLabel("Brand:", 260, 64, 35, 17)
GUICtrlCreateLabel("Description:", 360, 64, 55, 17)
GUICtrlCreateLabel("UPC:", 260, 104, 58, 17)
GUICtrlCreateLabel("Price:", 260, 144, 35, 17)

$brand = GUICtrlCreateEdit("", 260, 80, 100, 21,$ES_READONLY)
$description = GUICtrlCreateEdit("", 360, 80, 150, 21,$ES_READONLY)
$upc = GUICtrlCreateInput("", 260, 120, 250, 21,$ES_READONLY)
$price = GUICtrlCreateInput("", 260, 160, 250, 21,$ES_READONLY)

$namesearchinput = GUICtrlCreateInput("", 2, 400, 121, 21)
$namesearchbutton = GUICtrlCreateButton("Search &Name", 1, 424, 122, 25, 0)
$upcsearchinput = GUICtrlCreateInput("", 129, 400, 121, 21)
$upcsearchbutton = GUICtrlCreateButton("Search &UPC", 128, 424, 122, 25, 0)

GUICtrlCreateGroup("", 280, 242, 205, 35)
$eightylabels=GUICtrlCreateRadio("80 Labels",405,250,70,25)
$thirtylabels=GUICtrlCreateRadio("30 Labels",295,250,70,25)
GUISetState()

GUICtrlSetState($thirtylabels,$GUI_CHECKED)
$golayout=GUICtrlCreateButton("Go to &Print Layout",325,216,115,25);396,200     216
GUICtrlCreateLabel("*Make sure your web browser's print settings are:",259,285,270,17)
GUICtrlCreateLabel("     Left and Right .25""",259,305,270,17)
GUICtrlCreateLabel("     Top .53""",259,320,270,17)
GUICtrlCreateLabel("     Bottom .4""",259,335,270,17)
GUICtrlCreateLabel("These margins are needed to preserve the layout",259,355,270,17)
$changesettings=GUICtrlCreateButton("Change XML Save Path",386,395,125,25)
$loadbackup=GUICtrlCreateButton("Load Backup Inventory",386,424,125,25)
$makebackup=GUICtrlCreateButton("Back Up Inventory Data",253,424,130,25)

HotKeySet("^a","_AddItem")
HotKeySet("^d","_DelItem")
HotKeySet("^e","_EditItem")
HotKeySet("^p","_LayoutManager")
HotKeySet("^n","_NameSearch")
HotKeySet("^u","_UpcSearch")
HotKeySet("^i","_FocusItems")
HotKeySet("{ENTER}")
GUISetState(@SW_SHOW, $GUI)



While 1
    Switch GUIGetMsg()
        
        Case - 3
            Exit


        Case $Add_Item;done!
            _AddItem()
            
            
        Case $Delete_Item;done!
            _DelItem()
            
            
        Case $Edit_Item;done!
            _EditItem()


        Case $namesearchbutton;done!
            _NameSearch()
            

        Case $upcsearchbutton;done!
            _UpcSearch()


        Case $golayout 
            _LayoutManager()


        Case $Items;done!
            _Items()


    EndSwitch
WEnd

Func _additem()
EndFunc
func _delitem()
EndFunc
func _edititem()
EndFunc
func _layoutmanager()
EndFunc
func _namesearch()
EndFunc
func _upcsearch()
EndFunc
func _focusitems()
EndFunc

Obviously I Stripped out all of the good stuff, just since this is a question on HotKeySet and not the functionality....

Thanks for any help!

Ian

My projects:

  • IP Scanner - Multi-threaded ping tool to scan your available networks for used and available IP addresses, shows ping times, resolves IPs in to host names, and allows individual IPs to be pinged.
  • INFSniff - Great technicians tool - a tool which scans DriverPacks archives for INF files and parses out the HWIDs to a database file, and rapidly scans the local machine's HWIDs, searches the database for matches, and installs them.
  • PPK3 (Persistent Process Killer V3) - Another for the techs - suppress running processes that you need to keep away, helpful when fighting spyware/viruses.
  • Sync Tool - Folder sync tool with lots of real time information and several checking methods.
  • USMT Front End - Front End for Microsoft's User State Migration Tool, including all files needed for USMT 3.01 and 4.01, 32 bit and 64 bit versions.
  • Audit Tool - Computer audit tool to gather vital hardware, Windows, and Office information for IT managers and field techs. Capabilities include creating a customized site agent.
  • CSV Viewer - Displays CSV files with automatic column sizing and font selection. Lines can also be copied to the clipboard for data extraction.
  • MyDirStat - Lists number and size of files on a drive or specified path, allows for deletion within the app.
  • 2048 Game - My version of 2048, fun tile game.
  • Juice Lab - Ecigarette liquid making calculator.
  • Data Protector - Secure notes to save sensitive information.
  • VHD Footer - Add a footer to a forensic hard drive image to allow it to be mounted or used as a virtual machine hard drive.
  • Find in File - Searches files containing a specified phrase.
Link to comment
Share on other sites

  • Moderators

llewxam,

Both your script and the compiled .exe show the underscores for me - once I have pressed Alt, of course.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

I think you are confusing HotKeySet() with GuiSetAccelerators(), and since you want these associated with your GUI and not just anything on the desktop, you should try it with GuiSetAccelerators() instead.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

@Melba23:

Very interesting about Alt, I didn't realize that would set it off.... So my solution that I just tested - throw a " Send("{ALT}") " in there after GUISetState and compiled, bing. :) Thank you for your help again, this is the second time you had a good response for me.

@PsaltyDS:

Thanks for your suggestion as well, I'll check the help file on that and see what it is all about,m never came across that one yet...

Ian

My projects:

  • IP Scanner - Multi-threaded ping tool to scan your available networks for used and available IP addresses, shows ping times, resolves IPs in to host names, and allows individual IPs to be pinged.
  • INFSniff - Great technicians tool - a tool which scans DriverPacks archives for INF files and parses out the HWIDs to a database file, and rapidly scans the local machine's HWIDs, searches the database for matches, and installs them.
  • PPK3 (Persistent Process Killer V3) - Another for the techs - suppress running processes that you need to keep away, helpful when fighting spyware/viruses.
  • Sync Tool - Folder sync tool with lots of real time information and several checking methods.
  • USMT Front End - Front End for Microsoft's User State Migration Tool, including all files needed for USMT 3.01 and 4.01, 32 bit and 64 bit versions.
  • Audit Tool - Computer audit tool to gather vital hardware, Windows, and Office information for IT managers and field techs. Capabilities include creating a customized site agent.
  • CSV Viewer - Displays CSV files with automatic column sizing and font selection. Lines can also be copied to the clipboard for data extraction.
  • MyDirStat - Lists number and size of files on a drive or specified path, allows for deletion within the app.
  • 2048 Game - My version of 2048, fun tile game.
  • Juice Lab - Ecigarette liquid making calculator.
  • Data Protector - Secure notes to save sensitive information.
  • VHD Footer - Add a footer to a forensic hard drive image to allow it to be mounted or used as a virtual machine hard drive.
  • Find in File - Searches files containing a specified phrase.
Link to comment
Share on other sites

ggrrrrr, sorry to reopen this question, but I thought my " Send("{ALT}") " was a fix, but I guess the crack had me seeing things :)

Is there a reliable way to get around having to hit ALT to get the underscores to show up the first time? Melba23 said "once I have pressed Alt, of course" and the "of course" part has me a bit worried...... Like it is well known, and just the way it is.

Thanks for any advice

Ian

My projects:

  • IP Scanner - Multi-threaded ping tool to scan your available networks for used and available IP addresses, shows ping times, resolves IPs in to host names, and allows individual IPs to be pinged.
  • INFSniff - Great technicians tool - a tool which scans DriverPacks archives for INF files and parses out the HWIDs to a database file, and rapidly scans the local machine's HWIDs, searches the database for matches, and installs them.
  • PPK3 (Persistent Process Killer V3) - Another for the techs - suppress running processes that you need to keep away, helpful when fighting spyware/viruses.
  • Sync Tool - Folder sync tool with lots of real time information and several checking methods.
  • USMT Front End - Front End for Microsoft's User State Migration Tool, including all files needed for USMT 3.01 and 4.01, 32 bit and 64 bit versions.
  • Audit Tool - Computer audit tool to gather vital hardware, Windows, and Office information for IT managers and field techs. Capabilities include creating a customized site agent.
  • CSV Viewer - Displays CSV files with automatic column sizing and font selection. Lines can also be copied to the clipboard for data extraction.
  • MyDirStat - Lists number and size of files on a drive or specified path, allows for deletion within the app.
  • 2048 Game - My version of 2048, fun tile game.
  • Juice Lab - Ecigarette liquid making calculator.
  • Data Protector - Secure notes to save sensitive information.
  • VHD Footer - Add a footer to a forensic hard drive image to allow it to be mounted or used as a virtual machine hard drive.
  • Find in File - Searches files containing a specified phrase.
Link to comment
Share on other sites

  • Moderators

llewxam,

I must say that I thought pressing 'Alt' to get the underscores was one of those "Windows things", like using 'Ctrl' for multiple selections.

However, a bit of Googling suggests that it is more complex. Word, for example, has the underscores visible all the time, so there must be something (no doubt in the registry) that turns them on/off for an application.

I did find the following which makes the underscores visible in everything on the machine:

In XP: "Control panel" -> "Appearance" -> "Effects" and unselect "Hide keyboard navigation indicators until I use the Alt key"

In Vista: "Control panel" -> "Ease of Access" -> "Ease of Access Center" -> "Make the keyboard easier to use" and select "Underline keyboard shortcuts and access keys"

Trust MS to make the 2 checkboxes work in the opposite sense! No doubt there is something in the registry as well, but I really dislike messing around in there - and anyway you might well annoy your users if you set their entire machine to "underscores visible". ;-)

I hope this explains a bit more about the matter, even if it does not really help much in the case of your specific application.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

llewxam,

I must say that I thought pressing 'Alt' to get the underscores was one of those "Windows things", like using 'Ctrl' for multiple selections.

However, a bit of Googling suggests that it is more complex. Word, for example, has the underscores visible all the time, so there must be something (no doubt in the registry) that turns them on/off for an application.

I did find the following which makes the underscores visible in everything on the machine:

In XP: "Control panel" -> "Appearance" -> "Effects" and unselect "Hide keyboard navigation indicators until I use the Alt key"

In Vista: "Control panel" -> "Ease of Access" -> "Ease of Access Center" -> "Make the keyboard easier to use" and select "Underline keyboard shortcuts and access keys"

Trust MS to make the 2 checkboxes work in the opposite sense! No doubt there is something in the registry as well, but I really dislike messing around in there - and anyway you might well annoy your users if you set their entire machine to "underscores visible". ;-)

I hope this explains a bit more about the matter, even if it does not really help much in the case of your specific application.

M23

Dude, that's nuts! That does help explain a lot. I guess what I'll do is find the registry key(s) responsible and put an option to set the key(s) in my Change Settings tab, that way the user can choose if they want to set the flag or not......

Thanks again. Again. :)

Ian

My projects:

  • IP Scanner - Multi-threaded ping tool to scan your available networks for used and available IP addresses, shows ping times, resolves IPs in to host names, and allows individual IPs to be pinged.
  • INFSniff - Great technicians tool - a tool which scans DriverPacks archives for INF files and parses out the HWIDs to a database file, and rapidly scans the local machine's HWIDs, searches the database for matches, and installs them.
  • PPK3 (Persistent Process Killer V3) - Another for the techs - suppress running processes that you need to keep away, helpful when fighting spyware/viruses.
  • Sync Tool - Folder sync tool with lots of real time information and several checking methods.
  • USMT Front End - Front End for Microsoft's User State Migration Tool, including all files needed for USMT 3.01 and 4.01, 32 bit and 64 bit versions.
  • Audit Tool - Computer audit tool to gather vital hardware, Windows, and Office information for IT managers and field techs. Capabilities include creating a customized site agent.
  • CSV Viewer - Displays CSV files with automatic column sizing and font selection. Lines can also be copied to the clipboard for data extraction.
  • MyDirStat - Lists number and size of files on a drive or specified path, allows for deletion within the app.
  • 2048 Game - My version of 2048, fun tile game.
  • Juice Lab - Ecigarette liquid making calculator.
  • Data Protector - Secure notes to save sensitive information.
  • VHD Footer - Add a footer to a forensic hard drive image to allow it to be mounted or used as a virtual machine hard drive.
  • Find in File - Searches files containing a specified phrase.
Link to comment
Share on other sites

Incase anyone was curious and unable to find the right key, RegShot showed me where to go in HKEY_USERS, but since that would be a bad way to apply this kind of change on different machines due to the numbers (User IDs?) being different, you can set the value in HKEY_CURRENT_USER\Control Panel\Desktop "UserPreferencesMask". There is a document available at http://www.msfn.org/board/index.php?showto...rt=#entry578901 which describes the "bitmask", but not knowing what to do there, I just changed the value as M23 described above, and checked the result in HKEY_CURRENT_USER\. The default value is 9E3E0780, if changed to BE3E0780 the change is made after a reboot. So, in AutoIt that translated in to

RegDelete("HKEY_CURRENT_USER\Control Panel\Desktop","UserPreferencesMask");remove old value
RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop","UserPreferencesMask","REG_Binary",Dec("80073EBE"))

Not quite sure why, but I had to reverse the order of the value, but it works so I'm happy. Hopefully this can help someone else.

As another suggestion, instead of doing a full restart, logging off and back in will apply the change as well, restarting explorer.exe wasn't enough. So, throwing a quick MsgBox asking if you want to restart after applying the change, followed by "Shutdown(0)" if answered Yes will save some time.

Ian

My projects:

  • IP Scanner - Multi-threaded ping tool to scan your available networks for used and available IP addresses, shows ping times, resolves IPs in to host names, and allows individual IPs to be pinged.
  • INFSniff - Great technicians tool - a tool which scans DriverPacks archives for INF files and parses out the HWIDs to a database file, and rapidly scans the local machine's HWIDs, searches the database for matches, and installs them.
  • PPK3 (Persistent Process Killer V3) - Another for the techs - suppress running processes that you need to keep away, helpful when fighting spyware/viruses.
  • Sync Tool - Folder sync tool with lots of real time information and several checking methods.
  • USMT Front End - Front End for Microsoft's User State Migration Tool, including all files needed for USMT 3.01 and 4.01, 32 bit and 64 bit versions.
  • Audit Tool - Computer audit tool to gather vital hardware, Windows, and Office information for IT managers and field techs. Capabilities include creating a customized site agent.
  • CSV Viewer - Displays CSV files with automatic column sizing and font selection. Lines can also be copied to the clipboard for data extraction.
  • MyDirStat - Lists number and size of files on a drive or specified path, allows for deletion within the app.
  • 2048 Game - My version of 2048, fun tile game.
  • Juice Lab - Ecigarette liquid making calculator.
  • Data Protector - Secure notes to save sensitive information.
  • VHD Footer - Add a footer to a forensic hard drive image to allow it to be mounted or used as a virtual machine hard drive.
  • Find in File - Searches files containing a specified phrase.
Link to comment
Share on other sites

Never one to leave good enough alone, I stumbled across this:

http://www.powerbasic.com/support/pbforums...amp;postcount=3

I tried monkeying around with SendMessage a bit but didn't have any success, attempt was more or less a direct copy::

Opt("WinTitleMatchMode", 4)
$hwnd = WinGetHandle('classname=Progman')
_SendMessage($hwnd, "WM_CHANGEUISTATE", "MakLng(UIS_CLEAR", "UISF_HIDEFOCUS Or UISF_HIDEACCEL")

Sorry to keep slogging through this, but this seems so much cleaner, and might be much more helpful in the long run to get figured out for everyone...but don't know the first thing about SendMessage and didn't learn how to do it with the time I had to put in.......

Thanks

Ian

My projects:

  • IP Scanner - Multi-threaded ping tool to scan your available networks for used and available IP addresses, shows ping times, resolves IPs in to host names, and allows individual IPs to be pinged.
  • INFSniff - Great technicians tool - a tool which scans DriverPacks archives for INF files and parses out the HWIDs to a database file, and rapidly scans the local machine's HWIDs, searches the database for matches, and installs them.
  • PPK3 (Persistent Process Killer V3) - Another for the techs - suppress running processes that you need to keep away, helpful when fighting spyware/viruses.
  • Sync Tool - Folder sync tool with lots of real time information and several checking methods.
  • USMT Front End - Front End for Microsoft's User State Migration Tool, including all files needed for USMT 3.01 and 4.01, 32 bit and 64 bit versions.
  • Audit Tool - Computer audit tool to gather vital hardware, Windows, and Office information for IT managers and field techs. Capabilities include creating a customized site agent.
  • CSV Viewer - Displays CSV files with automatic column sizing and font selection. Lines can also be copied to the clipboard for data extraction.
  • MyDirStat - Lists number and size of files on a drive or specified path, allows for deletion within the app.
  • 2048 Game - My version of 2048, fun tile game.
  • Juice Lab - Ecigarette liquid making calculator.
  • Data Protector - Secure notes to save sensitive information.
  • VHD Footer - Add a footer to a forensic hard drive image to allow it to be mounted or used as a virtual machine hard drive.
  • Find in File - Searches files containing a specified phrase.
Link to comment
Share on other sites

  • Moderators

llewxam,

More Googling has thrown up the possibility that those apps which do display underscores permanently may well be using non-standard menus rather than the normal Windows ones that AutoIt uses.

I have been playing with WM_CHANGEUISTATE for some time on various windows, both from SciTE and from compiled exes with no luck - although that might be down to my coding! ;-0

So I think you are limited to the global windows "Appearance" registry key - if you are prepared to change the users entire setup for this one thing.

M23

P.S. Here is the code I was testing, by the way:

#include <SendMessage.au3>

Const $WM_CHANGEUISTATE = 0x127
Const $WM_UPDATEUISTATE = 0x128

$hGUI = GUICreate("Test", 500, 500)

$mFile_Menu = GUICtrlCreateMenu("&File")
$hLabel = GUICtrlCreateLabel("", 10, 10, 200, 20)

GUISetState()

$hWnd = WinGetHandle("Test", "")
ConsoleWrite($hWnd & @CRLF)

Sleep(5000)

GUICtrlSetData($hLabel, "Showing Underscores")
; wParam should be (high) UISF_HIDEACCEL (low) UIS_CLEAR because we want accels shown
; wParam =       (high) &H2         (low) 2  = 0x20002
_SendMessage($hWnd, $WM_CHANGEUISTATE, 0x20002, 0)
; Try UPDATE which should tell child windows to do the same
_SendMessage($hWnd, $WM_UPDATEUISTATE, 0x20002, 0)

Sleep(5000)

GUICtrlSetData($hLabel, "Hiding Underscores")
; wParam should be (high) UISF_HIDEACCEL (low) UIS_SET because we want accels hidden
; wParam =       (high) &H2         (low) 1  = 0x20001
_SendMessage($hWnd, $WM_CHANGEUISTATE, 0x20001, 0)
_SendMessage($hWnd, $WM_UPDATEUISTATE, 0x20001, 0)

Sleep(5000)

Exit

And here is the MSDN data for the message:

SendMessage(
    (HWND) hWndControl,   // handle to destination control
    (UINT) WM_CHANGEUISTATE,      // message ID
    (WPARAM) wParam,      // = (WPARAM) () wParam;
    (LPARAM) lParam   // = (LPARAM) () lParam;

wParam
The low-order word specifies the action to be taken. This member can be one of the following values.

UIS_CLEAR
The UI state flags specified by the high-order word should be cleared.
UIS_INITIALIZE
The UI state flags specified by the high-order word should be changed based on the last input event. For more information, see Remarks.
UIS_SET
The UI state flags specified by the high-order word should be set.

The high-order word specifies which UI state elements are affected or the style of the control. This member can be one or more of the following values.

UISF_HIDEACCEL
Keyboard accelerators are hidden.
UISF_HIDEFOCUS
Focus indicators are hidden.
UISF_ACTIVE
Windows XP: A control should be drawn in the style used for active controls.

lParam
Not used. Must be set to 0


WM_CHANGEUISTATE = &H127
Enum WM_CHANGEUISTATE_low As Short
    UIS_CLEAR = 2
    UIS_INITIALIZE = 3
    UIS_SET = 1
End Enum
Enum WM_CHANGEUISTATE_high As Short
    UISF_HIDEACCEL = &H2
    UISF_HIDEFOCUS = &H1
    UISF_ACTIVE = 4
End Enum

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

llewxam,

More Googling has thrown up the possibility that those apps which do display underscores permanently may well be using non-standard menus rather than the normal Windows ones that AutoIt uses.

I have been playing with WM_CHANGEUISTATE for some time on various windows, both from SciTE and from compiled exes with no luck - although that might be down to my coding! ;-0

So I think you are limited to the global windows "Appearance" registry key - if you are prepared to change the users entire setup for this one thing.

M23

P.S. Here is the code I was testing, by the way:

#include <SendMessage.au3>

Const $WM_CHANGEUISTATE = 0x127
Const $WM_UPDATEUISTATE = 0x128

$hGUI = GUICreate("Test", 500, 500)

$mFile_Menu = GUICtrlCreateMenu("&File")
$hLabel = GUICtrlCreateLabel("", 10, 10, 200, 20)

GUISetState()

$hWnd = WinGetHandle("Test", "")
ConsoleWrite($hWnd & @CRLF)

Sleep(5000)

GUICtrlSetData($hLabel, "Showing Underscores")
; wParam should be (high) UISF_HIDEACCEL (low) UIS_CLEAR because we want accels shown
; wParam =       (high) &H2         (low) 2  = 0x20002
_SendMessage($hWnd, $WM_CHANGEUISTATE, 0x20002, 0)
; Try UPDATE which should tell child windows to do the same
_SendMessage($hWnd, $WM_UPDATEUISTATE, 0x20002, 0)

Sleep(5000)

GUICtrlSetData($hLabel, "Hiding Underscores")
; wParam should be (high) UISF_HIDEACCEL (low) UIS_SET because we want accels hidden
; wParam =       (high) &H2         (low) 1  = 0x20001
_SendMessage($hWnd, $WM_CHANGEUISTATE, 0x20001, 0)
_SendMessage($hWnd, $WM_UPDATEUISTATE, 0x20001, 0)

Sleep(5000)

Exit

And here is the MSDN data for the message:

SendMessage(
    (HWND) hWndControl,   // handle to destination control
    (UINT) WM_CHANGEUISTATE,      // message ID
    (WPARAM) wParam,      // = (WPARAM) () wParam;
    (LPARAM) lParam   // = (LPARAM) () lParam;

wParam
The low-order word specifies the action to be taken. This member can be one of the following values.

UIS_CLEAR
The UI state flags specified by the high-order word should be cleared.
UIS_INITIALIZE
The UI state flags specified by the high-order word should be changed based on the last input event. For more information, see Remarks.
UIS_SET
The UI state flags specified by the high-order word should be set.

The high-order word specifies which UI state elements are affected or the style of the control. This member can be one or more of the following values.

UISF_HIDEACCEL
Keyboard accelerators are hidden.
UISF_HIDEFOCUS
Focus indicators are hidden.
UISF_ACTIVE
Windows XP: A control should be drawn in the style used for active controls.

lParam
Not used. Must be set to 0


WM_CHANGEUISTATE = &H127
Enum WM_CHANGEUISTATE_low As Short
    UIS_CLEAR = 2
    UIS_INITIALIZE = 3
    UIS_SET = 1
End Enum
Enum WM_CHANGEUISTATE_high As Short
    UISF_HIDEACCEL = &H2
    UISF_HIDEFOCUS = &H1
    UISF_ACTIVE = 4
End Enum
Nope, your test didn't do it for me. For now I have 2 options available - either offer the user to change the setting for them and do a Windows Logoff which will apply the setting, or send ALT-p (or any accelerator not actually in use) and they wake up. Before I thought ALT alone was working but wasn't, but ALT-P definately does, but introduces a very slight pause in the app. Oh well, big deal, I'll probably just script things so:

If the setting is wrong, offer to fix it

if fixed, offer to log out

if neither, send ALT-P

Unless you can come up with the winning _SendMessage, I think this is the way for now.... :)

Thanks again

Ian

My projects:

  • IP Scanner - Multi-threaded ping tool to scan your available networks for used and available IP addresses, shows ping times, resolves IPs in to host names, and allows individual IPs to be pinged.
  • INFSniff - Great technicians tool - a tool which scans DriverPacks archives for INF files and parses out the HWIDs to a database file, and rapidly scans the local machine's HWIDs, searches the database for matches, and installs them.
  • PPK3 (Persistent Process Killer V3) - Another for the techs - suppress running processes that you need to keep away, helpful when fighting spyware/viruses.
  • Sync Tool - Folder sync tool with lots of real time information and several checking methods.
  • USMT Front End - Front End for Microsoft's User State Migration Tool, including all files needed for USMT 3.01 and 4.01, 32 bit and 64 bit versions.
  • Audit Tool - Computer audit tool to gather vital hardware, Windows, and Office information for IT managers and field techs. Capabilities include creating a customized site agent.
  • CSV Viewer - Displays CSV files with automatic column sizing and font selection. Lines can also be copied to the clipboard for data extraction.
  • MyDirStat - Lists number and size of files on a drive or specified path, allows for deletion within the app.
  • 2048 Game - My version of 2048, fun tile game.
  • Juice Lab - Ecigarette liquid making calculator.
  • Data Protector - Secure notes to save sensitive information.
  • VHD Footer - Add a footer to a forensic hard drive image to allow it to be mounted or used as a virtual machine hard drive.
  • Find in File - Searches files containing a specified phrase.
Link to comment
Share on other sites

I think you are confusing HotKeySet() with GuiSetAccelerators(), and since you want these associated with your GUI and not just anything on the desktop, you should try it with GuiSetAccelerators() instead.

:)

I switched from HotKeySet to GuiSetAccelerators as you suggested, thank you very much for the tip, I could have unintentionally caused quite a bit of chaos with HotKeySet!! :) But, it looks like I can not use Enter as an Accelerator, is that right? The following does not work with Accelerators, but did with HotKeys:

dim $accelkeys[2][2]=[["^g","_GenerateUPC"],["{ENTER}","_Go"]]
GUISetAccelerators($accelkeys)

Thanks

Ian

My projects:

  • IP Scanner - Multi-threaded ping tool to scan your available networks for used and available IP addresses, shows ping times, resolves IPs in to host names, and allows individual IPs to be pinged.
  • INFSniff - Great technicians tool - a tool which scans DriverPacks archives for INF files and parses out the HWIDs to a database file, and rapidly scans the local machine's HWIDs, searches the database for matches, and installs them.
  • PPK3 (Persistent Process Killer V3) - Another for the techs - suppress running processes that you need to keep away, helpful when fighting spyware/viruses.
  • Sync Tool - Folder sync tool with lots of real time information and several checking methods.
  • USMT Front End - Front End for Microsoft's User State Migration Tool, including all files needed for USMT 3.01 and 4.01, 32 bit and 64 bit versions.
  • Audit Tool - Computer audit tool to gather vital hardware, Windows, and Office information for IT managers and field techs. Capabilities include creating a customized site agent.
  • CSV Viewer - Displays CSV files with automatic column sizing and font selection. Lines can also be copied to the clipboard for data extraction.
  • MyDirStat - Lists number and size of files on a drive or specified path, allows for deletion within the app.
  • 2048 Game - My version of 2048, fun tile game.
  • Juice Lab - Ecigarette liquid making calculator.
  • Data Protector - Secure notes to save sensitive information.
  • VHD Footer - Add a footer to a forensic hard drive image to allow it to be mounted or used as a virtual machine hard drive.
  • Find in File - Searches files containing a specified phrase.
Link to comment
Share on other sites

I switched from HotKeySet to GuiSetAccelerators as you suggested, thank you very much for the tip, I could have unintentionally caused quite a bit of chaos with HotKeySet!! :) But, it looks like I can not use Enter as an Accelerator, is that right? The following does not work with Accelerators, but did with HotKeys:

dim $accelkeys[2][2]=[["^g","_GenerateUPC"],["{ENTER}","_Go"]]
GUISetAccelerators($accelkeys)

Thanks

Ian

Yes, you can use ENTER, but the accelerator key is associated with a control ID, not directly to the function to be called:
#include <GuiConstantsEx.au3>

Opt("GuiOnEventMode", 1)

$hGUI = GUICreate("Test", 350, 300)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")
$ctrlGenUPC = GUICtrlCreateButton("Gen UPC", 50, 50, 100, 30)
GUICtrlSetOnEvent(-1, "_GenerateUPC")
$ctrlGo = GUICtrlCreateButton("GO", 200, 50, 100, 30); Hidden "GO" button
GUICtrlSetOnEvent(-1, "_GO")
GUICtrlSetState(-1, $GUI_HIDE)

GUISetState()

dim $accelkeys[2][2]=[["^g", $ctrlGenUPC], ["{ENTER}", $ctrlGo]]
GUISetAccelerators($accelkeys, $hGUI)

While 1
    Sleep(10)
WEnd

Func _Quit()
    Exit
EndFunc

Func _GenerateUPC()
    ConsoleWrite("_GenerateUPC()" & @LF)
EndFunc

Func _Go()
    ConsoleWrite("Go()" & @LF)
EndFunc

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Yes, you can use ENTER, but the accelerator key is associated with a control ID, not directly to the function to be called:

#include <GuiConstantsEx.au3>

Opt("GuiOnEventMode", 1)

$hGUI = GUICreate("Test", 350, 300)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")
$ctrlGenUPC = GUICtrlCreateButton("Gen UPC", 50, 50, 100, 30)
GUICtrlSetOnEvent(-1, "_GenerateUPC")
$ctrlGo = GUICtrlCreateButton("GO", 200, 50, 100, 30); Hidden "GO" button
GUICtrlSetOnEvent(-1, "_GO")
GUICtrlSetState(-1, $GUI_HIDE)

GUISetState()

dim $accelkeys[2][2]=[["^g", $ctrlGenUPC], ["{ENTER}", $ctrlGo]]
GUISetAccelerators($accelkeys, $hGUI)

While 1
    Sleep(10)
WEnd

Func _Quit()
    Exit
EndFunc

Func _GenerateUPC()
    ConsoleWrite("_GenerateUPC()" & @LF)
EndFunc

Func _Go()
    ConsoleWrite("Go()" & @LF)
EndFunc

:)

SCHWEEEET, thanks! I hate it when I miss the obvious info in the help file, but I'm thankful that the forum users can keep me moving! :)

Thanks again

Ian

My projects:

  • IP Scanner - Multi-threaded ping tool to scan your available networks for used and available IP addresses, shows ping times, resolves IPs in to host names, and allows individual IPs to be pinged.
  • INFSniff - Great technicians tool - a tool which scans DriverPacks archives for INF files and parses out the HWIDs to a database file, and rapidly scans the local machine's HWIDs, searches the database for matches, and installs them.
  • PPK3 (Persistent Process Killer V3) - Another for the techs - suppress running processes that you need to keep away, helpful when fighting spyware/viruses.
  • Sync Tool - Folder sync tool with lots of real time information and several checking methods.
  • USMT Front End - Front End for Microsoft's User State Migration Tool, including all files needed for USMT 3.01 and 4.01, 32 bit and 64 bit versions.
  • Audit Tool - Computer audit tool to gather vital hardware, Windows, and Office information for IT managers and field techs. Capabilities include creating a customized site agent.
  • CSV Viewer - Displays CSV files with automatic column sizing and font selection. Lines can also be copied to the clipboard for data extraction.
  • MyDirStat - Lists number and size of files on a drive or specified path, allows for deletion within the app.
  • 2048 Game - My version of 2048, fun tile game.
  • Juice Lab - Ecigarette liquid making calculator.
  • Data Protector - Secure notes to save sensitive information.
  • VHD Footer - Add a footer to a forensic hard drive image to allow it to be mounted or used as a virtual machine hard drive.
  • Find in File - Searches files containing a specified phrase.
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...