Click here to Skip to main content
15,915,600 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How proxy binds to original coclass object? Pin
Stephen Hewitt6-Aug-08 22:06
Stephen Hewitt6-Aug-08 22:06 
GeneralRe: How proxy binds to original coclass object? Pin
George_George6-Aug-08 23:34
George_George6-Aug-08 23:34 
GeneralRe: How proxy binds to original coclass object? Pin
Stephen Hewitt7-Aug-08 14:41
Stephen Hewitt7-Aug-08 14:41 
GeneralRe: How proxy binds to original coclass object? Pin
George_George9-Aug-08 0:07
George_George9-Aug-08 0:07 
QuestionUSB Device Data Read Pin
vcprog6-Aug-08 18:24
vcprog6-Aug-08 18:24 
AnswerRe: USB Device Data Read Pin
ptr_Electron6-Aug-08 18:59
ptr_Electron6-Aug-08 18:59 
GeneralRe: USB Device Data Read Pin
vcprog6-Aug-08 19:31
vcprog6-Aug-08 19:31 
GeneralRe: USB Device Data Read Pin
ptr_Electron6-Aug-08 20:07
ptr_Electron6-Aug-08 20:07 
the previous once code link to http://www.beyondlogic.org/usbnutshell/usb7.htm#PIC16F876Example[^]

or

You can first use the GetLogicalDrives API function to find which logical drives are present in a system, then use GetDriveType to determine whether a disk drive is a removable, and finally use FindFirstFile and FindNextFile to get file list in a specific remove disk. Here is sample code, hope it helps. Notice: in the sample code, It just lists all files in the root directory, if you’d like to list files in subdirectories, you can make small modifications on the code.


Code Snippet
#include<windows.h>

#include<iostream>

 

BOOL FileList()

{

          //Get Logical Drives

          DWORD dwDrives=GetLogicalDrives();

 

          if(0==dwDrives)

          {

                   return FALSE;

          }

 

          DWORD dwCount=0;

 

          char chDriveLabel='A';

 

          char szRootpath[5]={0,0,0,0,0};

 

          while(dwDrives !=0)

          {

                   if ((dwDrives & 1) != 0)

                   {

                             sprintf(szRootpath,"%c:\\",chDriveLabel);

 

                             //removable drive

                             if(DRIVE_REMOVABLE==GetDriveType(szRootpath))

                             {

                                      WIN32_FIND_DATA FindFileData;

                                      HANDLE hFind;

 

                                      //Removable dirve lable

                                    std::cout <<"Files in " << szRootpath << std::endl;

 

                                      //* represent search all files and directories

                                      szRootpath[3]='*';

 

                                      hFind=FindFirstFile(szRootpath,&FindFileData);

 

                                      if (INVALID_HANDLE_VALUE == hFind) 

                                      {

                                                return FALSE;

                                      } 

 

                                      // List all the files in the directory .

                                      do

                                      {

                                                //ignore the sub directories

                                                if (!(FindFileData.dwFileAttributes &  

                                                                        FILE_ATTRIBUTE_DIRECTORY))

                                                {

                                                    std::cout << FindFileData.cFileName << ":";

                                                }

 

                                      }while (FindNextFile(hFind, &FindFileData) != 0);

 

                                      FindClose(hFind);

                             }

 

                   }

                   dwDrives = dwDrives >> 1;//next drive

                   chDriveLabel++;

          }

}







For detail information of GetLogicalDrives, you can refer to

http://msdn2.microsoft.com/en-us/library/aa364972.aspx

For detail information of GetDriveType, you can refer to

http://msdn2.microsoft.com/en-us/library/aa364939.aspx

For detail information of FindFirstFile, you can refer to

http://msdn2.microsoft.com/en-us/library/aa364418.aspx

For detail information of FindNextFile, you can refer to

http://msdn2.microsoft.com/en-us/library/aa364428(VS.85).aspx



Hope this helps!
GeneralRe: USB Device Data Read Pin
vcprog6-Aug-08 20:16
vcprog6-Aug-08 20:16 
GeneralRe: USB Device Data Read Pin
vcprog6-Aug-08 21:00
vcprog6-Aug-08 21:00 
GeneralRe: USB Device Data Read Pin
vcprog6-Aug-08 21:12
vcprog6-Aug-08 21:12 
GeneralRe: USB Device Data Read Pin
ptr_Electron6-Aug-08 21:48
ptr_Electron6-Aug-08 21:48 
GeneralRe: USB Device Data Read Pin
vcprog6-Aug-08 23:26
vcprog6-Aug-08 23:26 
GeneralRe: USB Device Data Read Pin
David Crow25-Aug-08 4:17
David Crow25-Aug-08 4:17 
GeneralRe: USB Device Data Read Pin
vcprog6-Aug-08 22:19
vcprog6-Aug-08 22:19 
GeneralRe: USB Device Data Read Pin
ptr_Electron7-Aug-08 0:06
ptr_Electron7-Aug-08 0:06 
GeneralRe: USB Device Data Read Pin
vcprog7-Aug-08 0:35
vcprog7-Aug-08 0:35 
GeneralRe: USB Device Data Read Pin
vcprog7-Aug-08 1:36
vcprog7-Aug-08 1:36 
QuestionRe: USB Device Data Read Pin
David Crow7-Aug-08 3:30
David Crow7-Aug-08 3:30 
AnswerRe: USB Device Data Read Pin
vcprog7-Aug-08 18:39
vcprog7-Aug-08 18:39 
GeneralRe: USB Device Data Read Pin
David Crow8-Aug-08 3:14
David Crow8-Aug-08 3:14 
QuestionRe: USB Device Data Read Pin
David Crow7-Aug-08 3:25
David Crow7-Aug-08 3:25 
QuestionApplication crashes after the call onStart (msg handeler )is done. Pin
ptr_Electron6-Aug-08 18:01
ptr_Electron6-Aug-08 18:01 
AnswerRe: Application crashes after the call onStart (msg handeler )is done. Pin
Stephen Hewitt6-Aug-08 18:26
Stephen Hewitt6-Aug-08 18:26 
GeneralRe: Application crashes after the call onStart (msg handeler )is done. Pin
ptr_Electron6-Aug-08 18:37
ptr_Electron6-Aug-08 18:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.