【问题标题】:My own print screen key我自己的打印屏幕键
【发布时间】:2013-12-25 09:51:50
【问题描述】:

我们如何用 C 语言编写一个程序,用其他 kry 替换相同功能的“打印屏幕”键(即获取整个屏幕的图片)。

【问题讨论】:

  • 1) 哪个操作系统/哪个 GUI/哪个桌面环境? 2)您是否希望另一个键像 printscreen 通常那样工作,或者您是否希望 printscreen 键做其他正常工作?
  • 我想为打印屏幕创建一个新的默认键,我使用的是 Windows 8。

标签: c printscreen


【解决方案1】:
void dump_buffer()
{
   IDirect3DSurface9* pRenderTarget=NULL;
   IDirect3DSurface9* pDestTarget=NULL;
     const char file[] = "Pickture.bmp";
   // sanity checks.
   if (Device == NULL)
      return;

   // get the render target surface.
   HRESULT hr = Device->GetRenderTarget(0, &pRenderTarget);
   // get the current adapter display mode.
   //hr = pDirect3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT,&d3ddisplaymode);

   // create a destination surface.
   hr = Device->CreateOffscreenPlainSurface(DisplayMde.Width,
                         DisplayMde.Height,
                         DisplayMde.Format,
                         D3DPOOL_SYSTEMMEM,
                         &pDestTarget,
                         NULL);
   //copy the render target to the destination surface.
   hr = Device->GetRenderTargetData(pRenderTarget, pDestTarget);
   //save its contents to a bitmap file.
   hr = D3DXSaveSurfaceToFile(file,
                              D3DXIFF_BMP,
                              pDestTarget,
                              NULL,
                              NULL);

   // clean up.
   pRenderTarget->Release();
   pDestTarget->Release();
}

你去

【讨论】:

  • 请提供更多上下文而不是转储整个代码块作为答案
猜你喜欢
  • 1970-01-01
  • 2011-03-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多