VFP9+WIN10下将剪贴板的图片内容另存为指定.png文件不成功
各位好!希望VFP9+WIN10下将剪贴板的图片内容另存为指定.png文件,但不成功。下面是网上找的代码
DECLARE INTEGER GdipSavelmageToFile IN gdiplus.DLL ;
INTEGER nlmage,;
STRING wFilename,;
STRING qEncoder,;
STring @nEncoderParamsPtr
DECLARE INTEGER CLSIDFromString IN ole32 STRINGIpsz,STRING @pclsid
DECLARE INTEGER GdipLoadlmageFromFile IN gdiplus.DLL;
STRING wFilename, INTEGER @nlmage
DECLARE INTEGER StrDup IN shlwapi STRING @lpsz
LOCAL nlmage as Integer
pSourceFileNAme='d:\无标题1.png'
pNewFileNAme='d:\无标题2.png'
clnput = PADR(CHR(1),16,CHR(0))
&&GdipLoadlmageFromFile(STRCONV(pSourceFileNAme+CHR(0),5),@nlmage)
GUID_FormatJPG="{557CF401-1A04-11D3-9A73-0000F81EF32E}"
IcEncode=REPLICATE(CHR(0),16)
STRCONV_loc=STRCONV(GUID_FormatJPG+CHR(0),5)
CLSIDFromString(STRCONV_loc,@IcEncode)&&这里定义保存后的图像格式为 JPG
CLSIDFromString(STRCONV_loc)
IcGuid = REPLICATE(CHR(0),16)
GUID_Quality="{1d5be4b5-fa4a-452d-9cdd-5db35105e7eb}"&&对图像质量进行操作
CLSIDFromString(STRCONV(GUID_Quality+CHR(0),5),@IcGuid)
Quality=50&&图像质量值设置
QualityStr=BINTOC(Quality,'4rs')
ValuePtr=StrDup(@QualityStr)&&得到图像质量设置值的内存地址
EncoderParameter=IcGuid+BINTOC(1,'4rs')+BINTOC(4,'4rs')+BINTOC(ValuePtr,'4rs')
EncoderParameters=bintoc(1,'4rs')+EncoderParameter
GdipSavelmageToFile(nlmage,STRCONV(pNewFileNAme+CHR(0),5),IcEncode,@EncoderParameters)
MESSAGEBOX("保存到 d:\无标题2.png")