Resumen Estructura PARAMFORMAT2 (para el RichTextBox)

Mensaje enviado por SJIMENOH28@smail1.ocenf.org (SJIMENOH28)

Esteban:

Te mando las definiciones de esa estructura, pasadas por mi a Visual Basic.
Solo advertirte que hay dos archivos RICHED20.DLL con el mismo nombre. La versión 2 usada por W95-98 y la versión 3 usada por W2000. Para saberlo mira las propiedades pinchando con el botón derecho del ratón en dicho archivo en el Explorador. En cualquier caso puedes usar la versión 3 con W98 instalando el MSI Installer que puedes descargar de los downloads de Microsoft.

Sobre lo que preguntas del ByVal del segundo parámetro no entiendo bien a que te refieres. Para usarla, simplemente, utiliza el siguiente mensaje:

Public Declare Function SendMessage& Lib "user32" Alias "SendMessageA" _
    (ByVal hwnd As Long, ByVal wMsg As Long, _
    ByVal wParam As Long, lParam As Any)

De la siguiente forma:
    Dim PF2 As PARAFORMAT2
    PF2.cbSize = Len(PF2) 'no te olvides de esto que no funciona. Ya que ignora a cual de las dos estructuras te refieres (hay además versiones UNICODE)
    PF2.dwMask = 'una de las constantes PFM_ , o varias unidas con Or
    PF2....... 'aquí el valor del campo o campos de la estructura relacionados con la máscara y que se desee usar.
    'Por ejemplo, para alineación:
    PF2.dwMask = PFM_ALIGNMENT
    PF2.wAlignment = PFA_CENTER
    'Despues enviar mensaje:
    SendMessage hWndRichEdit, EM_SETPARAFORMAT, 0, PF2 'para establecer
    SendMessage hWndRichEdit, EM_GETPARAFORMAT, 0, PF2 'para obtener

Para tener más información mira en los discos de MSDN la ayuda de dicha estructura. Faltan algunas de las constantes de máscaras y efectos, ya que no tienen representación gráfica y solo se añaden por compatibilidad con TOM Interface (incluida en RichEdit3) y WORD.

En lo que respecta a la pregunta de tu otro mensaje sobre SizeOf, supongo que se refiere a la utilización con esta estructura. Bueno, pues ya ves la solución arriba. Lo único a matizar es que Len da el tamaño en bytes si la estructura está correctamente alineada a Long como esta. Si una estructura de usuario no tuviese en cuenta la obligatoria alineación a Long, sería preciso
utilizar LenB.

Saludos y suerte con PARAFORMAT2.

Santiago Jimeno (Madrid)
SJIMENOH28@smail1.ocenf.org

'-----------------------------------------------------------------------------
'DEFINICIONES DE PARAFORMAT2

Public Declare Function SendMessage& Lib "user32" Alias "SendMessageA" _
    (ByVal hwnd As Long, ByVal wMsg As Long, _
    ByVal wParam As Long, lParam As Any)

Public Const WM_USER& = &H400
Public Const EM_GETPARAFORMAT = (WM_USER + 61)
Public Const EM_SETPARAFORMAT = (WM_USER + 71)
Public Const MAX_TAB_STOPS = 32&

Public Type PARAFORMAT2
    'Los primeros campos coinciden con PARAFORMAT y se usan igual
    cbSize As Integer
    wPad1 As Integer
    dwMask As Long
    wNumbering As Integer
    wEffects As Integer 'No usado en PARAFORMAT
    dxStartIndent As Long
    dxRightIndent As Long
    dxOffset As Long
    wAlignment As Integer
    cTabCount As Integer
    lTabStops(0 To MAX_TAB_STOPS - 1) As Long
    ' Desde aquí lo añadido por PARAFORMAT2
    dySpaceBefore As Long '/* Vertical spacing before para */
    dySpaceAfter As Long '/* Vertical spacing after para */
    dyLineSpacing As Long '/* Line spacing depending on Rule */
    sStyle As Integer ' /* Style handle */
    bLineSpacingRule As Byte '/* Rule for line spacing (see tom.doc) */
    bOutlineLevel As Byte '/* Outline Level*/'antes bCRC As Byte
    wShadingWeight As Integer '/* Shading in hundredths of a per cent */
    wShadingStyle As Integer '/* Byte 0: style, nib 2: cfpat, 3: cbpat*/
    wNumberingStart As Integer '/* Starting value for numbering */
    wNumberingStyle As Integer ' /* Alignment, Roman/Arabic, (), ), ., etc.*/
    wNumberingTab As Integer '/* Space bet 1st indent and 1st-line text*/
    wBorderSpace As Integer ' /* Border-text spaces (nbl/bdr in pts) */
    wBorderWidth As Integer '/* Pen widths (nbl/bdr in half twips) */
    wBorders As Integer '/* Border styles (nibble/border) */
End Type

' /* PARAFORMAT mask values */
Public Const PFM_STARTINDENT = &H1&
Public Const PFM_RIGHTINDENT = &H2&
Public Const PFM_OFFSET = &H4&
Public Const PFM_ALIGNMENT = &H8&
Public Const PFM_TABSTOPS = &H10&
Public Const PFM_NUMBERING = &H20&
Public Const PFM_OFFSETINDENT = &H80000000

' /* PARAFORMAT numbering options */
Public Const PFN_BULLET = &H1&

' /* PARAFORMAT alignment options */
Public Const PFA_LEFT = &H1&
Public Const PFA_RIGHT = &H2&
Public Const PFA_CENTER = &H3&

'/* PARAFORMAT 2.0 masks */
Public Const PFM_SPACEBEFORE = &H40&
Public Const PFM_SPACEAFTER = &H80&
Public Const PFM_LINESPACING = &H100&
Public Const PFM_STYLE = &H400&
Public Const PFM_NUMBERINGSTYLE = &H2000& ' /* RE 3.0 */
Public Const PFM_NUMBERINGTAB = &H4000& ' /* RE 3.0 */
Public Const PFM_NUMBERINGSTART = &H8000& ' /* RE 3.0 */
Public Const PFM_TABLE = &HC0000000 ' /* RE 3.0 */
'// The following three properties are read only
Public Const PFM_COLLAPSED = &H1000000 '/* RE 3.0 */
Public Const PFM_OUTLINELEVEL = &H2000000 '/* RE 3.0 */
Public Const PFM_BOX = &H4000000 '/* RE 3.0 */

'/* PARAFORMAT2 wNumbering options (see also PFN_BULLET) */
Public Const PFN_ARABIC = 2 '/* tomListNumberAsArabic: 0, 1, 2, ...*/
Public Const PFN_LCLETTER = 3 '/* tomListNumberAsLCLetter: a, b, c, ...*/
Public Const PFN_UCLETTER = 4 '/* tomListNumberAsUCLetter: A, B, C, ...*/
Public Const PFN_LCROMAN = 5 '/* tomListNumberAsLCRoman: i, ii, iii, ...*/
Public Const PFN_UCROMAN = 6 '/* tomListNumberAsUCRoman: I, II, III, ...*/

'/* PARAFORMAT2 wNumberingStyle options */
Public Const PFNS_PAREN = &H0 '/* default, e.g., 1) */
Public Const PFNS_PARENS = &H100 '/* tomListParentheses/256, e.g., (1) */
Public Const PFNS_PERIOD = &H200 '/* tomListPeriod/256, e.g., 1. */
Public Const PFNS_PLAIN = &H300 '/* tomListPlain/256, e.g., 1 */
Public Const PFNS_NONUMBER = &H400 '/* Used for continuation w/o number
*/


----- Mensaje original -----
De: Esteban <estebangarias@ciudad.com.ar>
Para: <vb-esp@ccc.uba.ar>
Enviado: sábado 25 de noviembre de 2000 05:12 a.m.
Asunto: vb-esp : PARAMFORMAT2


Compañeros de la lista
    Agradeceria mucho, si alguien uso la estructura PARAFORMAT2 en alguna
aplicacion, que me pasara la forma de definirla en visual basic y si la
estructura cuando se manda con EM_SETPARAFORMAT lleva byval o no en el segundo
parametro.

      Gracias Anticipadas
Esteban Gabriel Arias



Resumen Resumen

Visual Basic Página de Visual Basic

Página principal Página principal

www.jrubi.com