Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Richedit.h Module

garyscott
Beginner
604 Views
Hi, only partial definitions for richedit.h are in CVF 6.6 dfwinty.f90. To test a GINO update which allows me to extend GINO functionality by mixing direct winAPI calls, I'm trying to build my own definitions for one selected message, em_setcharformat. SENDMESSAGE doesn't like my attempt, returning status=0 and getlasterror() value of 87 (parameter incorrect). I can successfully send other messages not requiring this structure such as EM_HIDESELECTION, so I assume I've just not defined the structure correctly. I've tried with and without sequence, with and without padding, with single character and wide character definitions for szFaceName. Anything obvious below? Is a COLORREF (cmyk value) really 4 bytes, the definition in the c header file confused me?

module rtf

use kinds !B32 is a 32 bit integer, kind=4
use dfwin

integer(b32), parameter :: COLORREF = 4
integer(b32), parameter :: LCID = DWORD

!DEC$ OPTIONS /ALIGN=RECORDS=PACKED /WARN=NOALIGN

type t_charformat !Charformat2
sequence
integer(UINT) :: cbSize
integer(DWORD) :: dwMask
integer(DWORD) :: dwEffects
integer(LONG) :: yHeight
integer(LONG) :: yOffset
integer(COLORREF) :: crTextColor
integer(BYTE) :: bCharSet
integer(BYTE) :: bPitchAndFamily
integer(SCHAR) :: szFaceName(LF_FACESIZE)
integer(WORD) :: wWeight
integer(SHORT) :: sSpacing
integer(COLORREF) :: crBackColor
integer(LCID) :: lcid
integer(DWORD) :: dwReserved
integer(SHORT) :: sStyle
integer(WORD) :: wKerning
integer(BYTE) :: bUnderlineType
integer(BYTE) :: bAnimation
integer(BYTE) :: bRevAuthor
integer(BYTE) :: bReserved1
end type t_charformat

type (t_charformat) :: CharFmt

integer, parameter :: EM_SETCHARFORMAT = WM_USER + 68

integer, parameter :: SCF_SELECTION = 16#0001

integer, parameter :: CFM_HIDDEN = 16#0100 !Defined in richedit.h
integer, parameter :: CFE_HIDDEN = CFM_HIDDEN

!DEC$ END OPTIONS

end module

< span style="font-size: 12pt; color: black; font-family: Arial;">In the application I set as follows:

CharFmt % cbSize = sizeof(charfmt)
CharFmt % dwMask = 16#0001 !CFM_BOLD
CharFmt % dwEffects = 16#0001 !CFE_BOLD
CharFmt % yHeight = null
CharFmt % yOffset = null
CharFmt % crTextColor = null
CharFmt % bCharSet = null
CharFmt % bPitchAndFamily = null
CharFmt % szFaceName = null
CharFmt % wWeight = null
CharFmt % sSpacing = null
CharFmt % crBackColor = null
CharFmt % lcid = null
CharFmt % dwReserved = null
CharFmt % sStyle = null
CharFmt % wK erning = null
CharFmt % bUnderlineType = null
CharFmt % bAnimation = null
CharFmt % bRevAuthor = null
CharFmt % bReserved1 = 0

iStat = sendmessage(ihRTF,EM_SETCHARFORMAT,SCF_SELECTION,loc(CharFmt))


0 Kudos
3 Replies
Steven_L_Intel1
Employee
604 Views
Yes, COLORREF is just an INTEGER(4). Can't really help with the rest at this time.
0 Kudos
garyscott
Beginner
604 Views
bReserved1 was not applicable to the non-unicode version of the structure so I removed it. It appears though that the main problem was that GINO was intercepting this particular message.
0 Kudos
garyscott
Beginner
604 Views
Take 2. It was the structure packing that was the problem. Always go with your first hunch...
0 Kudos
Reply