Recent

Author Topic: embedding an external CLI program as a resource ?  (Read 365 times)

PaulRowntree

  • Full Member
  • ***
  • Posts: 132
    • Paul Rowntree
embedding an external CLI program as a resource ?
« on: April 11, 2020, 01:17:51 am »
I have a program that creates a TProcess to run an external CLI program that is open source and written in some C variant.  It all works well, but it means that the external program has to be in the right place for anyone to use it.  Not a big problem, but ...Is there any way to embed that CLI program inside my normal GUI program, and either execute it in memory or perhaps unpack it to a folder on the first execution of the GUI?
Thanks!
« Last Edit: April 11, 2020, 01:19:33 am by PaulRowntree »
Paul Rowntree
- coding for instrument control, data acquisition & analysis, CNC systems

jamie

  • Hero Member
  • *****
  • Posts: 3120
Re: embedding an external CLI program as a resource ?
« Reply #1 on: April 11, 2020, 01:24:14 am »
if you have a resource editor you can create a resource file with that in it as  raw data..

laz can link it as a resource and it will be come part of your EXE file.

when you start up your app you need to extract it using standard resource functions and write it to disk

 I do this for a couple of Jpg images..

 Actually if you wanted to get real hacky,, you could use  Timage, set it's size to fix the file and store as an image. later read it back and just write the contents to file ;)

 yes, I am a hack but I've done that before!
The only true wisdom is knowing you know nothing

zamronypj

  • Jr. Member
  • **
  • Posts: 90
    • Fano Framework, Free Pascal web application framework
Re: embedding an external CLI program as a resource ?
« Reply #2 on: April 11, 2020, 01:42:59 am »
As an alternative to jamie's approach, you can create an installer program and include external CLI as part of program installation.
Fano Framework, Free Pascal web application framework https://fanoframework.github.io
Personal Projects https://v3.juhara.com
Github https://github.com/zamronypj

jamie

  • Hero Member
  • *****
  • Posts: 3120
Re: embedding an external CLI program as a resource ?
« Reply #3 on: April 11, 2020, 01:44:43 am »
Yup, Inno Setup.. its free...
The only true wisdom is knowing you know nothing

PaulRowntree

  • Full Member
  • ***
  • Posts: 132
    • Paul Rowntree
Re: [SOLVED] embedding an external CLI program as a resource ?
« Reply #4 on: April 11, 2020, 06:04:36 am »
Thanks everyone ... installer it is then!
Paul Rowntree
- coding for instrument control, data acquisition & analysis, CNC systems

 

TinyPortal © 2005-2018