找回密码
 加入
搜索
查看: 2308|回复: 3

_GUICtrlRichEdit_Create获取内容不完整

  [复制链接]
发表于 2009-12-16 18:54:38 | 显示全部楼层 |阅读模式
本帖最后由 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
 楼主| 发表于 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))
发表于 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
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-22 03:51 , Processed in 0.078102 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表