ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 IEFolderTree fails with Devices
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

jrpcguru

USA
233 Posts

Posted - Sep 04 2022 :  19:00:04  Show Profile  Reply
I have now installed your 11.3.0 and begun trying to add device support to my version of your ExplorerDemo.

Several problems crop up:

IEFolderTree1.EnableKeyboardShortcuts := true;
F5 does not update the folder tree. I can add Ctrl+F5 or just F5 to OnKeyDown and then Ctrl+F5 works. Nothing seems to make F5 work for the folder tree, though it does work for the IEFolderMView.

I have auto update turned on. If I plug in a thumb drive, it is not displayed until I press Ctrl+F5. But if I dismount it, it removes the Volume ID but retains the drive letter, until I press Ctrl+F5.

IEFolderTree1.ViewTypes := IEFolderTree1.ViewTypes + [ ievtDevices];
If a phone is attached to the computer when the program starts, the program warbles and crashes with no error message.
If I attach the phone later, I can select the device but when I tried to navigate its folder, the warble and crash follow.

Both of your device demo programs work properly with my phone, but neither has the IEFolderTree. I added it to one of the demos and the problem happens in the demo now. I've attached a zip file of the source code.

To make my program work for testing, I do not include ievtDevices in IEFolderTree1.ViewTypes. This means the device is not shown in the folder tree, but I can select it from the IEFolderMView. However, each time I connect to my phone with my program and try to navigate its folders, I receive an error message. I've included a screenshot of that. This does not happen with the demo programs, so I've tried to figure out the differences. I've commented out all OnFolderChange code, since the error message pops up as I tried to change folders. This does not prevent the problem.

For the time being, I'm forced to disable device support, again. I'm hoping you have a fix for the crash and suggestions what is causing that error message.



attach/jrpcguru/202294184538_File Manager Demo with Devices.zip
33.58 KB



J.R.

xequte

7215 Posts

Posted - Sep 04 2022 :  21:39:12  Show Profile  Reply
Hi JR

I cannot reproduce the F5 issue. It works fine in my testing.

I'll need to investigate the other issues.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

jrpcguru

USA
233 Posts

Posted - Sep 05 2022 :  18:42:26  Show Profile  Reply
I have discovered the cause of the error message. I forgot I had double click code which would be activated when double clicking to change folders. Previously I had searched for any settings that were different from the demos that might cause the problem and checked my change folder code.


procedure TMainForm.IEFolderMViewDblClick(Sender: TObject);
var
  sFileType : string;
begin
    begin
      sFileType := GetWindowsFileTypeName(IEFolderMView.SelectedFilename);
      sFileType := UpperCase(sFileType);
      if sFileType <> '' then
        begin
          if AnsiPos(sFileType,'FILE FOLDER;SYSTEM FOLDER;LOCAL DISK') = 0 then
            WindowsLaunchFile( Handle, IEFolderMView.SelectedFilename );
        end;
    end;

end;

GetWindowsFileTypeName returns '' for files on the device. Without that test, it was attempting to WindowsLaunchFile and that generated the error.

NOTE: I wonder if the failure of GetWindowsFileTypeName to return a file type on a device is the cause of the 'Type' column being blank on the device, when I have Layout set to show Details, including the File Type. Could the file type at least return the file extension in that situation?

J.R.
Go to Top of Page

xequte

7215 Posts

Posted - Sep 07 2022 :  00:24:40  Show Profile  Reply
Hi JR

I'll make it fallback to "EXT File" in the next update.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

jrpcguru

USA
233 Posts

Posted - Sep 13 2022 :  13:00:54  Show Profile  Reply
It turns out the problem with F5 not refreshing the folder tree was my error. I just removed the F5 hotkey from an action list that I had forgotten about. I'm sorry to waste your time. Some of my bugs are very good at hiding! I do kind of wonder why F5 worked fine with IEFolderMView but not with IEFolderTree while the action list contained F5. The action list is not active since that feature is awaiting further development or rejection.


I have continued to work on trying to implement device support while the folder tree doesn't fully support devices. I wanted to display information about a file on the phone and found an oddity:

  if (FileIsWPDItem(edtFolder.Text) = true) or  (edtFolder.Text = 'IEF_CONNECTED_DEVICES')  or (AnsiLeftStr(edtFolder.Text,4) = 'WPD:') then
    begin
      if IEFolderMView.PortableDevices.Objects[idx].ObjectType <> iewFolder then
        begin
          sHint := 'File: ' + IEFolderMView.PortableDevices.Objects[idx].Filename;
          sHint := sHint + slinebreak + 'Type: ' +  UpperCase(ExtractFileExt(IEFolderMView.PortableDevices.Objects[idx].Filename)) + ' File';
          sHint := sHint +  slinebreak + 'Path: ' + IEFolderMView.PortableDevices.Objects[idx].Path;
          sHint := sHint +  slinebreak + 'Full Path: ' + edtFolder.Text ;
        end;



The line in bold face delivers odd results: It shows a random 2 or 3 character prefix + \ + the file name. For example:
o18\file name.pdf or oB\file name.pdf. The prefix seems to be different for every folder.
That isn't a big problem since I can just display edtFolder.text as the correct folder information, but I wonder if this odd result is what you intended?

J.R.
Go to Top of Page

xequte

7215 Posts

Posted - Sep 13 2022 :  16:28:52  Show Profile  Reply
Hi JR

That is not our code, it is the way paths on Android devices are managed.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

jrpcguru

USA
233 Posts

Posted - Sep 15 2022 :  15:01:03  Show Profile  Reply
I don't know much about the internal plumbing of Android. I'm glad I can substitute the full path that is familiar to humans. Thanks for the update.

I have continued to work on implementing devices and stumbled on another oddity.

Because IEFolderTree doesn't currently work well with devices, I use this code to turn on devices and use IEFolderMView to work with devices.

  IEFolderMView.LockUpdate;
    IEFolderMView.ShowDevices := True;
    IEFolderMView.EnableSpecialFolders := false;
    IEFolderMView.DefaultFolder := iedfDevices;
    IEFolderMView.Folder := IEF_Connected_Devices;

  IEFolderMView.UnlockUpdate;


I just found that if my thumb drive is mounted, it is treated as a device if I execute this code. Research in the Help file did not find a way to stop this.

So far, viewing a thumb drive as a device is not very useful. It doesn't show the file extension in the Detail view. Without the file extension, my code for previewing files didn't work either, since it obtained the file name via sFileName := IEFolderMView.SelectedFilename;.

I use IEFolderMViewGetHint to get the file name and display it in a hint when the mouse hovers over a file:
IEFolderMView.PortableDevices.Objects[idx].Filename This shows the full name, including extension.

For previewing the file, I borrowed your demo code for previewing in PDFium to get the correct file index, since the extension is not displayed:
ID := IEFolderMView.ImageID[ IEFolderMView.SelectedImage ];
Then used this to get the file name: sFileName := IEFolderMView.PortableDevices.Objects[id].Filename;

This allowed me to successfully preview the files, even though they did not display an extension. Until I found another oddity:

If the base file names are different, such as
123.pdf
1234.pdf
It successfully gets the correct filename via the hint and via the .Selected Image and previews the correct file.

If the base file names are the same, things get really weird:
123.pdf
123.ini
123.exe are reported by the hint.

When I try to preview the files, the other method sees the file names as:
123.ini
123.exe
123.pdf
So if the hint tells me that I'm trying to view a PDF file, there is no preview because the preview code thinks it is a .ini file. If the hint tells me I'm trying to preview the .exe file, it successfully previews the .pdf file.

If there is a way to turn off treating thumb drives as devices, that might be simplest solution.



J.R.
Go to Top of Page

xequte

7215 Posts

Posted - Sep 15 2022 :  18:07:11  Show Profile  Reply
Hi JR

If you connect a thumb drive, it should appear as a drive not a device, i.e. Windows considers it the same as another hard drive. Is that what you are referring to.

Can you give some specific code to see the other issue you are referring to. I cannot see anything in the code that should cause such an issue.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

jrpcguru

USA
233 Posts

Posted - Sep 15 2022 :  20:11:28  Show Profile  Reply
If I connect a phone and mount a thumb drive, then use


  IEFolderMView.LockUpdate;
    IEFolderMView.ShowDevices := True;
    IEFolderMView.EnableSpecialFolders := false;
    IEFolderMView.DefaultFolder := iedfDevices;
    IEFolderMView.Folder := IEF_Connected_Devices;

  IEFolderMView.UnlockUpdate;


edtFolder.text = WPD:KINGSTON58G\G:\Judd\Slide Shows\

The thumb drive is mounted and displayed as a device.

If I then use:

begin
  IEFolderTree1.SelectSpecialFolder( iepdDrives      );      
end;

edtFolder.text = G:\Judd\Slide Shows

Now the thumb drive is mounted as a regular drive and works as expected. If I turn on the devices via the first code listed here, the thumb drive is shown as a device, again.

It is getting late here so I won't be able to try modifying the demo to do this. I will try to do that tomorrow but it may take a couple of days. This is your Explorer demo that I'm trying to modify to support devices, but without TIEFolderTree because of the bugs I've reported. I'm trying to get IEFolderMView fully supporting devices, ready for TEIFolderTree and there are problems.

J.R.
Go to Top of Page

jrpcguru

USA
233 Posts

Posted - Sep 16 2022 :  15:25:23  Show Profile  Reply

attach/jrpcguru/2022916151558_File Manager Demo with bugs_2022-09-16B.Zip

I modified the demo file that I sent you a week or two ago. It demonstrates all the bugs that I have described, except I didn't review the weird display about files with the same base file name. That won't be a problem if the file names include the extension when the thumb drive is mounted as a device.

J.R.
Go to Top of Page

xequte

7215 Posts

Posted - Sep 22 2022 :  21:15:15  Show Profile  Reply
Hi JR

I'm not seeing any issues in the demo. It correctly displays with my test devices and functions as I would expect.

What steps should I take to reproduce the "You'll need a new app to open this wpd link" issue?

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

jrpcguru

USA
233 Posts

Posted - Sep 25 2022 :  13:43:42  Show Profile  Reply
That error message proved to be my error. I reported that on Sept 5.

The F5 not refreshing was also my error which I reported on Sept 13.

The remaining issues are demonstrated in the modified demo that I sent you on Sept 16.

IEFolderTree1.ViewTypes := IEFolderTree1.ViewTypes + [ ievtDevices];
If a phone is attached to the computer when the program starts, the program warbles and crashes with no error message.
If I attach the phone later, I can select the device but when I tried to navigate its folder, the warble and crash follow.

My thumb drive is mounted as a device or as a drive, depending on whether devices have been turned on. I described some errors with display of file names when the thumb drive was mounted as a device. I don't know if it makes any difference, but my thumb drive is a 128 gig drive and my phone is Android 9.

I would hope that the demo that I sent to you would demonstrate these issues which I described in more detail, earlier in this chain.



J.R.
Go to Top of Page

xequte

7215 Posts

Posted - Sep 26 2022 :  23:31:38  Show Profile  Reply
Hi JR

I'm afraid I do not see the crashing in this demo. Presumably there is a peculiarity with that particular device.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: