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

How to initialize buffer to use em_getline in a multiline editbox

rucktp
Beginner
916 Views
The documentation for em_getlline shows the syntax for the line as
i = SendMessage(hwnd, em_getline, wParam,lParam )
in which wParam is the zero based index of the line to retrieve and lParam is the buffer to load the line to. It also specifies that before making the call that the first word of the buffer must be set to the size of the buffer.
For the code section below, retrieve second line from edit box hedit, how would the length of the buffer (c) be added to the character string?
integer hedit
character*80 c
i = SendMessage(hedit, em_getline, 1,loc(c) )
0 Kudos
2 Replies
Jugoslav_Dujic
Valued Contributor II
916 Views
Yep, that requiresa C-ish thick. TRANSFER Fortran intrinsic does a bit-by-bit copy, so you can use it:
c(1:2) = TRANSFER(int2(len(c)), 'a')
this copies2 bytes containing LEN(c) into first two characters of c "as-is". (MSDNsaysthat the length should be aWORD = integer(2))
Jugoslav
0 Kudos
rucktp
Beginner
916 Views
Thanks Jugoslav! That did the trick.
0 Kudos
Reply