Sign in to follow this  
Followers 0
Guest Floater

$EM_EXGETSEL causes wordpad to crash

1 post in this topic

Hi

I am trying to monitor text in notepad and wordpad as they are typed using 'SetWindowsHookEx'on $WH_KEYBOARD_LL. On $WM_KEYDOWN I use

$hWnd = ControlGetHandle("", "", "")

to get the handle for the current control.

The following part of code

$wparam = DllStructCreate("uint Start")
$lparam = DllStructCreate("uint End")
_SendMessage($hWnd, $EM_GETSEL, DllStructGetPtr($wparam), DllStructGetPtr($lparam), 0, "ptr", "ptr")

works perfectly well on both notepad and wordpad. But when I try

$tCharRange = DllStructCreate($tagCHARRANGE)
_SendMessage($hWnd, $EM_EXGETSEL, 0, DllStructGetPtr($tCharRange))

wordpad crashes. Could someone suggest the reason and a workaround.

Regards

Floater

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  
Followers 0