For example, you can use PSRemote with a camera such as the A620 or more modern cameras.
A motion detection script takes a photo ten seconds after motion detected and image uploaded to PC (and optionally not stored on camera).
Using the PSRemore dynamic link library (DLL) your custom programme can interact with PSRemote or simply retrieve the uploaded image from its folder.
David