本帖最后由 jycel 于 2009-10-17 11:07 编辑
多弄几张图片来测试,是指定调用的图片,结果有时会出错,显示另一张
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiRichEdit.au3>
#include <GuiMenu.au3>
#include <GUIConstants.au3>
#include <_GUICtrlRichEdit_CanPaste.au3>
#Region ### START Koda GUI section ### Form=
$hGui = GUICreate("Form1", 633, 454, 192, 114)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test" & @CR, 10, 10, 480, 420, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
_GUICtrlRichEdit_AppendText($hRichEdit, ReadBmpToRtf1(FindFirstBMP1(@ScriptDir&"\send1.bmp")) & @CR)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func ReadBmpToRtf1($sBmpFilspc)
Local $hFile, $sRtf
$hFile = FileOpen($sBmpFilspc, 16)
If FileRead($hFile, 2) <> "0x424D" Then Return SetError(1, 0, "")
FileRead($hFile, 12)
$sRtf = '{\rtf1{\pict\dibitmap ' & Hex(FileRead($hFile)) & '}}'
FileClose($hFile)
Return $sRtf
EndFunc ;==>ReadBmpToRtf
Func FindFirstBMP1($sPath); = @ScriptDir);@WindowsDir)
Local $hFind, $sBmpFilspc
$hFind = FileFindFirstFile($sPath); & "\*.bmp")
$sBmpFilspc = FileFindNextFile($hFind)
FileClose($hFind)
Return $sPath & "\" & $sBmpFilspc
EndFunc ;==>FindFirstBMP
|