Go Back   FileForums > Game Backup > PC Games > PC Games - CD/DVD Conversions > Conversion Tutorials
Register FAQ Community Calendar Today's Posts Search

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #11  
Old 02-10-2023, 23: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 audiofeel View Post
@BLACKFIRE69
Is there any way to get a list of disks in a listbox? I don't quite understand how to do this. The example with the combobox does not fit.
Code:
procedure GetDisks;
var
  w: dword;
  Root: string;
  i, DiskType: integer;
begin
  w:= GetLogicalDrives;
  Root:= '#:\';
  for i:= 0 to 24 do
  begin
    Root[1]:= Chr(Ord('A') + i);
    if (W and (1 shl i)) > 0 then
      if (GetDriveType(PAnsiChar(Root)) = DRIVE_FIXED) then
    Edit1Combo.AddItem(Root);
  end;
  Edit1Combo.SetItemIndex(0);
end;


it's not a big deal.

Code:
var
  ...
  mListBox  : FListBox;
  mListBoxItem: array of FListBoxItem;
  ...

procedure FMXInnoInit;
begin
  ...
  mListBox  := InitListBoxHandle;
  ...
end;

procedure InitializeWizard();
begin
  ...
  FMXDesigning;
  FMXForm.Show;

  mListBox.SetItemIndex(2);   // i-1
  ...
end;

procedure ListBoxOnChange(Sender: TObject);
begin
  if mListBox.GetItemIndex > -1 then
    WinTB1.Text('Selected Drive: [' + mListBox.GetItemText(mListBox.GetItemIndex) + ']');
end;
Code:
procedure FMXDesigning;
var
  i, CDrvIdx: Integer;
  ADrvLst: TArrWStr;
begin
  ...

  if not wGetLogicalDriveList(ADrvLst, CDrvIdx) then
  begin
    Log('"wGetLogicalDriveList" failed!');
    MsgBox('"wGetLogicalDriveList" failed!', mbError, MB_OK);
    // try another way.
  end;

  { ListBox }
  mListBox.FCreate(FMXForm.Handle);
  mListBox.SetBounds(NSX(32), NSY(53), NSX(297), NSY(249));
  mListBox.OnChange(@ListBoxOnChange);

  { Items }
  SetArrayLength(mListBoxItem, GetArrayLength(ADrvLst));
  
  mListBox.BeginUpdate; 

  for i := 0 to GetArrayLength(ADrvLst) - 1 do
  begin
    mListBoxItem[i] := InitListBoxItemHandle;
    mListBoxItem[i].FCreate(mListBox.Handle);
    mListBoxItem[i].Text(ADrvLst[i]);
    mListBox.AddItem(mListBoxItem[i].Handle);
  end;

  mListBox.EndUpdate;
  ...
end;

.

Last edited by BLACKFIRE69; 14-07-2024 at 02:09.
Reply With Quote
The Following 2 Users Say Thank You to BLACKFIRE69 For This Useful Post:
audiofeel (03-10-2023), hitman797 (03-10-2023)
 


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 19:50.


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