本文为转载,原文地址丢失,sorry

##################################################################################################################

找了一些WinCE下的截图软件,但大都是ARM平台下的,可怜俺用的是Intel,还是自己写吧。

找了一篇WinCE下的截屏代码,真的不错,真的像原作者说的,不用修改。
———————————————————————————————————————————————————————————————————————————

// this function create a bmp file to save the current screen;
// supported eVC++ 4.0 (wince 4.0) and vc++ 6.0 , test pass; 

void CSnapDlg::OnScreenSave(const char *filename)

    HDC  hScrDC, hMemDC;         
    int  width, height; 
 
 //the pointer will save all pixel point's color value
 BYTE  *lpBitmapBits = NULL; 
        
 //creates a device context for the screen device
    hScrDC = CreateDC(_T("DISPLAY"), NULL, NULL, NULL);

//get the screen point size
    width = GetDeviceCaps(hScrDC, HORZRES);
    height = GetDeviceCaps(hScrDC, VERTRES);

//creates a memory device context (DC) compatible with the screen device(hScrDC)  
    hMemDC = CreateCompatibleDC(hScrDC);

 //initialise the struct BITMAPINFO for the bimap infomation, 
 //in order to use the function CreateDIBSection
 // 
on wince os, each pixel stored by 24 bits(biBitCount=24) 
 //and no compressing(biCompression=0) 

    BITMAPINFO RGB24BitsBITMAPINFO; 
    ZeroMemory(&RGB24BitsBITMAPINFO, sizeof(BITMAPINFO));
    RGB24BitsBITMAPINFO.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
    RGB24BitsBITMAPINFO.bmiHeader.biWidth = width;
    RGB24BitsBITMAPINFO.bmiHeader.biHeight = height;
    RGB24BitsBITMAPINFO.bmiHeader.biPlanes = 1;
    RGB24BitsBITMAPINFO.bmiHeader.biBitCount = 24;
   
  //use the function CreateDIBSection and SelectObject 
 //in order to get the bimap pointer : lpBitmapBits 

    HBITMAP directBmp = CreateDIBSection(hMemDC, (BITMAPINFO*)&RGB24BitsBITMAPINFO, 
       DIB_RGB_COLORS, (void **)&lpBitmapBits, NULL, 0);
 HGDIOBJ previousObject = SelectObject(hMemDC, directBmp);

// copy the screen dc to the memory dc
 BitBlt(hMemDC, 0, 0, width, height, hScrDC, 0, 0, SRCCOPY);
 
 //if you only want to get the every pixel color value, 
 //you can begin here and the following part of this function will be unuseful;
 //the following part is in order to write file;

 //bimap file header in order to write bmp file 
 BITMAPFILEHEADER bmBITMAPFILEHEADER;
 ZeroMemory(&bmBITMAPFILEHEADER, sizeof(BITMAPFILEHEADER));
 bmBITMAPFILEHEADER.bfType = 0x4d42;  //bmp  
    bmBITMAPFILEHEADER.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);
    bmBITMAPFILEHEADER.bfSize = bmBITMAPFILEHEADER.bfOffBits + ((width*height)*3); ///3=(24 / 8)
 
 //write into file
 FILE *mStream = NULL;
 if((mStream = fopen(filename, "wb")))
 {  
  //write bitmap file header
  fwrite(&bmBITMAPFILEHEADER, sizeof(BITMAPFILEHEADER), 1, mStream);
  //write bitmap info
  fwrite(&(RGB24BitsBITMAPINFO.bmiHeader), sizeof(BITMAPINFOHEADER), 1, mStream);
  //write bitmap pixels data
  fwrite(lpBitmapBits, 3*width*height, 1, mStream);
   //close file
  fclose(mStream);
 }
 
 //delete
 DeleteObject(hMemDC);
 DeleteObject(hScrDC);
 DeleteObject(directBmp);
 DeleteObject(previousObject);
}

实现WIN CE下截屏并且保存到文件相关推荐

  1. EVC实现WIN CE下截屏

    这几天在看老大写的博客(http://blog.csdn.net/norains ,八卦一下我老大在CSDN上小有名气已经成为了专家), 虽然跟着老大一年多了学到不少的东西但是发现自己要学的东西还有很 ...

  2. w ndows默认截图工具,浅谈Win10系统下截屏方式

    前言 虽然近年来Windows式微的言论从不间断,微软也不再将Windows系统作为核心业务而是转向"AI为先·云为先"的战略,但Windows依然占据着全球88.5%的电脑桌面, ...

  3. 服务器双系统快捷键,Mac/Win7双系统下截屏快捷键介绍

    由于苹果电脑采用的是mac系统,使用的用户相对较少,不少购买苹果电脑的朋友经常会遇到一些截图困扰,接下来是小编为大家收集的Mac/Win7双系统下截屏快捷键介绍,希望能帮到大家. Mac/Win7双系 ...

  4. 苹果xr如何截屏_iphone敲两下截屏如何操作 苹果手机触控截屏方法【教程步骤】...

    iphone敲两下截屏如何操作?相信小伙伴们一定很好奇,下面小编为大家带来了苹果手机触控截屏方法教程详解,感兴趣的小伙伴赶紧跟着小编一起来看看吧 iphone敲两下截屏怎么设置 轻点两下进行截屏其实是 ...

  5. Windows CE/Moblie截屏工具及实现源码

    Windows CE/Moblie截屏工具及实现源码 [img]http://dl2.iteye.com/upload/attachment/0084/6997/c72941f2-b86e-3683- ...

  6. UEFI开发探索99 – UEFI Shell下截屏工具

    (请保留-> 作者: 罗冰 https://blog.csdn.net/luobing4365) UEFI Shell下截屏工具 1 PrintScreenLogger的代码结构 1)Print ...

  7. Ubuntu系统下截屏快捷键

    Ubuntu系统下截屏快捷键 常用的: fn+print: 全屏截图 ctrl+alt+print:截取当前窗口 参考链接:https://blog.csdn.net/sunshine_lyn/art ...

  8. 苹果笔记本装windows10后,如何一键截屏并保存到onedrive中?

    苹果macbook pro,为了工作方便装了win10. 前几天在开线上会的时候,有些内容需要记录下,突然发现不会使用苹果本截屏快捷键,于是用QQ截屏凑合用了. 晚上回到家,终于找到了苹果本在win1 ...

  9. Linux下截屏方法!

    一.最便捷的方法         1.按下印屏幕键,截取整个桌面:         2.按下Alt+屏幕键,截取当前窗口: 二.命令行截屏         1.import screenshot.jp ...

最新文章

  1. 云炬Android开发教程 Android Studio自带的AVD模拟器安装教程
  2. Fast R-CNN 个人理解
  3. mysql 数据库 额外_Manager额外参数怎么学?mysql数据库学习
  4. java双缓存机制_详解JVM类加载机制及类缓存问题的处理方法
  5. mysql数据库栏目_MySQL的一些小技巧(持续更新) - mysql数据库栏目
  6. p2p-如何拯救k8s镜像分发的阿喀琉斯之踵?
  7. ModelCoder中的超密时间模型
  8. 招商:笔试题(数组统计重复次数,面包累计问题)
  9. Android开源项目汇总
  10. Choerodon 的微服务之路(二):Choerodon 的微服务网关
  11. 【论文阅读】EMNLP 2018 基于自适应的多轮解码机制的神经机器翻译模型
  12. Redis详解(七)——Redis主从同步高可用架构
  13. 杭电多校HDU 6601 Keen On Everything But Triangle(主席树)题解
  14. MSP430开发笔记之五:硬件IO中断与IR红外接收
  15. 【重要】股票收益互换
  16. pano2vr输出的HTML手机可以看吗,Pano2VR怎么导出手机可看_ Pano2VR导出手机查看教程...
  17. 计算机打代码的技巧,工作超实用的电脑技巧
  18. 通过网线实现两台PC相互通信(并实现访问公网)
  19. Minimum supported Gradle version is 5.4.1. Current version is 4.10.1. If using the gradle wrapper
  20. flink-cdc 同步 Postgre SQL 基本配置【1】

热门文章

  1. 英语dyamaund钻石dyamaund单词
  2. hk域名如何注册?为什么要选择.hk域名?
  3. Java设计模式面试题及答案(持续更新。。。)
  4. Nginx SPDY patch实现
  5. Block 本质、实现原理、内存管理、循环引用、__block等
  6. 怎样才能让身体更加健康?
  7. 今天15:00| ICML专场四,7位PhD来袭!
  8. 人民币贬值速度计算公式及应对措施
  9. win10-Administrator账户停用怎么重新启用(亲测有效)
  10. 渗透信息收集 子域名查询