473,396 Members | 2,037 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Deleting this

Hi,

I'm writing an unistall program (unistall.exe).
When I install my application, I also install unistall.exe.
When I execute unistall.exe, I want to be able to delete the current
folder and contained files.
My problem is that unistall.exe is in use, and therefore, I can not
delete the folder.

Any ideas how can I achieve this ?

Jul 12 '06 #1
4 1057
If you do achieve this, be sure and publish your results. AFAIK, no software
has ever been able to do this.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

What You Seek Is What You Get.
<bu*********@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
Hi,

I'm writing an unistall program (unistall.exe).
When I install my application, I also install unistall.exe.
When I execute unistall.exe, I want to be able to delete the current
folder and contained files.
My problem is that unistall.exe is in use, and therefore, I can not
delete the folder.

Any ideas how can I achieve this ?

Jul 13 '06 #2
Unfortunately I cannot find the article now but I know in the past to achieve
this you needed to update a batch file in windows that would force the deletion
on reboot.

Hope this helps find more information.

Regards
Chris

Hello Kevin,
If you do achieve this, be sure and publish your results. AFAIK, no
software has ever been able to do this.

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist
What You Seek Is What You Get.

<bu*********@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
>Hi,

I'm writing an unistall program (unistall.exe).
When I install my application, I also install unistall.exe.
When I execute unistall.exe, I want to be able to delete the current
folder and contained files.
My problem is that unistall.exe is in use, and therefore, I can not
delete the folder.
Any ideas how can I achieve this ?

Jul 13 '06 #3
Hey, now that you mention it, yes, you could do that, but it would require a
reboot. It can be done by adding a registry entry to the RunOnce registry:

http://support.microsoft.com/default...b;EN-US;137367

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

What You Seek Is What You Get.
"Chris Marshall" <cd*@newsgroups.nospamwrote in message
news:b8************************@msnews.microsoft.c om...
Unfortunately I cannot find the article now but I know in the past to
achieve this you needed to update a batch file in windows that would force
the deletion on reboot.

Hope this helps find more information.

Regards
Chris

Hello Kevin,
>If you do achieve this, be sure and publish your results. AFAIK, no
software has ever been able to do this.

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist
What You Seek Is What You Get.

<bu*********@gmail.comwrote in message
news:11**********************@h48g2000cwc.googleg roups.com...
>>Hi,

I'm writing an unistall program (unistall.exe).
When I install my application, I also install unistall.exe.
When I execute unistall.exe, I want to be able to delete the current
folder and contained files.
My problem is that unistall.exe is in use, and therefore, I can not
delete the folder.
Any ideas how can I achieve this ?


Jul 13 '06 #4
I found an interesting way to do this.

Using the MoveFileEx kernel API call.

Since moving a program in execution is allowed, first, you do a move
for the executable in a temp directory.

Then, you recall a move on this file and new location, with the
destination null and flags sets to DELAY_UNTIL_REBOOT.

The first call has moved your file, so you can copy a new one in the
orginal directory.
The second call will delete (destination == null) the file, and the
flags says "next time you reboot the pc"

I guess MSI is using this technique.

Here's the C# import

[Flags]
enum MoveFileFlags
{
MOVEFILE_REPLACE_EXISTING = 0x00000001,
MOVEFILE_COPY_ALLOWED = 0x00000002,
MOVEFILE_DELAY_UNTIL_REBOOT = 0x00000004,
MOVEFILE_WRITE_THROUGH = 0x00000008,
MOVEFILE_CREATE_HARDLINK = 0x00000010,
MOVEFILE_FAIL_IF_NOT_TRACKABLE = 0x00000020
}

[DllImport("kernel32.dll", SetLastError=true, CharSet=CharSet.Auto)]
static extern bool MoveFileEx(string lpExistingFileName, string
lpNewFileName, MoveFileFlags dwFlags);

Jul 27 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: flupke | last post by:
Hi, i'm having trouble with deleting elements from a list in a for loop ============== test program ============== el = print "**** Start ****" print "List = %s " % el index = 0 for line...
15
by: Rick | last post by:
Hi, Does deleting an object more than one times incur undefined behavior? I think it doesn't but just making sure... thanks Rick
5
by: Mojtaba Faridzad | last post by:
Hi, with SetDataBinding( ) a DataGrid shows a DataView. user can select some rows in the grid by holding cotrol key. when user clicks on Delete button, I should delete all selected rows. I am...
4
by: al havrilla | last post by:
hi all what does the phrase: "scalar deleting destructor" mean? i'm getting this in a debug error message using c++ 7.1 thanks Al
6
by: Martin Bischoff | last post by:
Hi, I'm creating temporary directories in my web app (e.g. ~/data/temp/temp123) to allow users to upload files. When I later delete these directories (from the code behind), the application...
51
by: Joe Van Dyk | last post by:
When you delete a pointer, you should set it to NULL, right? Joe
1
by: Lee | last post by:
Hi, when deleting a directory using;- string dir = "whatever"; Directory.Delete(dir); it fails if files/directories exist within the directory being deleted. is there an easy way of...
3
by: Kimera.Kimera | last post by:
I'm trying to write a program in VB.net 2003 that basically deletes all files, folders, sub-folders and sub-sub folders (etc). The program is simply for deleting the Windows/Temp folder contents,...
2
Parul Bagadia
by: Parul Bagadia | last post by:
I have written a code for deleting certain value from linklist; it's not working; where as i have written one for deleting a no., after given no. which works fine! I even debugged it; but invain;...
2
by: padmaneha | last post by:
Hi I have created two tables 'TrainsMaster' & 'TransArrvlDepinfo' Columns which I have created in 'TrainsMaster' are 'trainName,TrainNo, StartStaionId, & EndstationId' Columns which I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.