当前位置: 代码迷 >> PB >> pb怎的实现屏幕截图?100分奉送
  详细解决方案

pb怎的实现屏幕截图?100分奉送

热度:38   发布时间:2016-04-29 07:10:36.0
pb怎样实现屏幕截图?100分奉送
谁能指教指教 最好能有完整的例子谢谢了 
------解决方案--------------------
http://download.csdn.net/source/1626134
------解决方案--------------------


有扩展函数dll,可实现截屏、压缩、字符加解密等,如果楼主需要可发送至邮箱
------解决方案--------------------
给你段别人写的直接调用QQ的截屏的代码

Function int CameraSubArea() LIBRARY "CameraDll.dll" 
Function Boolean CameraToBmp (ref string pFilename) LIBRARY "CameraToBmp.dll" 

直接调用QQ的DLL 
integer ii_return_msg 
ii_return_msg =CameraSubArea() 
IF ii_return_msg =1 THEN 
string is_filepath,is_filename,is_file_allname 
is_filepath =g_szpath+"\EmailTemp\" 
is_filename ="temp"+string(time(now()),"hhmmss")+".bmp" 
is_file_allname =is_filepath + is_filename 
IF CameraToBmp(ref is_file_allname) THEN 
  /////// 
end if 
END IF 

CameraDll.dll在QQ上有,你自己找
------解决方案--------------------
1.如果只是简单的截屏,可以用模拟printscreent键来实现

2.可以用api函数



//////////////////////////////////////////////////////////////////////
//
// Function: of_SaveWindow
//
// Purpose: 抓取窗口内容,并保存为指定文件
//
// Scope: public
//
// Arguments: hwnd ulong     需抓取的窗口句柄
//            filename  string    需保存的文件名
//
// Returns: boolean
//
// Last Date: 2004/06/12            Author: 胖无极 Email:[email protected]
[email protected]/////

blob b_imagedata

ulong hdc, hmemdc, hbmp
ulong dwNumColors, dwBPP, dwImageSize

ulong dwWidth, dwHeight
rect rt

hdc  = n_api.GetWindowDC(hwnd)
hmemdc  = n_api.CreateCompatibleDC(hdc)

if hdc <= 0 or hwnd <= 0 then return false

if n_api.IsIconic(hwnd) then return false

n_api.GetWindowRect(hwnd, rt)

dwWidth  = rt.right - rt.left
dwHeight = rt.bottom - rt.top

if dwWidth <= 0 or dwHeight <= 0 then return false

hbmp  = n_api.CreateCompatibleBitmap(hdc, dwWidth, dwHeight)

n_api.SelectObject(hmemdc, hbmp)
n_api.BitBlt(hmemdc, 0, 0, dwWidth, dwHeight, hdc, 0, 0, n_api.SRCCOPY)

dwBPP  = n_api.GetDeviceCaps(hdc, n_api.BITSPIXEL)
if dwBPP <= 8 then
dwNumColors = n_api.GetDeviceCaps(hdc, n_api.NUMCOLORS)
else
dwNumColors = 0
end if

dwImageSize = dwWidth * dwHeight * dwBPP/8    //每个字节由8位组成

BitmapInfo lstr_Info
BitmapFileHeader lstr_Header

//填充BitmapFileHeader
lstr_Info.bmiheader.biSize  = 40
lstr_Info.bmiheader.biWidth  = dwWidth
lstr_Info.bmiheader.biHeight  = dwHeight
lstr_Info.bmiheader.biPlanes  = 1
lstr_Info.bmiheader.biBitCount  = dwBPP
  相关解决方案