Dav*_*lle 112 windows screenshot
在Windows XP中,可以按Alt-PrintScreen复制活动窗口的图像,或按Ctrl-PrintScreen复制完整桌面的图像.
然后可以将其粘贴到接受图像的应用程序中:Photoshop,Microsoft Word等.
我想知道:有没有办法将屏幕截图直接保存到文件中? 我是否真的必须打开一个图像程序,如Paint.net或Photoshop,只需粘贴图像,然后保存它?
The*_*edi 150
在Windows 8之前没有第三方工具直接保存到文件中.这是我个人最喜欢的非第三方工具解决方案.
+ PrintScreen 将屏幕截图保存到文件夹中<user>/Pictures/Screenshots
在win 7中,只需使用剪切工具:最容易通过按Start键进入,然后键入"sni"(输入).或
再sni enter
我使用以下键盘组合来捕获,然后使用mspaint保存.完成几次后,只需2-3秒:
此外,Cropper很棒(和开源).它将矩形捕获到文件或剪贴板,当然是免费的.
Pat*_*ins 50
您可以编写非常简单的代码来挂钩PrintScreen并将捕获保存在文件中.
这是开始捕获并保存到文件的东西.您只需要勾选"打印屏幕"键即可.
using System;
using System.Drawing;
using System.IO;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
public class CaptureScreen
{
static public void Main(string[] args)
{
try
{
Bitmap capture = CaptureScreen.GetDesktopImage();
string file = Path.Combine(Environment.CurrentDirectory, "screen.gif");
ImageFormat format = ImageFormat.Gif;
capture.Save(file, format);
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
public static Bitmap GetDesktopImage()
{
WIN32_API.SIZE size;
IntPtr hDC = WIN32_API.GetDC(WIN32_API.GetDesktopWindow());
IntPtr hMemDC = WIN32_API.CreateCompatibleDC(hDC);
size.cx = WIN32_API.GetSystemMetrics(WIN32_API.SM_CXSCREEN);
size.cy = WIN32_API.GetSystemMetrics(WIN32_API.SM_CYSCREEN);
m_HBitmap = WIN32_API.CreateCompatibleBitmap(hDC, size.cx, size.cy);
if (m_HBitmap!=IntPtr.Zero)
{
IntPtr hOld = (IntPtr) WIN32_API.SelectObject(hMemDC, m_HBitmap);
WIN32_API.BitBlt(hMemDC, 0, 0,size.cx,size.cy, hDC, 0, 0, WIN32_API.SRCCOPY);
WIN32_API.SelectObject(hMemDC, hOld);
WIN32_API.DeleteDC(hMemDC);
WIN32_API.ReleaseDC(WIN32_API.GetDesktopWindow(), hDC);
return System.Drawing.Image.FromHbitmap(m_HBitmap);
}
return null;
}
protected static IntPtr m_HBitmap;
}
public class WIN32_API
{
public struct SIZE
{
public int cx;
public int cy;
}
public const int SRCCOPY = 13369376;
public const int SM_CXSCREEN=0;
public const int SM_CYSCREEN=1;
[DllImport("gdi32.dll",EntryPoint="DeleteDC")]
public static extern IntPtr DeleteDC(IntPtr hDc);
[DllImport("gdi32.dll",EntryPoint="DeleteObject")]
public static extern IntPtr DeleteObject(IntPtr hDc);
[DllImport("gdi32.dll",EntryPoint="BitBlt")]
public static extern bool BitBlt(IntPtr hdcDest,int xDest,int yDest,int wDest,int hDest,IntPtr hdcSource,int xSrc,int ySrc,int RasterOp);
[DllImport ("gdi32.dll",EntryPoint="CreateCompatibleBitmap")]
public static extern IntPtr CreateCompatibleBitmap(IntPtr hdc, int nWidth, int nHeight);
[DllImport ("gdi32.dll",EntryPoint="CreateCompatibleDC")]
public static extern IntPtr CreateCompatibleDC(IntPtr hdc);
[DllImport ("gdi32.dll",EntryPoint="SelectObject")]
public static extern IntPtr SelectObject(IntPtr hdc,IntPtr bmp);
[DllImport("user32.dll", EntryPoint="GetDesktopWindow")]
public static extern IntPtr GetDesktopWindow();
[DllImport("user32.dll",EntryPoint="GetDC")]
public static extern IntPtr GetDC(IntPtr ptr);
[DllImport("user32.dll",EntryPoint="GetSystemMetrics")]
public static extern int GetSystemMetrics(int abc);
[DllImport("user32.dll",EntryPoint="GetWindowDC")]
public static extern IntPtr GetWindowDC(Int32 ptr);
[DllImport("user32.dll",EntryPoint="ReleaseDC")]
public static extern IntPtr ReleaseDC(IntPtr hWnd,IntPtr hDc);
}
Run Code Online (Sandbox Code Playgroud)
更新 这里是从C#挂钩PrintScreen(和其他键)的代码:
Phi*_*Lho 17
鲜为人知的事实:在大多数标准Windows(XP)对话框中,您可以按Ctrl + C以获得对话框内容的文本副本.
示例:在记事本中打开文件,点击空格,关闭窗口,在确认退出对话框上按Ctrl + C,取消,在记事本中粘贴对话框的文本.
与你的直接问题无关,但我在这个帖子中提到它会很好.
实际上,你需要第三方软件来制作屏幕截图,但你不需要为此开发大型Photoshop.像IrfanWiew或XnView这样的免费轻量级产品可以完成这项工作.我使用MWSnap来复制屏幕的任意部分.我写了一个AutoHotkey脚本,调用GDI +函数来做截图.等等.
sda*_*aau 15
感谢所有的源代码和评论 - 多亏了这一点,我终于有了一个我想要的应用程序:)
我编写了一些示例,可以在这里找到源代码和可执行文件:
http://sdaaubckp.svn.sourceforge.net/viewvc/sdaaubckp/xp-take-screenshot/
我使用InterceptCaptureScreen.exe - 只需在命令提示符终端中运行它,然后在想要捕获屏幕截图(时间戳文件名,png,在可执行文件所在的同一目录中)时按Insert; 即使终端未对焦,也会捕获密钥.
(我使用Insert键,因为它应该有更容易的时间传播,比如VNC而不是PrintScreen - 在我的笔记本电脑上需要按下Fn键,而且不会通过VNC传播.当然,它很容易改变什么是源代码中使用的实际密钥).
希望这会有所帮助,干杯!
Kar*_*k T 11
非常老的帖子我意识到,但是Windows终于意识到这个过程是多么无聊.
在Windows 8.1中(已验证,在Windows 7中无法运行(tnx @bobobobo))
windows key+ prnt screen将屏幕截图保存到文件夹中<user>/Pictures/Screenshots
小智 6
我可以建议WinSnap http://www.ntwind.com/software/winsnap/download-free-version.html.它提供自动保存选项并捕获alt + printscreen和其他组合键以捕获屏幕,窗口,对话框等.
Dropbox现在提供了自动执行此操作的钩子.如果您获得免费的Dropbox帐户并安装笔记本电脑应用程序,当您按PrtScr Dropbox时,您可以选择自动将所有屏幕截图存储到您的Dropbox文件夹中.
| 归档时间: |
|
| 查看次数: |
311359 次 |
| 最近记录: |