Jump to content
Sign in to follow this  
Guest Floater

$EM_EXGETSEL causes wordpad to crash

Recommended Posts

Guest Floater

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.