Jump to content

WordPad Richedit Control


 Share

Recommended Posts

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...