手机上的存储卡,如果没装手机附带的所谓的驱动程序,存储卡就一个磁盘,用WM_DEVICECHANGE就能获取这个磁盘并访问。
如果装了那个驱动程序,整个手机都映射成了一个比如叫“移动设备”的东西,如何用程序访问?
刚刚接触这方面,一点也不懂,有没有人做过或者提供点资料?

解决方案 »

  1.   

    可能對你有用
    使用FindFirstFlashCard和FindNextFlashCard函数。如果找到了存储卡,FindFirstFlashCard返回一个指向第一块存储卡的句柄和指针。如果句柄是正确的,你可以把它传递给FindNextFlashCard,该函数将返回下一块存储卡的指针和一个BOOL值来表明搜索是否成功...
      

  2.   


    这个好像不是PC上的WindowsAPI
      

  3.   

    给一段代码,主要是如果是找到移动盘。
    procedure TMoveDataFileFrm.Button9Click(Sender: TObject);
    var
      RootPath: array[0..25] of Char;
      VolName: array[0..255] of Char;
      SerialNumber: DWORD;
      MaxCLength: DWORD;
      FileSysFlag: DWORD;
      FileSysName: array[0..255] of Char;
      S,ss:string;
      i:integer;
      MyList:TStringList;
      DPath,Spath:string;
    begin
      S:=myGetLogicalDrives;
      ListBox2.Items.Clear;
      RootPath:='';
      for i:=1 to length(S) do
      begin
        RootPath[0] := S[i];
        RootPath[1] := ':';
        RootPath[2] := '\';
        GetVolumeInformation(
          RootPath,
          VolName,
          255,
          @SerialNumber,
          MaxCLength,
          FileSysFlag,
          FileSysName,
          255);
          with ListBox2.Items do
          begin
            SS:=Format('%s',[VolName]);
    //        if SS='' then ss:='';
            if getdrivetype(RootPath)=2 then
              Add(RootPath+' ['+SS+']');
         end;
      end;
      if ListBox2.Count>0 then
      begin
        ListBox2.ItemIndex:=ListBox2.Count-1;
        ListBox2.SetFocus;
        SPath:=ListBox2.Items.Strings[ListBox2.itemIndex][1]+':\Record\';
        if  DirectoryExists(SPath) then
        begin
          MyList:=TStringList.Create;
          MyList.clear;
          SearchFileNoPath(SPath,MyList);
    //      ListBox3.Items:=MyList;
          MyList.Free;
        end;
      end;
    end;
      

  4.   

    再给一段代码,识别显示U盘。
    procedure TMoveDataFileFrm.Button9Click(Sender: TObject);
    var
      RootPath: array[0..25] of Char;
      VolName: array[0..255] of Char;
      SerialNumber: DWORD;
      MaxCLength: DWORD;
      FileSysFlag: DWORD;
      FileSysName: array[0..255] of Char;
      S,ss:string;
      i:integer;
      MyList:TStringList;
      DPath,Spath:string;
    begin
      S:=myGetLogicalDrives;
      ListBox2.Items.Clear;
      RootPath:='';
      for i:=1 to length(S) do
      begin
        RootPath[0] := S[i];
        RootPath[1] := ':';
        RootPath[2] := '\';
        GetVolumeInformation(
          RootPath,
          VolName,
          255,
          @SerialNumber,
          MaxCLength,
          FileSysFlag,
          FileSysName,
          255);
          with ListBox2.Items do
          begin
            SS:=Format('%s',[VolName]);
    //        if SS='' then ss:='';
            if getdrivetype(RootPath)=2 then
              Add(RootPath+' ['+SS+']');
         end;
      end;
      if ListBox2.Count>0 then
      begin
        ListBox2.ItemIndex:=ListBox2.Count-1;
        ListBox2.SetFocus;
        SPath:=ListBox2.Items.Strings[ListBox2.itemIndex][1]+':\Record\';
        if  DirectoryExists(SPath) then
        begin
          MyList:=TStringList.Create;
          MyList.clear;
          SearchFileNoPath(SPath,MyList);
    //      ListBox3.Items:=MyList;
          MyList.Free;
        end;
      end;
    end;
     
      

  5.   

    上述代码,在ListBox2中显示出U盘。