Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
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
?
191 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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

604 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