我从网上下载的代码,,略作修改,如下:
DECLARE INTEGER OpenClipboard IN user32 INTEGER
DECLARE INTEGER CloseClipboard IN user32
DECLARE INTEGER EmptyClipboard IN user32
DECLARE INTEGER SetClipboardData IN user32 INTEGER,INTEGER
DECLARE INTEGER LoadImage IN WIN32API INTEGER,string,INTEGER,INTEGER,INTEGER,INTEGER
DECLARE INTEGER GetClipboardData IN user32 INTEGER
DECLARE INTEGER GdipCreateBitmapFromHBITMAP in GdiPlus.dll INTEGER, INTEGER, INTEGER @
DECLARE INTEGER GdipSaveImageToFile in GdiPlus.dll INTEGER,String,String @,String @
DECLARE Long GdipCreateHBITMAPFromBitmap IN GDIPLUS.DLL Long nativeImage, Long @, Long
DECLARE Long GdipCreateBitmapFromFile IN GDIPLUS.DLL String FileName, Long @nBitmap
DECLARE Long CopyImage IN WIN32API Long hImage, Long, Long, Long , Long
#DEFINE CF_BITMAP 2
#DEFINE CF_DIB 8
#DEFINE IMAGE_BITMAP 0
#DEFINE LR_LOADFROMFILE 16
*VFP应用程式算法群:12787940 行者孙:310727570
*功能1:将图形文件保存到剪切板
imagefile="F:\...\...\...\文件名.bmp"
hBitmap=LoadImage(0,imagefile,IMAGE_BITMAP,0,0,LR_LOADFROMFILE)
OpenClipboard (0)
EmptyClipboard()
SetClipboardData (CF_BITMAP,hBitmap)
CloseClipboard()
*功能2:将剪切板图形保存到本地
OpenClipboard(0)
hBitmap = GetClipboardData(CF_BITMAP)
hDib = GetClipboardData(CF_DIB)
CloseClipboard()
ubitmap=0
GdipCreateBitmapFromHBITMAP(hBitmap,2,@ubitmap)
lcOutputFile=STRCONV("E:\...\...\...\...\test.bmp"+CHR(0),5)
qEncoderClsID_BMP='0h00F47C55041AD3119A730000F81EF32E' &&网上下载的不带引号,VFP中显示“语法错误”
GdipSaveImageToFile(ubitmap,"\test.bmp",qEncoderClsID_BMP,null)
OpenClipboard(0)
EmptyClipboard()
CloseClipboard()
功能1实现了(但这一步对我无帮助,列在此供参考),功能2不行,既无出错信息,也没有生成文件。
恳请这方面专家给看看问题在哪里?
也许有人要问:为何不手动做,费这劲干么?因为我是通过编程从excel中批量导入数据,其他类型的数据(包括备注型 )已经成功,唯有照片数据,做到了复制到剪贴板上这一步,如果能从剪贴板上保存成本地bmp文件,下一步用APPEND GENERAL 命令就可达到目标。
[
本帖最后由 iamhyf 于 2010-1-21 10:03 编辑 ]