FileForums

FileForums (https://fileforums.com/index.php)
-   Conversion Tutorials (https://fileforums.com/forumdisplay.php?f=55)
-   -   CmdOut - Capture Cmd Output in Realtime [InnoSetup/Delphi] (https://fileforums.com/showthread.php?t=105907)

BLACKFIRE69 30-04-2023 17:36

CmdOut - Capture Cmd Output in Realtime [InnoSetup/Delphi]
 
4 Attachment(s)
CmdOut - Capture Cmd Output in Realtime

Code:

* Author:  Ele
* Modified by BLACKFIRE69.

Code:

1. Fixed several minor bugs.
2. Optimized performance.
3. Reduced the file size. [ 52.5 KB >> 31.5 KB ]

* Recommended Compiler:  InnoSetup v5 - Enhanced.


.

BLACKFIRE69 08-04-2026 13:22

Update - CmdOut v2.0
 
6 Attachment(s)
CmdOut - High-Performance Real-time CMD Capture API for Inno Setup
=============================================

Code:

> Overview:
CmdOut is a powerful, low-latency library designed to capture and display
standard output (STDOUT) from command-line processes directly within Inno
Setup. Re-written in Nim for maximum efficiency, it allows developers to
integrate external tools (like 7-Zip, SREP, XTool, or custom batch files)
into their installers with real-time feedback, progress tracking, and full
process control.

> Specifications:
- Version        : v2.0.0.0
- Author        : BLACKFIRE (Original by Ele)
- Language        : Nim (v2.2.8)
- Compatibility        : Inno Setup v5.x, v6.x or later
- License      : Proprietary (See LICENSE file for details)

Code:

> Key Features:
- Real-time Capture: Blazing fast STDOUT capturing with persistent
  buffer allocation to eliminate GC overhead and flickering.
- Smart UI Integration: Direct updates to TMemo handles with optimized
  scrolling and redraw logic.
- Process Management: Full control to Suspend, Resume, or Stop the main
  process and all its child processes.
- Auto-Progress Detection: Built-in logic to extract progress percentages
  (e.g., "50%", "30.37%") or fractions (e.g., "5/10") from the console output.
- Advanced Targeting: Control specific sub-processes by name using
  ISCmdCustomPause/Resume/Stop (e.g., target 'srep.exe' specifically).
- Windows Message Support: Control the console via SendMessage for
  decoupled architecture.
- Performance Metrics: Retrieve Exit Codes, PIDs, and Elapsed Time (ms)
  for precise post-execution logic.
- Visual Customization: Experimental support for changing console fonts
  and adding custom header text to outputs.

> What's New in v2.0 (Nim Rewrite):
- Ported from Delphi to Nim: Significant reduction in DLL size and
  improved performance.
- O(n) String Operations: Replaced repeated concatenations with
  pre-calculated memory moves for large output handling.
- Modern API: Standardized buffer patterns for string returns and
  Unicode (UTF-16) support throughout.
- Fixed UI Glitches: Resolved TMemo flickering and improved performance.

Code:

> Builds: optimized for speed, not size.

1. cmdout_clang.dll
    Size: 81 KB, Clang backend: v22.1.2

2. cmdout_gcc.dll
    Size: 99 KB, GCC backend  : v15.2.0

3. cmdout_msvc.dll
    Size: 143 KB, MSVC backend : v18.4.3

> Distribution Files:
- CmdOut.dll        — Core API Library.
- CmdOut.iss        — Header for Inno Setup integration.
- Examples        — 6 comprehensive .iss templates covering Common usage,
                  Percentage tracking, Multi-handles, and Win-Messages.

- Quick Start Example -

[CODE]
Code:

#include "CmdOut.iss"

procedure InitializeWizard();
begin
  // Initialize with WizardForm handle and a Memo handle
  ISCmdInit(WizardForm.Handle, MyMemo.Handle, False, True);
end;

procedure DeinitializeSetup();
begin
  // if ISCmdRun is still running.
  bCmdOutAbort := True; // or ISCmdStop;
  ISCmdCleanup;
end;

procedure StartInstallation();
var
  Exe, Params, Dir: String;
begin
  Exe := ExpandConstant('{src}\tools\arc.exe');
  Params := 'a -m=lzma data.bin "_Pack\*"';
  Dir := ExpandConstant('{src}');

  // Run with real-time callback
  if ISCmdRun(Exe, Params, Dir, CreateCallback(@UpdateMemo)) then
    MsgBox('Process finished with code: ' + IntToStr(ISCmdGetExitCode), mbInformation, MB_OK);
end;

function UpdateMemo(const ACaption, AText: WideString; const hMemo: HWND): Boolean;
begin
  // Update UI and return True if you want to abort
  ISCmdUpdateMemo(hMemo, AText);
  Result := UserAborted;
end;


.


All times are GMT -7. The time now is 05:12.

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