Hi everyone, here's an update on my progress.

I tried to get the "Artemis" project working, but I couldn't. The server loaded, but it didn't detect the clients.
Getting back to my project, as I mentioned, I enabled hardware acceleration, but it's still slow. Then I converted my project to UDP client-to-client hole punching, with the server acting only as a signaler, but it's still slow.
Basically, I discovered that when the controlled PC's resolution is 1920x1080, my program is slow when moving large windows, but if the controlled PC's resolution is 1024x768, it moves faster. Therefore, I was thinking of adding an option so that when the connection starts, the controlled PC's resolution drops to 1024x768, but that doesn't seem very professional.
So, after trying everything, the only thing left to try is using video streaming instead of using compressed JPEG screen sharing.
If anyone knows of or has a project for screen sharing with video streaming in Lazarus Free Pascal, I would greatly appreciate it if you could share it.