Jump to content
Sign in to follow this  
Radsam

Windows Global Ctrl-A, Ctrl-C, Ctrl-Z etc. Hotkeys

Recommended Posts

Radsam

I noticed that when in an edit control, the windows hotkeys Ctrl-A, Ctrl-C, Ctrl-Z, etc. don't work but produce a "ding" sound. I also noticed that if you right click in the edit control, those options are listed.

How can I have the windows hotkeys Ctrl-A, Ctrl-C, Ctrl-Z, etc. work in the edit control?

Eg:

#include <GUIConstants.au3>

#Region A3 Pad Gui & Parameters
$sMainTitle = "Test"
$iMainWidth = 180; -1 = 400
$iMainHeight = 115; -1 = 400
$iMainLeftPos = -1;-1 is Center
$iMainTopPos = -1;-1 is Center
$iMainStyle = $WS_MINIMIZEBOX + $WS_MAXIMIZEBOX + $WS_VSCROLL + $WS_SIZEBOX;-1 is default which is: $WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU
$iMainExStyle = -1; -1 is default

$cIASNotepad = GUICreate($sMainTitle, $iMainWidth, $iMainHeight, $iMainLeftPos, $iMainTopPos, $iMainStyle, $iMainExStyle)

#EndRegion

#Region A3 Pad Edit & Parameters
$EditText = ""
$EditLeftPos = -1
$EditTopPos = 0
$EditWidth = 383
$EditHeight = 352
$EditStyle = $ES_AUTOVSCROLL + $ES_WANTRETURN;default -1: $ES_WANTRETURN, $WS_VSCROLL, $WS_HSCROLL, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL
$EditExStyle = -1

$cEdit = GUICtrlCreateEdit($EditText, $EditLeftPos, $EditTopPos, $EditWidth, $EditHeight, $EditStyle, $EditExStyle)

#EndRegion

GUISetState()

GUICtrlSetData($cEdit, "")

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then Exit 0

    
WEnd
Edited by Radsam

Share this post


Link to post
Share on other sites
Radsam

Can anyone offer any help??

Share this post


Link to post
Share on other sites
CyberSlug

put at beginning of script

HotKeySet("^a","SelectAll")
Func SelectAll()
    If WinActive($cIASNotepad) Then
        GUICtrlSendMsg($cEdit, 0xB1, 0, 999999);0xB1 == EM_SETSEL
    Else;we didn't want to trap the hotkey; pass it along
        HotKeySet("^a")
        Send("^a")
        HotKeySet("^a","SelectAll")
    EndIf
EndFunc

P.S. On Windows XP, I've noticed that Ctrl+A does not work in a lot of places such as the Run dialog and explorer address bar :lmao:

Edited by CyberSlug

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites
Radsam

Thank you very much CyberSlug. Now that I see how you coded, I found an UDF called Gui_Message.au3 that contains control messages. This has proved interesting. :lmao:

Share this post


Link to post
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
Sign in to follow this  

×