I have a problem with the PB declaration of the GetEnhMetafileDescription
function. In the Win32API file, the string field is declared as
lpszDescription AS ASCIIZ. For the benefit of those who have not
used this function, the metafile description consists of two strings
separated by double null terminators;
(String #1)/0/0(String#2)/0
The problem I am having is that when I pass an asciiz to the function,
I only get the first string value and the asciiz variable seems to
drop the second. I know this because I created a description record
which is 54 character long. When I call the function in PB, I only get 35 characters.
The return value of the function tells me that 54 were passed back to the buffer.
Does an ASCIIZ variable truncate an input buffer when it encounters
a null terminator in the character buffer?
I have used this function without problem in VB, however, in VB you need
to use a fixed length string instead of ASCIIZ.
Heres a small code segment:
------------------
function. In the Win32API file, the string field is declared as
lpszDescription AS ASCIIZ. For the benefit of those who have not
used this function, the metafile description consists of two strings
separated by double null terminators;
(String #1)/0/0(String#2)/0
The problem I am having is that when I pass an asciiz to the function,
I only get the first string value and the asciiz variable seems to
drop the second. I know this because I created a description record
which is 54 character long. When I call the function in PB, I only get 35 characters.
The return value of the function tells me that 54 were passed back to the buffer.
Does an ASCIIZ variable truncate an input buffer when it encounters
a null terminator in the character buffer?
I have used this function without problem in VB, however, in VB you need
to use a fixed length string instead of ASCIIZ.
Heres a small code segment:
Code:
dim tempstr as ASCIIZ*256 ml& = GetEnhMetaFileDescription(mfh&, 0,BYVAL 0) 'ml& contains the size of the required buffer, In my case = 54 IF (ml& <> 0) THEN tempstr= STRING$(ml&," ") di& = GetEnhMetaFileDescription(mfh&, ml&,tempstr) 'di& tells how many characters were actually copied, 54 in my case end if msgbox str$(len(tempstr)) 'this says 35, should be 54
------------------
Comment