Go Back   FileForums > Game Backup > PC Games > PC Games - CD/DVD Conversions > Conversion Tutorials

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 16-10-2023, 06:53
BLACKFIRE69's Avatar
BLACKFIRE69 BLACKFIRE69 is offline
Registered User
 
Join Date: Mar 2019
Location: In the Hell
Posts: 688
Thanks: 481
Thanked 2,547 Times in 561 Posts
BLACKFIRE69 is on a distinguished road
Quote:
Originally Posted by hitman797 View Post
...get the number of Files in the Recycle Bin and their total size?

@hitman797,

ok, i'll add a new function to retrieve RecycleBin info in a future 'FMXInno' update.
currently, there are no new features or bug fixes to push an update.
so, feel free to use your own library until the next update, especially if you need it right now.


Delphi DLL:

Code:
library AMyDll;
{$R *.res}

const
  C_M_BYTES = 1024 * 1024;

type
  DWORDLONG = UInt64;
  DWORD = FixedUInt;
  LPCWSTR = PWideChar;
  LPSHQUERYRBINFO = ^SHQUERYRBINFO;
  SHQUERYRBINFO = packed record
    cbSize      : DWORD;     // Size of struct SHQUERYRBINFO.
    i64Size     : DWORDLONG; // Files size in Bytes.
    i64NumItems : DWORDLONG; // Files Count.
  end;

function SHQueryRecycleBinW(pszRootPath: LPCWSTR; pSHQueryRBInfo: LPSHQUERYRBINFO): HResult; stdcall;
  external 'shell32.dll' name 'SHQueryRecycleBinW';

function AGetRecycleBinInfo(ARootPath: WideString; var TotalSizeMB: extended;
  var FileCount: Integer): Boolean; stdcall;
var
  RBInfo: SHQUERYRBINFO; // Structure to store RecycleBin info
  RBRoot: LPCWSTR;       // Root path for the RecycleBin query
begin
  try
    // RBRoot <> nil --> Retrieve RecycleBin info from ARootPath.
    // RBRoot =  nil --> Retrieve RecycleBin info from All Drives.
    if Length(ARootPath) = 0 then RBRoot := nil else RBRoot := LPCWSTR(ARootPath);

    RBInfo.cbSize := SizeOf(RBInfo);  // Set the size of the structure

    if SHQueryRecycleBinW(RBRoot, @RBInfo) = S_OK then
    begin
      TotalSizeMB := RBInfo.i64Size / C_M_BYTES;
      FileCount   := RBInfo.i64NumItems;
      Result      := True;
    end else
      Result      := False;
  except
    Result        := False;
  end;
end;

exports
  AGetRecycleBinInfo;

begin
end.


InnoSetup:

Code:
function AGetRecycleBinInfo(ARootPath: WideString; var TotalSizeMB: Extended; var FileCount: Integer): Boolean;
  external 'AGetRecycleBinInfo@files:AMyDll.dll stdcall';


procedure TestBtnClick(Sender: TObject);
var
  TotalSizeMB: Extended;
  FileCount: Integer;
begin
  if AGetRecycleBinInfo('', TotalSizeMB, FileCount) then
  begin
    Memo.Lines.Add(format('RecycleBin Files Size:      < %0.2n GB >', [TotalSizeMB / 1024]));
    Memo.Lines.Add(format('RecycleBin Files Count:   < %d >', [FileCount]));
  end else
    Memo.Lines.Add('AGetRecycleBinInfo Error!')
end;

.

Last edited by BLACKFIRE69; 14-07-2024 at 02:11.
Reply With Quote
The Following 5 Users Say Thank You to BLACKFIRE69 For This Useful Post:
audiofeel (16-10-2023), Behnam2018 (16-10-2023), hitman797 (16-10-2023), Lord.Freddy (16-10-2023), Wanterlude (18-10-2023)
Sponsored Links
  #2  
Old 16-10-2023, 07:14
hitman797's Avatar
hitman797 hitman797 is offline
Registered User
 
Join Date: Feb 2013
Location: Algeria
Posts: 168
Thanks: 486
Thanked 202 Times in 122 Posts
hitman797 is on a distinguished road
Quote:
Originally Posted by BLACKFIRE69 View Post

ok, i'll add a new function to retrieve RecycleBin info in a future 'FMXInno' update.
currently, there are no new features or bug fixes to push an update.
so, feel free to use your own library until the next update, especially if you need it right now.
.
Great work, thanks for the library.
I will use this library until the update is released to FMXInno.
Reply With Quote
The Following User Says Thank You to hitman797 For This Useful Post:
audiofeel (16-10-2023)
  #3  
Old 16-10-2023, 22:32
Tihiy_Don Tihiy_Don is offline
Registered User
 
Join Date: Mar 2023
Location: Los Angeles Lakers
Posts: 43
Thanks: 91
Thanked 26 Times in 18 Posts
Tihiy_Don is on a distinguished road
Smile

Quote:
Originally Posted by BLACKFIRE69 View Post
@hitman797,
ok, i'll add a new function to retrieve RecycleBin info in a future 'FMXInno' update.
currently, there are no new features or bug fixes to push an update.
so, feel free to use your own library until the next update, especially if you need it right now.

I have been using your library for a long time in my distributions, as well as repacks from FMXTeam.

P.S. I'm still waiting for the implementation of creating a form with a background in the form of a video.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows Fluent Effects Standalone API - InnoSetup / VCL / FXM BLACKFIRE69 Conversion Tutorials 0 15-11-2023 17:35
Windows Phone Installer similar to razor12911's original design? Kitsune1982 Conversion Tutorials 0 02-07-2020 13:04
INDEX - Conversion Tutorial Index Razor12911 Conversion Tutorials 5 11-06-2020 02:05
Frequently Asked Questions Joe Forster/STA PC Games - Frequently Asked Questions 0 29-11-2005 09:48



All times are GMT -7. The time now is 15:48.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
FileForums @ https://fileforums.com