C Win32: save .bmp image from HBITMAP

前端 未结 4 2116
谎友^
谎友^ 2021-02-20 07:13

I am working with a framegrabber and need to get the images from computer memory and save them on an image file. after trying for couple of days I end up with the following 2 fu

4条回答
  •  长发绾君心
    2021-02-20 08:02

    From the documentation for CreateCompatibleDC:

    When the memory DC is created, its display surface is exactly one monochrome pixel wide and one monochrome pixel high. Before an application can use a memory DC for drawing operations, it must select a bitmap of the correct width and height into the DC.

    Since you're using CreateDIBSection with that DC, the resulting DIB section will be 1-bit monochrome as well.

提交回复
热议问题