This is the good solution but "serialization" is usually a blurry word for beginners, I try to give OP a bit of help about serialization. Serialization is the process of converting one or more objects into a self contained piece of data that is self-contained/independent of the volatile state of your program. You do serialization for example when you save out a document into a file. The document data is self-contained and independent of the volatile state of your program because you can perfectly load it back to your program even after a program restart (that causes total loss of volatile state info). When you serialize you don't necessarily have to save the data into a file, instead you can send it over the network to another process that can "load" (deserialize) this data by creating objects that contain the same information from which the serialized data was created in the first process. Of course the pointerss to the objects will be probably different but the connection between the objects and their state variables can be identical.
Socket is just an unstructured byte stream, so you can certainly pass the pointer address as bytes on to other end. You will have to marshal pointer into bytes @ sending end and unmarshal it back to pointer at receiving end. To unmarshal, the receiver must either share the same address space as the sender or be provided a proxy to the same address space.
Oh, does this start to sound like Remoting?
Yep, that is what this is. Remoting does provide means to make a process function pointers visible to another process and Remoting does involve Sockets and passing of pointers to class. (Okay Okay, they're called reference)
As others have stated, you could pass pointers, but they would be meaningless to the other program since he can't access the memory addresses of the other exe (unless, it's "shared memory", continue reading). Your best bet would be to either transfer all the bytes of the image being referenced (or object, using serialization or other similar methods) or if both programs are local, let the client know where to find the image.
One common form of inter-process communications (IPC) is using "shared memory"[^]. In this case, one application would set up a shared memory pool that others can access. This is typically done for applications that need to work extremely fast (and all have direct access to the shared memory location) and don't want the overhead (or need the flexibility) of other IPC options (such as sockets or pipes).
I am unsure why are you using sockets, and I feel that there may be better options to choose from if you're having just one process.
If you could explain the situation with the required information (see this post[^] for help on what information to include in your question), someone here might be able to offer you a good alternative.
It has two monitor, main and expand monitor.
The expand monitor in the top with higher resolution ratio， and the main minitor in the bottom.
But if I drag a window to the expand monitor and then double click to show maximium, it has problem, it cannot fill of the windows of the expand monitor? why ? It save the main monitor rectangle info, how to change it.