一、API声明:
SUBROUTINE CopyMemory(ref METAHEADER Destination , ref blob Source, long Length) LIBRARY "kernel32" Alias for "RtlMoveMemory"
SUBROUTINE CopyMemory2(ref blob Destination , ref blob Source, long Length) LIBRARY "kernel32" Alias for "RtlMoveMemory"
Function ulong SetMetaFileBitsEx(ulong nSize,ref blob lpData) LIBRARY "gdi32.dll"
二、PB脚本:
METAHEADER lst_Hdr
integer li_FileNum
Long ll_hMF,ll_loops,ll_pos,ll_len
blob lb_structure,lb_data,lb_tmp,lb_read
li_FileNum = FileOpen("c:/1.wmf", StreamMode!)
FileSeek(li_FileNum, 22, FromBeginning!)
FileRead(li_FileNum, lb_structure)
CopyMemory(lst_Hdr,lb_structure,18)
lst_Hdr.mtSize = lst_Hdr.mtSize * 2
FileSeek(li_FileNum, 22, FromBeginning!)
IF lst_Hdr.mtSize > 32765 THEN
IF Mod(lst_Hdr.mtSize, 32765) = 0 THEN
ll_loops = lst_Hdr.mtSize/32765
ELSE
ll_loops = (

本文介绍了如何在PowerBuilder(PB)应用中使用API函数来读取和显示Windows Metafile Format (WMF) 图片。通过API声明如`CopyMemory`和`SetMetaFileBitsEx`,结合PB脚本实现从文件中读取WMF数据,并利用OLE对象显示图片。参考代码和示例图片链接提供了详细的操作步骤。
最低0.47元/天 解锁文章
1398

被折叠的 条评论
为什么被折叠?



