?
Solved

How to create  a program that destroy ifself on button close, and reactive itself on running a script.

Posted on 2012-03-11
11
Medium Priority
?
183 Views
Last Modified: 2012-03-26
I have a form in VB.Net, it inserts the data into database.
I want when i click on close button, it should get deleted or hidden in such a manner that no one should be able to locate it, i.e exe file.
And when i run a script, it should get reactivated.
Is it possible.
Do we have any chaining process as we used to have in Qbasic. If any1 know this.
0
Comment
Question by:searchsanjaysharma
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 17

Expert Comment

by:nepaluz
ID: 37707174
To close the applcation, in the Button's click event, call Me.Close()
To start the application from a script, call the application.start equivalent from the script. If you pass any arguments to the application, make sure you handle them in the main thread's Sub New()
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 37707204
You could create an Application Setting flag, a boolean, (which is stored internally and gets persisted across runs) that determines if the app should simply exit without doing anything.  You could set that flag when the app is closed.  From the script, you can call the app and pass it a parameter that tells it run normally.  Then, if the app is run directly without the parameter, it will simply exit.
0
 

Author Comment

by:searchsanjaysharma
ID: 37707252
This i also know. i want a script. secondly, i have to destroy the application not just close the window.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 37707403
How can the program be recreated if it was destroyed?!...

Also, you can't destroy or rename the app while it is running (or in the act of closing).  This would have to be done from a secondary application (or script).

Can you give more details about what you're actually doing?
0
 

Author Comment

by:searchsanjaysharma
ID: 37707418
Just take the following example.
I have a calculator. Ok. When i close it should get hidden or destroyed. or rename. When i run another script it should be again activated
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 37707432
What's keeping the user from running the script that re-activates it?...

By "script", are you talking VBScript (.vbs)?  You can launch the app with a script that waits for the app to exit and then renames it.
0
 

Author Comment

by:searchsanjaysharma
ID: 37707440
ok, instead of script consider program
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 37707444
Ok...but if a secondary app unlocks the primary app by simply being run, what is keeping the user from directly running the secondary app?
0
 
LVL 40
ID: 37707781
If the users are connected full time, you could deploy the application through ClickOnce.

ClickOnce has an option to make the application available only online.

When the use starts the application, it gets installed temporarily on his computer if he is connected, otherwise he is told that he needs to be connected in order to use it.

When the application stops, it uninstalls automatically, but the Start menu icon that was created on the first installation stays there so that the user can restart the application.

This slows down the application when it starts because it needs to be reinstalled, but is if is a simple one, the process is not too long, not much longer than starting an Office application for instance.

Lookup ClickOnce in the documentation, on simply explore the Publish tab in the Project's properties window. For simple installation, just looking at the options in the Publish tab is self explanatory.
0
 
LVL 28

Accepted Solution

by:
Ark earned 1500 total points
ID: 37723725
SelfDelete.zip
Note: since attachment doesn't allow *.asm and *.bin files, actual extensions for files in [asm] folder are SelefDel.asm (asm code) and SelfDel.bin (binary compiled asm file). Actually, demo doesn't use these files - mProcessInjection.bas module use opCode string constant - Hex dump of SelfDel.bin.
Methods I used in a demo:
1. Using batch file - app creates batch file which try delete main app in a loop - when main process completed, batch file successfully delete main app and then delete itself.
2. Using hidden console (cmd.exe) window - it run dos "del" command and wait it competition, then close itself.
3. DeleteOnClose - main app creates a shadow copy of its executable with InheritHandle = True, run it with command line, specifying main exe name and processID in command line. Shadow suspend main app process (WaitForSingleObject(hProcess, INFINITE)) and kill main app executable.
4. Using MFT records - not completed yet - just setting flag "InUse" in NTFS MasterFileTableRecord to false will hide file from OS.
5. Asm code injection - inject compiled asm code into running process namespace and call this code via CreateRemoteThread

As for recreation of deleted file - it's easy - just embed executable as a resource to a "restoration" program, read it when need and copy content into newly created file
0
 

Author Closing Comment

by:searchsanjaysharma
ID: 37769538
ok
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question