I know that to create a DIB I use CreateDIBSection
I know that to create a DC for the DIB I use CreateCompatibleDC
Then to select the DIB for use in the DC I use SelectObject
At this point I can copy pixel data from an external array into the DIB's pixel memory by using CopyMemory.
Then to display the image in the DIB I BitBlt its DC into a picture box, and then refresh the picture box.
However this is somewhat inefficient, because there is a potentially unneeded use of CopyMemory. Instead of copying from the array into the DIB with CopyMemory, I would like to know how to assign the memory region used by the DIB to be my byte array, so that any changes made to the data in the byte array are instantly available for use by the DIB or its DC (with commands like BitBlt) without having to use the intermediate step of CopyMemory. I believe this is called "binding" the array to the DIB, but I'm not sure how to do it. What API calls will I need to accomplish this? Is this even possible with normal WinAPI calls?
I know that to create a DC for the DIB I use CreateCompatibleDC
Then to select the DIB for use in the DC I use SelectObject
At this point I can copy pixel data from an external array into the DIB's pixel memory by using CopyMemory.
Then to display the image in the DIB I BitBlt its DC into a picture box, and then refresh the picture box.
However this is somewhat inefficient, because there is a potentially unneeded use of CopyMemory. Instead of copying from the array into the DIB with CopyMemory, I would like to know how to assign the memory region used by the DIB to be my byte array, so that any changes made to the data in the byte array are instantly available for use by the DIB or its DC (with commands like BitBlt) without having to use the intermediate step of CopyMemory. I believe this is called "binding" the array to the DIB, but I'm not sure how to do it. What API calls will I need to accomplish this? Is this even possible with normal WinAPI calls?