Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Tif to clip
Message
From
26/11/2020 09:26:28
 
General information
Forum:
Visual FoxPro
Category:
Pictures and Image processing
Title:
Miscellaneous
Thread ID:
01677286
Message ID:
01677288
Views:
88
No my teacher, I am trying to read tif from VFP.
I have already Tif file with 2 pages and want to copy this file onto _clipboard.

I think following codes converts Tif to bmp with 1 page, then bmp is copied to _clipboard.
I want to know is there any method to bypass bmp file and tif file directly copy to _clipboard with all pages.

Sorry if I am wrong.
#Define CF_BITMAP 2
#Define CF_DIB 8
#Define IMAGE_BITMAP 0
#Define LR_LOADFROMFILE 16
#Define LR_MONOCHROME 0x00000001

Local xpict
m.xpict="E:\abc.tif"

Local m.oo
m.oo=Newobject("image")
m.oo.Picture=m.xpict
Local lnWidth,lnHeight
lnWidth=m.oo.Width
lnHeight=m.oo.Height

nBitmap=0
hbm=0
GdipCreateBitmapFromFile(Strconv(m.xpict+0h00,5),@nBitmap)
GdipCreateHBITMAPFromBitmap(nBitmap,@hbm,0)
lhBmp = CopyImage(hbm, 0, m.lnWidth, m.lnHeight,0)
If OpenClipboard(0)!= 0
	EmptyClipboard()
	SetClipboardData(CF_BITMAP, lhBmp)
	CloseClipboard()
Endif
ENDPROC
>Hi,
>
> VFP read first page from multipage TIFF always.
>If you want read another page/view from TIFF file, you must use GDI+ API.
>
>MartinaJ
>
>>Respected Sir,
>>
>>I have a tif file that contains 2 pages.
>>I am trying to copy it to _clipboard
>>
>>So I have these codes
>>
>>
>>Declare Integer Sleep In kernel32 Integer
>>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 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
>>#Define LR_MONOCHROME 0x00000001
>>
>>Local xpict
>>m.xpict="E:\abc.tif"
>>
>>Local m.oo
>>m.oo=Newobject("image")
>>m.oo.Picture=m.xpict
>>Local lnWidth,lnHeight
>>lnWidth=m.oo.Width
>>lnHeight=m.oo.Height
>>
>>nBitmap=0
>>hbm=0
>>GdipCreateBitmapFromFile(Strconv(m.xpict+0h00,5),@nBitmap)
>>GdipCreateHBITMAPFromBitmap(nBitmap,@hbm,0)
>>lhBmp = CopyImage(hbm, 0, m.lnWidth, m.lnHeight,0)
>>If OpenClipboard(0)!= 0
>>	EmptyClipboard()
>>	SetClipboardData(CF_BITMAP, lhBmp)
>>	CloseClipboard()
>>Endif
>>ENDPROC
>>
>>
>>Codes work fine but when I press Ctrl+v in clipboard there is only 1 page instead of 2
>>It means _clipboard is holding only 1 page.
>>
>>How is it possible to copy all pages from tif file to clipboard?
>>
>>Attachment has abc.tif and prg.
>>
>>Please help
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform