Click here to Skip to main content
15,888,579 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
Let's say that one day you're no programmer friend told you:

"Make for me application, and give it name "old.exe". "old.exe" have to posess three functionality.

-> To open notepad

-> To show message box

-> To create exe file called "new.exe", which have functionality of 1. case, or 2. case, or have both.".

So you take "C++ builder 2010", open "VCL Forms application", and put "two CheckBoxes", and "one button". You named "caption" of button "Create new.exe", and 1. "checkbox" named "Open notepad", and 2. "checkbox" named "Show message".

But what code did you use?

Remeber that you dear friend is not programmer and he don't know how to make exe ("new.exe") file which "open notepad" or "show message" or even both, but he will just "check" wished "checkbox" from your application "old.exe", and he will get "new.exe" which will have those functionality.

So what code did you put inside those "old.exe" application?
Posted
Updated 17-Dec-11 12:41pm
v3
Comments
Sergey Alexandrovich Kryukov 17-Dec-11 17:57pm    
This is not a question. Also, this post makes no sense as you create executable file anyway each time you build the project. What's "new", what's "old"? Generate the different executable instead of data just for preserving the state? Do be serious.
--SA
Sergey Alexandrovich Kryukov 17-Dec-11 18:52pm    
Why doing so? Why not creating one program to meet all the requirements at once?
--SA
gelineal 17-Dec-11 19:00pm    
It can take all meet but program "new.exe" have to execute just one or both functionality. Sometimes if all checkboxes (read instuction) are checked, that can lead to conflict. Example on is open notepad, other close notepad, and when you look what you done it obviously nothing.

The vaguely and helplessly expressed "reasons" like "cause I use many shortcuts" can no way server as a justification for any attempts to break some very fundamental computer paradigms. The solution with configuration and/or state file is perfectly feasible and regular way to solve any problems like that. Before considering any "esoteric" approaches, try to get the essence of programming using dominating paradigms, and at least don't waste you time on endeavour aimed to abuse the working paradigms of the OS you're using.

As a short note about feasibility of file creation of approach of the approach of cloning data in the file, let me explain one simple thing. In Windows systems, you cannot remove or modify any executable files currently loaded in memory. Surprise? Even though one can relatively easily work around this "limitation" (which is in fact not limitation but an important safety feature), I don't even want to discuss it. I prefer to explain how wrong and fruitless this approach is.

Have you ever head of the concepts of "universal Turing machine"? "Von Neumann architecture"? "Harvard architecture"? You are using a computer based on Intel or AMD CPU with instruction-set architecture designed with Harward architecture in mind. Nearly all modern operating systems follow this architecture which first of all means the architecture with stored program, and separate memory for storing a program and data; program memory is not modified during execution. These basic principles are translated onto all the basic conceptions related to programming, such as compiling/linking/loading of programs, executable files and everything on top of it.

Please see http://en.wikipedia.org/wiki/Stored-program_computer[^].

As soon as you work with languages and programming systems based on compilation (interpretive languages is a different story), and the compilation into the native CPU instruction-set codes, all the mainstream programming is based on the same principles. Development of CPU architectures led to possibilities for absolutely strict hardware protection of loaded program code and executable files from modification. You should embrace all the basic principles instead of fighting against them. At least, don't try to find against the fundamentals for such miserable goals like preserved "check boxes".

Speaking of the "many check boxes": at least get familiar with the concept of finite state machine and think about its representation in data and operation.

Disclaimer. The above answer is written in response to v.2 of the question. I think it's good to know anyway.



—SA
 
Share this answer
 
v4
Comments
gelineal 17-Dec-11 18:44pm    
I understand what are you talking about, I didn't express as well, but i have update question, maybe this time will be more better, ... thnx for answare :)
gelineal 17-Dec-11 18:51pm    
"I think it's good to know anyway." - Of course, thnx for labor.
Sergey Alexandrovich Kryukov 18-Dec-11 12:11pm    
You are very welcome.
Good luck,
--SA
Answering the v.3 of the question:

It also makes no sense, whatsoever. To start with, there is absolutely no sense in starting one application from another one unless the child process is specifically design for some sly kind of collaboration, which is also unlikely. Especially such a rudiment like the notepad. Who needs to start it, ever? Most primitive text editor component added to your Windows application will do much better, but in this case you will have a full control over it. As to notepad, you user can start it even better than you can — did you think about it?

There is nothing you cannot achieve just by designing and programming of a regular single application meeting any requirements with any thinkable level of flexibility. If you think about it, your friend does not care about the process of creation of new executable file. He only needs some functionality to appear. You can achieve this goal in million ways, all avoiding fruitless idea of substituting of the compiler/linker.

A final user does not need it. But you should understand what better what the application, executable file and process are, and what the compiler and linker do. Education is needed.

If you have no clue how to achieve required flexibility without generating an executable file, you are not really going in for programming but rather fantasizing about matters you don't really understand. Again, learn some basics of traditional way first. Anyway, if you try to write some application in a right way and face some problems, we will gladly help you.

—SA
 
Share this answer
 
Comments
gelineal 17-Dec-11 19:22pm    
thnx for answare, for me the real power of those example is that every time when you do some repeating task it can help you a lot. I guess that solve of that kind of problem is in this a few steps: 1. find name of program (GetModuleFilename), 2. take input from user 3. create copy of program by inserting those input, ... but have to test it ... one more time thnx
Sergey Alexandrovich Kryukov 17-Dec-11 19:34pm    
All programming is about abstraction and avoiding or automating of repeating steps. I think you still need to get a feel of it. Anyway, it is not clear what's the problem. It looks like you have quite trivial problems and just thinking along some wrong lines to solve them, some abusive way, etc.

You also should be able to isolate requirements from your thought about meeting them, without preoccupations with your ideas. If you can do it but have problems, there is something to talk about. Are you getting the picture?

As soon as you say "I need this but in that way", the whole approach is wrong.
--SA
Manfred Rudolf Bihy 18-Dec-11 9:55am    
I accidentally reported your post as SPAM rather than the one below. Don't think I'm an idiot, but posting from my mobile device does have some drawbacks such as a lack of screen real estate. Anyhow I hope this will not have any adverse effects. If there are any blame it on me! :-)
Have five!
Sergey Alexandrovich Kryukov 18-Dec-11 12:09pm    
I hope not; anyway than you very much for informing me. (It looks like you tried to report on beachbeach who post such a funny spam; this account is disabled by now.)
I would worry more on adverse effect of the mobile device on your health. I personally don't even play with the idea of using them. Don't you think their small surface makes running rich applications unnatural and unhealthy?

Cheers,
--SA
Sergey Alexandrovich Kryukov 18-Dec-11 12:10pm    
By the way, it will be a good idea to introduce undo operation on all votes and reports.
--SA
So what code did you put inside those "old.exe" application?
Lots, but it will not get inserted here. What you are asking for is a code generator that will take a few simple check decisions and generate a program for you. It's too much work for a Sunday afternoon.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900