whether or not the text is selected Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
robot
Posts: 2
Joined: 16 Sep 2017, 04:11

whether or not the text is selected

16 Sep 2017, 04:31

I would like to judge whether a text is selected in a notebook, but I do not want to use clipboard, and i found the EM_GETSELTEXT message, but ahk only give the WM_* message, and not EM_* message

Code: Select all

F8::
myVar := ""
VarSetCapacity(myVar, 50)
SendMessage, 0X043E, 0, &myVar,,Untitled - Notepad ; EM_GETSELTEXT = 0X043E
MsgBox, %myVar%
return
this is my code, but the variable is alway empty :( ,whether it is not right,and how can i do.
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: whether or not the text is selected  Topic is solved

16 Sep 2017, 04:56

AFAIK EM_GETSELTEXT works for richEdit only.

Code: Select all

F8::
  ControlGet, ctrlHwnd, Hwnd,, %ctrlClass%, ahk_class Notepad
  DllCall("SendMessage","PTR",ctrlHwnd,"UInt",0xB0,"PTR*",start,"PTR*",end) ;EM_GETSEL
  MsgBox % start " - " end
Return
robot
Posts: 2
Joined: 16 Sep 2017, 04:11

Re: whether or not the text is selected

18 Sep 2017, 01:09

@HotKeyIt
thanks very much, after spend some time to learn related knowledge, and now i can do it.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Anput, Rohwedder and 374 guests