Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Deleting

Posted on 2000-05-13
2
Medium Priority
?
132 Views
Last Modified: 2010-04-04
How to make with Delphi that you could not delete a program(made in delphi)-when someone tries to delete program message"Can not delete!" must shows.
0
Comment
Question by:darko_poljak
[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
2 Comments
 
LVL 15

Expert Comment

by:simonet
ID: 2807262
>"Can not delete!"

That message is given when trying to delete a file that has been locked by Windows. Files are locked when they are open (being used).

Unless your file is something like a service, that stays open all the time, you can write a seconf program that constantly watches your file for changes. The backbone of this monitor file would be an API call called FindFirstChangeNotification.

Another option, simplier, is to mark your file as read-only.

Alex
0
 

Accepted Solution

by:
LuK earned 100 total points
ID: 2808122
Write your programm in the Autostart-registrykey with a paramter.
Then make sure, that the first entry of the uses-list of your projectfile is a unit, that you can edit. write this into the interfacepart of your unit:
Function RegisterServiceProcess(id,state:integer):bool;stdcall;external 'shell32.dll';

write this directly before the 'end.' in your unit:

initialization
if paramstr(1)='your paramter' then begin
registerserviceprocess(getcurrentprocessid,1);
sleep(infinite);
end.

That will make your programm memory-resistent, so the user can't delete it.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

670 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