谁能指教指教 最好能有完整的例子谢谢了
------解决方案--------------------
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函数
- C# code
////////////////////////////////////////////////////////////////////////// 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_imagedataulong hdc, hmemdc, hbmpulong dwNumColors, dwBPP, dwImageSizeulong dwWidth, dwHeightrect rthdc = n_api.GetWindowDC(hwnd)hmemdc = n_api.CreateCompatibleDC(hdc)if hdc <= 0 or hwnd <= 0 then return falseif n_api.IsIconic(hwnd) then return falsen_api.GetWindowRect(hwnd, rt)dwWidth = rt.right - rt.leftdwHeight = rt.bottom - rt.topif dwWidth <= 0 or dwHeight <= 0 then return falsehbmp = 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 = 0end ifdwImageSize = dwWidth * dwHeight * dwBPP/8 //每个字节由8位组成BitmapInfo lstr_InfoBitmapFileHeader lstr_Header//填充BitmapFileHeaderlstr_Info.bmiheader.biSize = 40lstr_Info.bmiheader.biWidth = dwWidthlstr_Info.bmiheader.biHeight = dwHeightlstr_Info.bmiheader.biPlanes = 1lstr_Info.bmiheader.biBitCount = dwBPPlstr_Info.bmiheader.biCompression = 0lstr_Info.bmiheader.biSizeImage = dwImageSizelstr_Info.bmiheader.biXPelsPerMeter = 0lstr_Info.bmiheader.biYPelsPerMeter = 0lstr_Info.bmiheader.biClrUsed = dwNumColorslstr_Info.bmiheader.biClrImportant = dwNumColorsb_imagedata = blob(space(dwImageSize))//从HBMP获取图像数据GetDIBits(hmemdc, hbmp, 0, dwHeight, b_imagedata, lstr_Info, 0)lstr_Header.bfType[1] = 'B'lstr_Header.bfType[2] = 'M'lstr_Header.bfSize = dwImageSize + & 14/*sizeof(bitmapfileheader)*/ + & 40/*sizeof(bitmapinfoheader)*/ + & dwNumColors * 4 /*sizeof(RGBQUAD)*/lstr_Header.bfReserved1 = 0lstr_Header.bfReserved2 = 0lstr_Header.bfOffBits = 14/*sizeof(bitmapfileheader)*/ + & 40/*sizeof(bitmapinfoheader)*/ + & dwNumColors * 4 /*sizeof(RGBQUAD)*/blob{14} lbl_headerblob{40} lbl_infoCopyBitmapFileHeader(lbl_header, lstr_Header, 14/*sizeof(bitmapfileheader)*/ )CopyBitmapInfo(lbl_Info, lstr_Info, 40/*sizeof(bitmapinfoheader)*/)b_imagedata = lbl_header + lbl_info + b_imagedatan_api.DeleteDC(hmemdc)n_api.ReleaseDC(hwnd, hdc)//return Save2File(filename, b_imagedata)return Save2FileEx(filename, b_imagedata)