#include "FiveWin.ch"
#include "RichEdit.ch"
function Main()
local oWnd, hRichEdit := LoadLibrary( "riched20.dll" ), oRichEd
local cText := ""
DEFINE WINDOW oWnd
@ 0, 0 RICHEDIT oRichEd VAR cText OF oWnd
REUndoRedo( oRichEd:hWnd )
ACTIVATE WINDOW oWnd
FreeLibrary( hRichEdit )
return nil
#pragma BEGINDUMP
#include <windows.h>
#include <richedit.h>
#include <richole.h>
#include <tom.h>
#include <unknwn.h>
#include <hbapi.h>
#define DEFINE_GUIDXXX(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
EXTERN_C const GUID CDECL name \
= { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
DEFINE_GUIDXXX(IID_ITextDocument,0x8CC497C0,0xA1DF,0x11CE,0x80,0x98,
0x00,0xAA,0x00,0x47,0xBE,0x5D);
HB_FUNC( REUNDOREDO )
{
HWND hEdit = ( HWND ) hb_parnll( 1 );
IUnknown * tr_code = NULL;
ITextDocument * td_code;
SendMessage( hEdit, EM_SETEVENTMASK, 0, ENM_CHANGE | ENM_KEYEVENTS | ENM_SELCHANGE );
SendMessage( hEdit, EM_GETOLEINTERFACE, 0, ( LPARAM ) &tr_code );
if( tr_code != NULL )
{
tr_code->lpVtbl->QueryInterface( tr_code, &IID_ITextDocument, ( void ** ) &td_code );
td_code->lpVtbl->Undo( td_code, tomSuspend, NULL );
td_code->lpVtbl->Undo( td_code, tomResume, NULL );
}
else
MessageBox( 0, "Error when trying to get RichEdit OLE Object", "Info", 0 );
}
#pragma ENDDUMP