Simon Mourier's Avatar
Simon Mourier's blog (1353 answers on StackOverflow) about Microsoft technologies C#, C/C++, .NET, WinRT, WinUI, COM, Interop, DirectX, Direct2D, Windows, ...
  • 🔎︎ Search
  • Categories
  • Archives
  • About Me
  • c/c++
  • imaging
  • visual-studio
  • winapi

How to send a HBITMAP over a socket using WIN32 and C++?

May 16, 2011 See the question and my original answer on StackOverflow

You can't pass an HBITMAP (which is a HANDLE, a reference pointer in memory) to another machine. You can use the GetBitmapBits Function to transform the HBITMAP into a byte array and send this byte array using send().

On the other side, you'll have to create another compatible bitmap, and use SetBitmapBits Function after the recv().

  • SmoBlog © 2010-2025 Simon Mourier. All rights reserved.
  • Privacy & Terms