jycel 发表于 2009-12-16 18:54:38

_GUICtrlRichEdit_Create获取内容不完整

本帖最后由 jycel 于 2009-12-16 20:29 编辑



如图,英文和中文都差一个字符!还有参数没设置吗?
#Include <GuiRichEdit.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 389, 305, 192, 114)
$hRichEdit1=_GUICtrlRichEdit_Create($Form1,"jycel", 48, 8, 273, 97,BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$hRichEdit2=_GUICtrlRichEdit_Create($Form1,"景勇", 48, 128, 273, 113,BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))

$Button1 = GUICtrlCreateButton("Button1", 32, 256, 113, 41)
$Button2 = GUICtrlCreateButton("Button2", 208, 256, 129, 41)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                                          GUIDelete()
                        Exit
                Case $Button1
                        MsgBox(0,"",_GUICtrlRichEdit_GetText($hRichEdit1))
                Case $Button2
                        MsgBox(0,"",_GUICtrlRichEdit_GetText($hRichEdit2))
                       
        EndSwitch
WEnd

水木子 发表于 2009-12-16 19:05:47

本帖最后由 水木子 于 2009-12-16 19:07 编辑

没问题啊!你再试试呢!#Include <GuiEdit.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 389, 305, 192, 114)
$hRichEdit1= _GUICtrlEdit_Create ($Form1,"jycel", 48, 8, 273, 97,BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$hRichEdit2= _GUICtrlEdit_Create ($Form1,"景勇", 48, 128, 273, 113,BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$Button1 = GUICtrlCreateButton("Button1", 32, 256, 113, 41)
$Button2 = GUICtrlCreateButton("Button2", 208, 256, 129, 41)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
      $nMsg = GUIGetMsg()
      Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        MsgBox(0,"",_GUICtrlEdit_GetText($hRichEdit1))
                Case $Button2
                        MsgBox(0,"",_GUICtrlEdit_GetText($hRichEdit2))
                        
      EndSwitch
WEnd

jycel 发表于 2009-12-16 19:57:13

本帖最后由 jycel 于 2009-12-16 20:01 编辑

原来这里不相符
我想在如果用_GUICtrlRichEdit_GetText($hRichEdit1)应该也可以,但就这样读要少读最后一个字符或汉字
MsgBox(0,"",_GUICtrlEdit_GetText($hRichEdit1))
MsgBox(0,"",_GUICtrlRichEdit_GetText($hRichEdit1))

awingu 发表于 2010-6-20 00:13:43

_GUICtrlRichEdit_GetText()
需要richedit里面的内容必须存在换行才能够完整读取所有信息#Include <GuiRichEdit.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 389, 305, 192, 114)
$hRichEdit1=_GUICtrlRichEdit_Create($Form1, "jycel sda"&@CR&"AWinGu", 48, 8, 273, 97,BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$hRichEdit2=_GUICtrlRichEdit_Create($Form1,"景勇.", 48, 128, 273, 113,BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
_GuiCtrlRichEdit_AppendText($hRichEdit2, @CR & "冬眠的猪")
$Button1 = GUICtrlCreateButton("Button1", 32, 256, 113, 41)
$Button2 = GUICtrlCreateButton("Button2", 208, 256, 129, 41)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
      $nMsg = GUIGetMsg()
      Switch $nMsg
                Case $GUI_EVENT_CLOSE
                                          GUIDelete()
                        Exit
                                        Case $Button1
                        MsgBox(0,"",_GUICtrlRichEdit_GetText($hRichEdit1))
                Case $Button2
                        MsgBox(0,"",_GUICtrlRichEdit_GetText($hRichEdit2))
                        
      EndSwitch
WEnd
页: [1]
查看完整版本: _GUICtrlRichEdit_Create获取内容不完整