Any idea how I can access and use the Text Object Model interface for a 
richedit control? It is obtained as a pointer to a pointer in the lparam of 
EM_GETOLEINTERFACE sendmessage. The message does succeed (gets a non-zero 
return value) but what next?

Text Object Model (TOM) is documented here:
<http://msdn.microsoft.com/en-us/library/bb774052%28VS.85%29.aspx>

Ultimately I want to use it on an out-of-process richedit control. I've 
actually had some success using sendmessages on out-of-process richedit 
controls that included variables allocated and copied to the external process 
using, among others, WriteProcessMemory api.

First I need to be able to use it locally.

Here is a script that puts a richedit control into a dialog window. The handle 
to the richedit control is subsequently in the global variable RE_Test_Hwnd.

;shows a richedit control in a dialog
;use with dialog plugin version 1.19 or above
;global variable RE_Test_Hwnd has the handle to the richedit control
global RE_Test_Hwnd
if (RE_Test_Hwnd !=="") do
  win.show(win.parent(RE_Test_Hwnd))
  quit
endif
args sText, sTitle

if (sTitle=="")
  sTitle="RichEdit Control via Powerpro Dialog"

global g_sScriptpathOld = scriptpath 

if ( index(scriptpath,  scriptfolder) eq 0) do
  g_sScriptpathOld = scriptpath 
    do("Script Path",  scriptfolder ++  ";" ++  scriptpath)
endif
  
local dialog_status
local iWidth = 275
local iHght = 295
dialog.error_dialog_on()

local hDlg = dialog.define("0!",  "0!",  iWidth++"!" , iHght++"!",  sTitle,  ;;+
"thickframe sysmenu centre maxbox minbox", "", "" , "", "", ;;+
scriptfolder ++ ?"\regex.ico",  0, "Arial 10")

if (not hDlg)
 quit
local iButtUnit = iWidth / 10
local iButtW = iButtUnit * 2
hDlg.define_control(10, 10, iWidth - 20, iHght - 40, ;;+
"richedit", "vuResultV", sText, ;;+
"vscroll multiline wantreturn 3d border", "", "", "", "", "white")

hDlg.define_control(iButtUnit * 7, iHght - 20, 45, 12, ;;+
"button",  "cancel",     "Q&uit", "", cb("@finish"), ;;+
"", "", "", "", "cancel")

local sResult 
hDlg.create(0)
hDlg.send("vuResultV", "setsel", -1)

hDlg.run("foreground")
global RE_Test_Hwnd=hDlg.get_value("vuResultV", "hwnd")
quit

;==============================================================

Function finish(sUserArg, dlgHan, iCtrlNo, wMsg, lParam)
local dialog_status                                        
dlgHan.destroy()
global RE_Test_Hwnd=""
quit

;==============================================================



Reply via email to