如何截取屏幕存到剪切板?

有品的和弦 2002-05-16 04:21:54
其实是两个问题:
1.我可以截取屏幕存成位图文件,但我想截取屏幕后以位图格式直接存在剪切板上。
2.如果是一个CScrollView,如何把整个Client(包括没有“滚”出来的部分)都存成位图文件?
...全文
332 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
hyc1980 2002-05-22
  • 打赏
  • 举报
回复
OpenClipboard(); // Reserve clipboard for this program

// ***************************************************************
// There are two alternative sources of bitmaps that this sample
// can use. Choose either the 4 lines (next) that use "MyBitmap"
// from the resource file, or the line below that which loads a
// bitmap from a bitmap file.


// Alternative 1: This code places a bitmap drawn by you in the
// resource editor onto a button
/* Remove the comment if you use this alternative
CBitmap MyBitmap;
MyBitmap.LoadBitmap(IDB_BITMAP1); // A Bitmap you drew in the
// Resource Editor
HBITMAP MyBitmapHandle = (HBITMAP)MyBitmap; // Cast it to a HBITMAP
SetClipboardData(CF_BITMAP, MyBitmapHandle);
*/ //Remove the comment to use alternative 1.
// End if alternative 1


// Alternative 2: This code places a bitmap from a file onto
// the button. Comment it out if you use alternative 1 above.
if(NULL==(SetClipboardData(CF_BITMAP, LoadImage(NULL,
"C:\\Test.bmp", IMAGE_BITMAP, 0,
0, LR_DEFAULTSIZE|LR_LOADFROMFILE) )))
{
AfxMessageBox("SetClipboardData returned a NULL");
};
// End of alternative 2

// End of alternatives
// ***************************************************************

CloseClipboard(); // Free clipboard so PasteFace() can use it
opentuxedo 2002-05-22
  • 打赏
  • 举报
回复
按print screen sys rp键,或发一个该建的消息
hustwjz 2002-05-22
  • 打赏
  • 举报
回复
An application can simulate a press of the PRINTSCREEN key in order to obtain a screen snapshot and save it to the clipboard. To do this, call keybd_event with the bVk parameter set to VK_SNAPSHOT, and the bScan parameter set to 0 for a snapshot of the full screen or set bScan to 1 for a snapshot of the active window.

hyc1980 2002-05-22
  • 打赏
  • 举报
回复
用OpenClipboard,SetClipboardData, CloseClipboard!

还可以用COleDataSource的SetClipboard,这种方法是利用IDataObject来实现的,它封装了OleSetClipboard喝OleGetClipboard,具体自己看msdn,不是一两句话可以说完
dyw 2002-05-22
  • 打赏
  • 举报
回复
发送一个屏幕拷贝的系统组合键消息!
有品的和弦 2002-05-17
  • 打赏
  • 举报
回复
能否详细点儿?
ColderRain 2002-05-16
  • 打赏
  • 举报
回复
你可以获得屏幕DC: GetDC(NULL) ,

16,548

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • AIGC Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧