Sign in to follow this  
Followers 0
Lakes

WordPad Richedit Control

1 post in this topic

Experimenting with _GUICtrlRichEdit and a Wordpad control...

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstants.au3>

Opt("WinTitleMatchMode", 2)
$WordPadID    = "[ID:59648]"

$WordPad = "- WordPad"

Run('C:\Program Files\Windows NT\Accessories\wordpad.exe'); < ----------- Open WordPad
WinWait ($WordPad)
$WordPad1 = WinGetTitle("[active]") 
WinMove($WordPad1,"", 70, 300)  
$hWordEdit1 = ControlGetHandle($WordPad, "", $WordPadID)
If @error then  MsgBox(0, "", "Error = " & @error)

ControlCommand ($WordPad1,"" ,$hWordEdit1 ,"EditPaste", "This is pasted text using ControlCommand" &@CR &@CR)

ControlCommand ($WordPad1,"" ,$hWordEdit1 ,"EditPaste", "COUNTDOWN COMMENCING..." &@CR)
For $Count = 5 to 1 step -1
Delay()
ControlCommand ($WordPad1,"" ,$hWordEdit1 ,"EditPaste", $Count &@CR)
Next


_GUICtrlRichEdit_SetText($hWordEdit1, "This is a test of interacting with a wordpad control")
If @error then  
    MsgBox(0, "", "Error = " & @error)
    Exit
Endif   

Func Delay()
    Sleep(1000)
EndFunc

If you run this, the editpaste works, but the _GUICtrlRichEdit_SetText cuases wordpad to crash...

Yes, I know I can create my own Richedit control, but I`d like to know why it cuases wordpad to crash out.

Thanks.


2015 - Still no flying cars, instead blankets with sleeves.

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