Monday, February 25, 2008
Now I must add some way to send the special device keys, like the phone and left / right selection buttons.
Saturday, February 23, 2008
On another note, I will be working throughout this weekend on a Windows Mobile remote control server (something like Pocket Controller). After writing the screen grabber tool, this is an extension I really want to have a go at. Will post the results here as they become available.
Monday, February 11, 2008
One of the things I tried out during the development of this code to send mouse events to the device. When the user clicked the desktop screen with the device screen capture, a mouse message would be sent to the device via a different remote call. Although a bit crude, it was possible to remotely control the device (with some notable exceptions...). So this set my mind in motion (again) and now I'm writing a streamed version of the RAPI DLL so that it accepts commands from the desktop (such as mouse messages and even keyboard presses) and returns device screens to the desktop. I will post the code when it is ready (and working).
Thursday, February 07, 2008
Tuesday, February 05, 2008
Searching the net for source code samples turned nothing (blame Live and Google). The best approach I got was from a CodeProject article but the proposed GDI method does not work on Windows Mobile because the CAPTUREBLT flag is not supported. This means that I needed another solution.
GAPI seemed to be a very good candidate. It has a very simple API and I had used it in the past, but it is now declared deprecated by Microsoft and I was prompted to use Direct Draw instead. Willing to learn a bit more about this technology, I decided to give it a go and spent a couple of hours reading through MSDN docs to figure out how this can be done. As it turned out, it's very simple.
To capture the device screen using Direct Draw you need to follow these simple steps (I will write an article on this illustrating a desktop tool to capture the device screen via RAPI):
- Initialize Direct Draw using the DirectDrawCreate function using NULL as the first parameter.
- Set the cooperative level to DDSCL_NORMAL. This is enough for accessing the primary surface in read-only mode.
- Create the primary surface using this code.
- Get the surface's HDC and use it to create a compatible DC.
- Create a compatible bitmap using the screen dimensions and select it to the compatible DC.
- Blit from the surface DC to the compatible DC using BitBlt.
- Done! The compatible bitmap now contains the device's screen capture.
I wrote this using a DIBSection in order to marshal it via a RAPI call and was able to deserialize it on the desktop and display the device screen capture. I'm planning to use this same marshalling technique to implement a remote file browser using the device's own system image list.
Stay tuned for the article!