?
Solved

please help - Move files to Digital Camera

Posted on 2006-05-06
10
Medium Priority
?
334 Views
Last Modified: 2012-05-05
Hey, I needed to know if there was a way to move files onto a digital camera using C++. Please, I need help. I'm offering all my points to anyone who can help me.

- Mike
0
Comment
Question by:pcxboy
  • 5
  • 4
10 Comments
 
LVL 8

Expert Comment

by:mrblue
ID: 16622826
What exactly do you want to do ?
0
 
LVL 5

Expert Comment

by:wings_gaurav
ID: 16622832
hi Mike,

will need to know the Platform (OS) you want to do this on?Also digital camera type/s will also an issue - some mount as drives and can work with simple filecopy operations ... some don't and will expose there own programming interface.

-wings
0
 

Author Comment

by:pcxboy
ID: 16622877
I am using Windows XP. I am using a Ricoh camera that has a SD card. All I want to do is move files from my computer onto the camera, but I am not sure how to do so.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 5

Expert Comment

by:wings_gaurav
ID: 16622894
okay, can you tell me the model?

when you connect the camera to your system does it showup as a drive? look in the windows explorer for any new drives by refreshing the view if already open.

-wings
0
 

Author Comment

by:pcxboy
ID: 16622977
unfortunately, I do not have access to the camera. I was looking online to see if a model matched the one I had, and I think its a Caplio G3
0
 
LVL 5

Expert Comment

by:wings_gaurav
ID: 16623998
okay, as far as I could figure out the camera mounts as a usb drive (Richo Caplio G3 & Caplio G2). can access as a drive using win32 api

call GetLogicalDriveStrings to enumerate all drives
call GetDriveType to figure out drive types of ecah drive - we are searching for DRIVE_REMOVABLE (this is not fool proof - can't think of anything else just now). to refine this you can scan each removable drive for a folder/file the camera makes.
The camera must have a folder it makes on the card you will have to know this by inspection - use this folder name to copy files by using CopyFile function for each file.

-wings


0
 

Author Comment

by:pcxboy
ID: 16624000
could you present some source code as an example?? I am only familiar with one of these functions
0
 
LVL 5

Accepted Solution

by:
wings_gaurav earned 880 total points
ID: 16624378
the following code works on my Nikon D 50

------------------------------------
#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, char * strCmdLine, int nCmdShow)
{
      // get all logical drives
      DWORD lDriveNameLen = GetLogicalDriveStrings(0, NULL);      
      char * pDriveName = new char[lDriveNameLen];      
      GetLogicalDriveStrings(lDriveNameLen, pDriveName);

      // loop through all drives
      char * pStart = pDriveName;
      for(DWORD i = 0; i < lDriveNameLen - 1;i++)
      {
            // found the drive name
            if(pDriveName[i] == '\0')
            {
                  // check if drive is removable
                  if(GetDriveType(pStart) == DRIVE_REMOVABLE)
                  {
                        char pCamFolder[MAX_PATH];
                        // change this according to the camera model - this is Nikon d50
                        wsprintf(pCamFolder,"%sDCIM\\100NCD50\\", pStart);

                        // if the camera folder is found - great let's copy else move to next drive
                        if(GetFileAttributes(pCamFolder) == FILE_ATTRIBUTE_DIRECTORY)
                        {
                              char pCopyPath[MAX_PATH];
                              char pSourcePath[MAX_PATH];

                              // repeat this for all the files

                              // file to copy
                              char pFileName[] = "test.jpg";
                              
                              // path to copy from
                              char pSourceDir[] = "c:\\";
                              
                              
                              wsprintf(pCopyPath,"%s%s", pCamFolder, pFileName);
                              wsprintf(pSourcePath,"%s%s", pSourceDir, pFileName);

                              CopyFile(pSourcePath, pCopyPath, FALSE);

                              ///-end repeat

                              // done copying break while
                              break;
                        }
                  }

                  pStart = pDriveName + i + 1;
            }
      }

      if(pDriveName != NULL)
      {
            delete [] pDriveName;
      }

      
      return 0;
}
---------------------------

-wings
0
 
LVL 5

Expert Comment

by:wings_gaurav
ID: 16624439
just to clarify the above code has hardcoded  path "DCIM\\100NCD50\\" (Nikon d50) .This will need to be changed to "DCIM\\<cam foldername>". Also the orignal assumption that camera mounts as a disk remains - some camers don't e.x. most cannons don't.

-wings
0
 

Author Comment

by:pcxboy
ID: 16624457
thank you VERY much kind sir. I will try this code ASAP!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question