Home > database >  Pb to clipboard figure welcome advice
Pb to clipboard figure welcome advice

Time:09-26

//the code below, copy the fat infinite, but the generated files, unable to preview, warrior, please grant instruction! Thank you very much!!!!!!
Ulong HBMP dwBPP, dwNumColors
Long ll_hdc ll_mem, mybitmap
Bitmap BMP
Blob {14} lbl_header
Blob {40} lbl_info
Blob b_imagedata
Ulong dwImageSize


N_api. OpenClipBoard (0)
HBMP=n_api. GetClipBoardData (2)
Ll_hdc=getdc (handle (aw_win))//aw_win: for the parent form parameters of the incoming
Ll_mem=CreateCompatibleDC (ll_hdc)


SelectObject (ll_mem HBMP)
SetMapMode (ll_mem, GetMapMode (ll_hdc))

GetObject (HBMP, 24, ref BMP)
BitBlt (ll_hdc, 0, 0, BMP bmWidth, BMP. BmHeight, ll_mem, 0, 0, SRCCOPY)


Mybitmap=CreateCompatibleBitmap (ll_hdc, BMP bmWidth, BMP. BmHeight)


BitmapInfo lstr_Info
BitmapFileHeader lstr_Header

DwBPP=n_api. GetDeviceCaps (ll_hdc, n_api BITSPIXEL)
If dwBPP & lt; 8 then=
DwNumColors=n_api. GetDeviceCaps (ll_hdc, n_api NUMCOLORS)
The else
DwNumColors=0
End the if

DwImageSize=BMP. BmWidth * BMP. BmHeight * dwBPP/8

//fill the BitmapFileHeader
Lstr_Info. Bmiheader. BiSize=40
Lstr_Info. Bmiheader. BiWidth=BMP. BmWidth
Lstr_Info. Bmiheader. BiHeight=BMP. BmHeight
Lstr_Info. Bmiheader. BiPlanes=1
Lstr_Info. Bmiheader. BiBitCount=dwBPP
Lstr_Info. Bmiheader. BiCompression=0
Lstr_Info. Bmiheader. BiSizeImage=dwImageSize
Lstr_Info. Bmiheader. BiXPelsPerMeter=0
Lstr_Info. Bmiheader. BiYPelsPerMeter=0
Lstr_Info. Bmiheader. BiClrUsed=dwNumColors
Lstr_Info. Bmiheader. BiClrImportant=dwNumColors


B_imagedata=https://bbs.csdn.net/topics/blob (space (dwImageSize))
GetDIBits (ll_hdc mybitmap, 0, BMP bmHeight, ref b_imagedata, lstr_Info, 0)

Lstr_Header. BfType [1]='B'
Lstr_Header. BfType [2]='M'
Lstr_Header. BfSize=dwImageSize + & amp;
14/* sizeof (bitmapfileheader) */+ & amp;
40/* sizeof (bitmapinfoheader) */+ & amp;
DwNumColors * 4

Lstr_Header. BfReserved1=0
Lstr_Header. BfReserved2=0

Lstr_Header. BfOffBits=14/* sizeof (bitmapfileheader) */+ & amp;
40/* sizeof (bitmapinfoheader) */+ & amp;
DwNumColors * 4



CopyBitmapFileHeader (lbl_header lstr_Header, 14/* sizeof (bitmapfileheader) */)

CopyBitmapInfo (lbl_Info lstr_Info, 40/* sizeof (bitmapinfoheader) */)



B_imagedata=https://bbs.csdn.net/topics/lbl_header + lbl_info + b_imagedata

Save2file (' d: \ the ZLS (central authority. JPG, b_imagedata)//here will Blob data written to the file


DeleteObject (mybitmap)
DeleteDC (ll_mem)
N_api. CloseClipBoard ()

return true

CodePudding user response:

//FUNCTION Boolean OpenClipboard (ULong hWndNewOwner) LIBRARY "user32. DLL
"//FUNCTION Boolean CloseClipboard () LIBRARY "user32. DLL
"//FUNCTION ULong GetClipboardData (ULong wFormat) LIBRARY "user32. DLL
"//FUNCTION ulong IsClipboardFormatAvailable (ulong wFormat) LIBRARY "user32. DLL
"//FUNCTION ULong GetDesktopWindow () LIBRARY "user32. DLL
"//FUNCTION ULong GetDC (ULong hWnd) LIBRARY "user32. DLL
"//FUNCTION ULong CreateCompatibleDC (ULong HDC) LIBRARY "gdi32. DLL
"//FUNCTION ULong SelectObject (ULong HDC, ULong hgdiobj) LIBRARY "gdi32. DLL
"//FUNCTION Int GetDIBits (ULong HDC, ULong HBMP, UInt uStartScan, UInt cScanLines, REF Blob lpvBits, REF bitmapinfo lpbi, UInt uUsage) LIBRARY "gdi32. DLL
"//FUNCTION Int GetDIBits (ULong HDC, ULong HBMP, UInt uStartScan, UInt cScanLines, ULong lpvBits, REF bitmapinfo lpbi, UInt uUsage) LIBRARY "gdi32. DLL
"//SUBROUTINE CopyBitmapFileHeader (REF Blob Destination, bitmapfileheader Source, Long Length) LIBRARY "kernel32. DLL" ALIAS FOR "RtlMoveMemory
"//SUBROUTINE CopyBitmapInfo (REF Blob Destination, bitmapinfo Source, Long Length) LIBRARY "kernel32. DLL" ALIAS FOR "RtlMoveMemory
"//FUNCTION Boolean DeleteDC (ULong HDC) LIBRARY "gdi32. DLL
"//FUNCTION Int ReleaseDC (ULong hWnd, ULong HDC) LIBRARY "user32. DLL
"//FUNCTION ULong CreateFile (String lpFileName, ULong dwDesiredAccess, ULong dwShareMode, ULong lpSecurityAttributes, ULong dwCreationDisposition, & amp;
//ULong dwFlagsAndAttributes, ULong hTemplateFile) LIBRARY "kernel32. DLL" ALIAS FOR "CreateFileA
"//FUNCTION Boolean WriteFile (ULong hFile, Blob lpBuffer, ULong nNumberOfBytesToWrite, REF ULong lpNumberOfBytesWritten, & amp;
//ULong lpOverlapped) LIBRARY "kernel32. DLL
"//FUNCTION Boolean CloseHandle (ULong hObject) LIBRARY "kernel32. DLL
"Type bitmapfileheader from structure
The integer bftype
Long bfsize
The integer bfreserved1
The integer bfreserved2
Long bfoffbits
End type

Type bitmapinfoheader from structure
Long bisize
Long biwidth
Long biheight
The integer biplanes
The integer bibitcount
Long bicompression
Long bisizeimage
Long bixpelspermeter
Long biypelspermeter
Long biclrused
Long biclrimportant
End type

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related