Monday, February 25, 2008

Windows Mobile Remote Control

Here is the first version of the Windows Mobile Remote Control application. It basically extends the concepts I developed for the Code Project article "A Remote Windows Mobile Screen Grabber". Instead of a blocking RAPI call, this project uses a streamed call so that a live connection persists between the device and the desktop. Mouse and keyboard events are now sent over to the device so you can remotely control your device from the desktop. Please note that this is still a bit crude and will fail under some circumstances, like when you launch a Direct Draw application on the device. For regular GDI applications, it should work just fine (if you can live with 4-5 fps, that is).

Now I must add some way to send the special device keys, like the phone and left / right selection buttons.

Saturday, February 23, 2008

Windows Mobile Developer Center

MSDN has revamped the Windows Mobile Developer Center. Go take a look (yes, you will find native code there). I am especially interested in the DirectX samples.

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

Remote Screen Grabber

As promised: A Remote Windows Mobile Screen Grabber

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

Interview

If you are interested to know a little bit more abut me, take a look at Christopher Fairbairn's blog. Thank you for this, Chris!

Tuesday, February 05, 2008

Windows Mobile Screen Capture

While waiting for Vista SP1 to hit the MSDN downloads section, I decided to investigate a little bit on an issue that has caught my curiosity time and again: remote capturing of the device screen. There are lots of products on the market that will do this for you, but the question of how it is done kept my curiosity alive.

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):
  1. Initialize Direct Draw using the DirectDrawCreate function using NULL as the first parameter.
  2. Set the cooperative level to DDSCL_NORMAL. This is enough for accessing the primary surface in read-only mode.
  3. Create the primary surface using this code.
  4. Get the surface's HDC and use it to create a compatible DC.
  5. Create a compatible bitmap using the screen dimensions and select it to the compatible DC.
  6. Blit from the surface DC to the compatible DC using BitBlt.
  7. 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!

Monday, February 04, 2008

Vista SP1 around the corner

According to this, Vista SP1 goes RTM today. I really want to install the SP1 and check the improvements it has in store for me. I have to tell you that Vista was a bit of a let-down when it refused to run eVC3 and eVC4 (I don't care about VS 2003). Microsoft's Virtual PC was also disappointing because it does not support USB, so I had to resort to a third-party VM (Parallels) to get a USB 1.1 emulation. Note that I do not expect that SP1 will add support for the eVC compilers, but I do expect to see some improvements in overall speed and especially when getting out of sleep mode. My Asus VX2 does not always wake up correctly and some drivers may not start correctly. The worst situation happened when the temperature control died after sleeping and the system overheated. I knew what happened because the whole thing shut down abruptly. So I'm really interested in seeing some improvements.