I am sorry to tell you, that you are missing the needed knowledge about bitmaps. Here is a good starting point in the
Microsoft documentation. Please take a deeper look at the different CreateBitmap and BitBlt function to understand the HBITMAP. It is a handle to a system object and needs a lot of care. ;-)
My idea and
knowledge would go the other way by providing the data from C# and fill it in C++.
cook book
1. ask for the size
2. allocate in C# a bitmap and transfer the handle or the buffer
3. copy the bitmap into the bitmap handle or get the bits filled in C++
Tip: use the search box and look at different samples