karinha wrote:Master Navarro, esto no debria estar en: OLEDLG.LIB? O No?
Intenta asi:
FUNCTION OleUIInsertObject()
RETURN NIL
Regards, saludos.
Joao, eso no es un error ni hace falta mover ninguna function, ahora explico
Antonio, el código que estás utilizando debe ser incorrecto porque funciona sin problemas
Adjunto el mismo ejemplo anterior pero con TRichEdit5
Joao,Antonio, fíjate en:
1.- El include que he añadido
2.- No hace falta cargar la DLL, ni liberar su handle evidentemente
3.- La definición del control en el RC es distinta ( adjunto también el RC modificado )
#include "FiveWin.ch"
#include "richedi5.ch"
//----------------------------------------------------------------------------//
function Main()
local oDlg
local oRich
//
//local hRichDLL := LoadLibrary( "riched20.dll" )
//
local lSyntaxHL := .f.
local cTxt := ""
USE RTFCODE
GO TOP
cTxt += rtfcode->memcode
CLOSE
? cTxt
// Simulo la lectura del contenido del campo
//cTxt := "{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Microsoft Sans Serif;}{\f1\fnil\fcharset0 Microsoft Sans Serif;}}" + ;
// "{\colortbl ;\red128\green0\blue0;\red0\green0\blue0;\red0\green128\blue0;\red255\green0\blue0;}" + ;
// "\viewkind4\uc1\pard\cf1\b\i\f0\fs28 JH\cf2\b0\i0 - Sue let me \cf3 know\cf2 that their rep had noticed that they were not performing the yearly \cf4\ul\b\fs24 escrow\cf2\ulnone\b0\fs28 analysis.\cf0\f1\fs17\par" + ;
// "}"
DEFINE DIALOG oDlg RESOURCE "Test"
oDlg:lHelpIcon := .F.
REDEFINE BUTTON ID 110 ;
ACTION ( oRich:SetText( cTxt ) )
REDEFINE CHECKBOX lSyntaxHL ID 115 OF oDlg ;
ON CHANGE ( oRich:lHighLight := lSyntaxHL, ;
oRich:SetText( oRich:GetText() ) )
REDEFINE BUTTON ID 120 ;
ACTION oRich:LoadFromRTFFile( cGetFile( "RTF file (*.rtf) | *.rtf" ) )
REDEFINE BUTTON ID 130 ;
ACTION oRich:SaveToRTFFile( cGetFile( "RTF file (*.rtf) | *.rtf",;
"Please write a filename", "test" ) )
REDEFINE BUTTON ID 998 ACTION ( oRich:GoToLine( 10 ), oRich:SetFocus() )
oRich := TRichEdit5():Redefine( 100, bSETGET( cTxt ), oDlg )
oRich:lHighLight = .T.
ACTIVATE DIALOG oDlg CENTERED ; //
ON INIT ( oRich:LoadRtf( cTxt ), oRich:PostMsg( WM_KEYDOWN, VK_HOME, 0 ) ) ; //oRich:SetText( cTxt ) ; //
VALID ( cTxt := oRich:SaveAsRTF(), .T. ) // oRich:GetText(), .T. )
//MemoEdit( cTxt )
//
//FreeLibrary( hRichDLL )
//
return nil
//----------------------------------------------------------------------------//
Aqui el RC, fíjate en la definición del control ahora
#define IDC_EDIT1 101
Test DIALOG 41, 64, 409, 199
STYLE DS_MODALFRAME | 0x4L | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Testing the RichEdit control"
FONT 8, "MS Sans Serif"
{
// CONTROL "", 100, "RichEdit20A", 4100 | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 6, 12, 398, 163
CONTROL "", 100, "RichEdit50W", 4100 | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 6, 12, 398, 163
PUSHBUTTON "&Load text file", 110, 5, 179, 50, 16
CHECKBOX "Activate syntax highlight", 115, 65, 182, 92, 11, BS_AUTOCHECKBOX | WS_TABSTOP
PUSHBUTTON "L&oad RTF file", 120, 162, 179, 50, 16
PUSHBUTTON "&Save RTF file", 130, 226, 179, 50, 16
PUSHBUTTON "&End", IDCANCEL, 290, 179, 50, 16
PUSHBUTTON "&Win Class", 998, 354, 179, 50, 16
}