Microsoft KB Archive/201955: Difference between revisions
m (Text replacement - "[[1" to "[[../1") |
m (Text replacement - """ to """) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 44: | Line 44: | ||
For additional information on how to properly create a Memory Device Context, click the article number below to view the article in the Microsoft Knowledge Base: | For additional information on how to properly create a Memory Device Context, click the article number below to view the article in the Microsoft Knowledge Base: | ||
<blockquote>[[../139165 | <blockquote>[[../139165|Q139165]] PRB: Memory DC Produces Monochrome Images</blockquote> | ||
To initialize the image in the memory DC with an image stored as a device independent bitmap (DIB), see the following Knowledge Base article:<br /> | To initialize the image in the memory DC with an image stored as a device independent bitmap (DIB), see the following Knowledge Base article:<br /> | ||
<blockquote>[[66595 | <blockquote>[[../66595|Q66595]] INFO: Using SetDIBitsToDevice() with a Memory Device Context</blockquote> | ||
Alternatively, an image in DIB format can be used with the '''CreateDIBSection''' function to create an HBITMAP for a memory DC that can be simultaneously initialized or changed through a pointer to the image bits and through a memory DC. For an example of how to use DIBs see the following Knowledge Base sample article: | Alternatively, an image in DIB format can be used with the '''CreateDIBSection''' function to create an HBITMAP for a memory DC that can be simultaneously initialized or changed through a pointer to the image bits and through a memory DC. For an example of how to use DIBs see the following Knowledge Base sample article: | ||
<blockquote>[[../186221 | <blockquote>[[../186221|Q186221]] SAMPLE: DibSectn.exe Uses DIBSections in Win32</blockquote> | ||
For more information on DIBs, see the article entitled | For more information on DIBs, see the article entitled "DIBs and Their Use" by Ron Gery:<br /> | ||
Latest revision as of 12:48, 21 July 2020
PRB: Blt from a Memory Device Context Does Not Produce an Image |
Q201955
The information in this article applies to:
- Microsoft Win32 Application Programming Interface (API)
SYMPTOMS
Calling a bit block transfer (Blt) function with a memory device context (DC) as the source DC does not produce an image and does not return FALSE to indicate failure.
CAUSE
The memory device context was created properly but has not had a bitmap selected into it.
In Windows, all memory DCs are created with a default 1-pixel by 1-pixel monochrome bitmap. If an application does not select an HBITMAP object into the memory DC, the only source or destination for the image bits is the single pixel in the default bitmap.
Note that the Blt function succeeded and an image was transferred to the destination DC. However, it is probably not noticeable because it has most likely created a single black pixel on the destination DC.
RESOLUTION
To create a memory DC that produces an image when it is used as a source DC in a bit block transfer function, create and select a bitmap into the memory DC that contains image pixels of some form.
For additional information on how to properly create a Memory Device Context, click the article number below to view the article in the Microsoft Knowledge Base:
Q139165 PRB: Memory DC Produces Monochrome Images
To initialize the image in the memory DC with an image stored as a device independent bitmap (DIB), see the following Knowledge Base article:
Q66595 INFO: Using SetDIBitsToDevice() with a Memory Device Context
Alternatively, an image in DIB format can be used with the CreateDIBSection function to create an HBITMAP for a memory DC that can be simultaneously initialized or changed through a pointer to the image bits and through a memory DC. For an example of how to use DIBs see the following Knowledge Base sample article:
Q186221 SAMPLE: DibSectn.exe Uses DIBSections in Win32
For more information on DIBs, see the article entitled "DIBs and Their Use" by Ron Gery:
STATUS
This behavior is by design.
REFERENCES
CreateDIBSection in the Platform SDK Documentation:
Additional query words:
Keywords : kbBitmap kbDevContext kbGDI kbDSupport kbgrpdsvc
Issue type : kbprb
Technology : kbAudDeveloper kbWin32sSearch kbWin32API
Last Reviewed: June 15, 2001 |