WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

System UDFs

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Images to Clipboard.wbt

Keywords: 	 Images to Clipboard.wbt

;------------------------------------------------------------------------------------------------------------------------------------------

#DefineFunction udfImgClipPut (sFilenameImage)
If !FileExist(sFilenameImage) Then Return (0)
AddExtender("WWIMG34I.DLL")
sFilenameTemp = FileCreateTemp("TMP")
If (1 <> ImgConvert(sFilenameImage,StrCat("DIB:",sFilenameTemp))) Then Return (0)
iBBsize = FileSize(sFilenameTemp)
If !iBBSize Then Return (0)
hBB = BinaryAlloc(iBBsize)
BinaryRead(hBB,sFilenameTemp)
BinaryClipPut(hBB,8) ; 8=CF_DIB
BinaryFree(hBB)
FileDelete(sFilenameTemp)
Return (iBBSize)
;..........................................................................................................................................
; This user defined function "udfImgToClip" uses the 'ImgConvert' function of the WinBatch 'Pixie' Extender.
; This function converts an input image file to a DIB formatted temporary file
; and puts the DIB content to Windows Clipboard,
; from where it can be pasted into some graphical application.
; The temporary DIB file is deleted afterwards.
; On success this function returns the DIB size in Byte, on failure it returns 0.
;
; Detlev Dalitz.20020904
;..........................................................................................................................................
#EndFunction


; --- test ---

sFilenameImage = StrCat(DirHome(),"WBOwl.bmp")


:test1
iResult = udfImgClipPut (sFilenameImage)


;Examine results
Run("mspaint","")
While !WinExist("~Paint")
   TimeDelay(2)
EndWhile
If WinExist("~Paint")
   WinActivate("~Paint")
   SendKey("^v") ; Paste Clipboard content to MSPaint.
EndIf
Detlev Dalitz
DD.20020904.1404 

Article ID:   W15735
File Created: 2003:05:13:11:29:54
Last Updated: 2003:05:13:11:29:54