Recent

Author Topic: [SOLVED] My Own 'IDE' --> Create My Own EXE's  (Read 16163 times)

pixelink

  • Hero Member
  • *****
  • Posts: 1260
[SOLVED] My Own 'IDE' --> Create My Own EXE's
« on: August 20, 2016, 02:41:35 am »
Okay... in VB.NET you could not create your own EXE files directly using your own App (IDE).

However, with a little trickery you can make a "template" EXE that loads in data.....
Or, you could create Resource file and embed it into an existing EXE copy....
Or, I could even write Binary into the header of an EXE to simulate my own "created EXE"....
Or, I could use what is called CodeDom...

I did it here using VB.NET (codedom actually just recompiles vb code)...
http://www.vbforums.com/showthread.php?833333-RESOLVED-CodeDom-Save-Load-RTF-Into-RichBox


However... I was wondering....

Can I create my own EXE files from a program that I actually develop... like my own IDE.
I would want to be able to embed Resource files, RTF... things like that.

Possible??

« Last Edit: August 20, 2016, 08:33:11 pm by technipixel »
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 2.2.0 •  VSSTUDIO(.Net) 2022 • Win10 • 16G RAM • Nvida GForce RTX 2060

pixelink

  • Hero Member
  • *****
  • Posts: 1260
Re: My Own 'IDE' --> Create My Own EXE's
« Reply #1 on: August 20, 2016, 02:44:45 am »
EXAMPLE...

Lets say I want to create an app that can create an EXE that embeds an RTF file.
Kind of like creating a standalone eBook.

It would have my own buttons, be read only etc etc.

Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 2.2.0 •  VSSTUDIO(.Net) 2022 • Win10 • 16G RAM • Nvida GForce RTX 2060

ezlage

  • Guest
Re: My Own 'IDE' --> Create My Own EXE's
« Reply #2 on: August 20, 2016, 02:48:39 am »
Yes. You can create your own IDE using Lazarus source code or create a completely new IDE.

pixelink

  • Hero Member
  • *****
  • Posts: 1260
Re: My Own 'IDE' --> Create My Own EXE's
« Reply #3 on: August 20, 2016, 02:54:19 am »
Yes. You can create your own IDE using Lazarus source code or create a completely new IDE.

Well, I know I can create my own IDE... that isn't the question...
And I don't want to recreate the LAZ IDE... some other custom IDE.

Can I create my OWN exe's with my own IDE?

If so, does anyone have any links to resources on how this is done?

« Last Edit: August 20, 2016, 02:58:49 am by technipixel »
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 2.2.0 •  VSSTUDIO(.Net) 2022 • Win10 • 16G RAM • Nvida GForce RTX 2060

ezlage

  • Guest
Re: My Own 'IDE' --> Create My Own EXE's
« Reply #4 on: August 20, 2016, 03:02:57 am »
Sure. You IDE can do everything you code it to do.

If you don't want to use freepascal, for example, you will need to find another compiler or build your own compiler (and your own language).

There's no limit, you can do what your knowledge and creativity permits.

Sorry by my poor english.

ezlage

  • Guest
Re: My Own 'IDE' --> Create My Own EXE's
« Reply #5 on: August 20, 2016, 03:03:50 am »
But, you can need to use low-level programming too...

ezlage

  • Guest
Re: My Own 'IDE' --> Create My Own EXE's
« Reply #6 on: August 20, 2016, 03:05:27 am »
The best example: Freepascal is developed with Freepascal, Lazarus is developed with Lazarus and Freepascal.

pixelink

  • Hero Member
  • *****
  • Posts: 1260
Re: My Own 'IDE' --> Create My Own EXE's
« Reply #7 on: August 20, 2016, 03:16:10 am »
The best example: Freepascal is developed with Freepascal, Lazarus is developed with Lazarus and Freepascal.

I understand all that....

I want to create my own IDE using LAZ itself.... not start from scratch.
Then within my own IDE, (even using LAZ's compiler if I can, I want to compile the EXE)

I don't want to create a whole another language etc...
I am not talking about creating something similar to LAZ.

Lets say I create my own IDE that can take images, documents and embed them in a resource file.
Then I can compile (or embed) that resource file inside of an EXE file and have my own icon etc.

Let's say I want to make an IDE that creates standalone EXE E-BOOKS.

I want to USE LAZ to create the IDE
And have users use my IDE to create EXE's
« Last Edit: August 20, 2016, 03:17:45 am by technipixel »
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 2.2.0 •  VSSTUDIO(.Net) 2022 • Win10 • 16G RAM • Nvida GForce RTX 2060

derek.john.evans

  • Guest
Re: My Own 'IDE' --> Create My Own EXE's
« Reply #8 on: August 20, 2016, 03:40:16 am »
Im doing that stuff atm.

1) Choose a compiler for your target platform GCC/FreePascal/LCC/TCC/VBCC/CC65/CMOC whatever
2) Output the source code, and compile it to an exe

Its what Laz does with FreePascal.

It depends on what your target platform is. All you are wanting it to automate the process of creating the source code.

If you are wanting to keep some source code private, then just create obj files for that. That is also dependent on the compiler you choose.

EDIT: As an example. Im finishing up on WinCMOC atm. If I wanted a tool to convert a text file to a ebook for the CoCo, I would grab the text file, output it to a C file with the text reader code, compile it to a bin file. And bingo, ebooks for the CoCo.
« Last Edit: August 20, 2016, 03:44:11 am by Geepster »

pixelink

  • Hero Member
  • *****
  • Posts: 1260
Re: My Own 'IDE' --> Create My Own EXE's
« Reply #9 on: August 20, 2016, 03:48:16 am »
Im doing that stuff atm.

1) Choose a compiler for your target platform GCC/FreePascal/LCC/TCC/VBCC/CC65/CMOC whatever
2) Output the source code, and compile it to an exe

Its what Laz does with FreePascal.

It depends on what your target platform is. All you are wanting it to automate the process of creating the source code.

If you are wanting to keep some source code private, then just create obj files for that. That is also dependent on the compiler you choose.

EDIT: As an example. Im finishing up on WinCMOC atm. If I wanted a tool to convert a text file to a ebook for the CoCo, I would grab the text file, output it to a C file with the text reader code, compile it to a bin file. And bingo, ebooks for the CoCo.

Sounds Interesting...

That is similar to how CodeDom works with .NET

My wheels are turning...  :)
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 2.2.0 •  VSSTUDIO(.Net) 2022 • Win10 • 16G RAM • Nvida GForce RTX 2060

pixelink

  • Hero Member
  • *****
  • Posts: 1260
Re: My Own 'IDE' --> Create My Own EXE's
« Reply #10 on: August 20, 2016, 05:32:30 am »
Here is another angle I could do this....

1) Create an IDE that makes something (ebook etc etc)
2) Create a "Template" exe that would be the used to read data from the IDE by the user.
3) The user would gather all their resources and "create an exe" using the "dummy exe template" (copy and rename exe)
3) And, in the IDE... save all the images, text files into a Resource File.
4) Then write and embed the data/resources using binary and embed/write into the existing dummy exe.

Now you have a (semi) "created" EXE.

So, my Q is.... can I write and embed an external Resource file (using binary) into an already existing EXE??

Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 2.2.0 •  VSSTUDIO(.Net) 2022 • Win10 • 16G RAM • Nvida GForce RTX 2060

derek.john.evans

  • Guest
Re: My Own 'IDE' --> Create My Own EXE's
« Reply #11 on: August 20, 2016, 07:07:42 am »
Try searching for Delphi/FreePascal code which use these commands:

BeginUpdateResource
UpdateResource
EndUpdateResource


http://forum.codecall.net/topic/73254-modify-resource-content-of-an-executable/

Thats assuming FreePascal is using Windows resources.

I wouldn't use Lazarus for the reader though. Your exe would have a min size of 1.7MB

Ebooks should be small imho

Fungus

  • Sr. Member
  • ****
  • Posts: 354
Re: My Own 'IDE' --> Create My Own EXE's
« Reply #12 on: August 20, 2016, 11:30:32 am »
I'm not sure if I understand your project right, but to me it seems like you are turning something simple into something difficult. Think of a self-extracting archive - it is an executable that has an archive "slip streamed" to the end of it. When you execute it, it will read a 32/64 bit numeric value from the end of itself and this value can then be used to determine the offset in the file where the executable ends and the archive begins. From there it can extract its contents.

If you would create an executable that is used to display a book you would simply create an app that has the functionality of displaying the book. Then you would take the book itself and combine both into one file - just like a self-extracting archive. When your book-reader is then executed it will load the book from the executable file - simple and easy. Absolutely no need for performing a per-book compilation of some source code. Consider this to combine an executable and a document:

Code: Pascal  [Select][+][-]
  1. Procedure CombineExeAndBook(Const ExeFile, BookFile, OutputFile: String);
  2. Var Src: TFileStream;
  3.       Pos: Int64;
  4. Begin
  5.   With TFileStream.Create(OutputFile, fmCreate) Do Try
  6.  
  7.     Src:= TFileStream.Create(ExeFile, fmOpenRead);
  8.     Try
  9.       CopyFrom(Src, Src.Size);
  10.     Finally
  11.       Src.Free;
  12.     End;
  13.  
  14.     Pos:= Size; //Book offset
  15.  
  16.     Src:= TFileStream.Create(BookFile, fmOpenRead);
  17.     Try
  18.       CopyFrom(Src, Src.Size);
  19.     Finally
  20.       Src.Free;
  21.     End;
  22.  
  23.     //Store book offset to end of file
  24.     Write(Pos, SizeOf(Pos));
  25.  
  26.   Finally
  27.     Free;
  28.   End;
  29. End;
  30.  

Now when you execute that file the app can load the book from itself using:

Code: Pascal  [Select][+][-]
  1. Function LoadBook: TMemoryStream;
  2. Var Src: TFileStream;
  3.       Pos: Int64;
  4. Begin
  5.   Src:= TFileStream.Create(Application.ExeName, fmOpenRead);
  6.   Try
  7.     //Get book offset
  8.     Src.Seek(SizeOf(Pos), soFromEnd);
  9.     Src.Read(Pos, SizeOf(Pos));
  10.     Src.Seek(Pos, soFromBeginning);
  11.     //Get book data
  12.     Result:= TMemoryStream.Create;
  13.     Result.CopyFrom(Src, Src.Size - Pos - SizeOf(Pos));
  14.   Finally
  15.     Src.Free;
  16.   End;
  17. End;
  18.  

And from there the book can be displayed by the app :-)
« Last Edit: August 20, 2016, 11:35:53 am by Fungus »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12311
  • FPC developer.
Re: My Own 'IDE' --> Create My Own EXE's
« Reply #13 on: August 20, 2016, 11:33:14 am »
The best example: Freepascal is developed with Freepascal, Lazarus is developed with Lazarus and Freepascal.

I understand all that....

I want to create my own IDE using LAZ itself.... not start from scratch.
Then within my own IDE, (even using LAZ's compiler if I can, I want to compile the EXE)

I once started porting the Dev-Pascal IDE source to Lazarus, and got quite far in one week. It stranded on the limited MDI support back then.

pixelink

  • Hero Member
  • *****
  • Posts: 1260
Re: My Own 'IDE' --> Create My Own EXE's
« Reply #14 on: August 20, 2016, 12:39:42 pm »
Try searching for Delphi/FreePascal code which use these commands:

BeginUpdateResource
UpdateResource
EndUpdateResource


http://forum.codecall.net/topic/73254-modify-resource-content-of-an-executable/

Thats assuming FreePascal is using Windows resources.

I wouldn't use Lazarus for the reader though. Your exe would have a min size of 1.7MB

Ebooks should be small imho

This is something I could work with.

In that tutorial he uses arrays to write to the end of EXE.... Got It!!!

What about a resource file.... How to embed a resource file INTO and existing EXE? (not using LAZ's Resource IDE) - But programmatically from with-in my own IDE

- I create IDE using LAZ
- Distribute my IDE
- User creates Resource file with my IDE
- Then they embed resource into existing EXE to create their own app.

External Resource file --> embedded --> INTO existing EXE
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 2.2.0 •  VSSTUDIO(.Net) 2022 • Win10 • 16G RAM • Nvida GForce RTX 2060

 

TinyPortal © 2005-2018