link1
link2 shortened
The program creates shortcuts when inserting a flash drive and deletes them when removing the flash drive.
How do I get #WM_QUIT on reboot?
Re: How do I get #WM_QUIT on reboot?
Shortcuts, which are doing what exactly?
{Home}.:|:.{Dialog Design0R}.:|:.{Codes}.:|:.{History Viewer Online}.:|:.{Send a Beer}
-
- Addict
- Posts: 1058
- Joined: Sun Jul 25, 2004 4:21 pm
- Location: USoA
Re: How do I get #WM_QUIT on reboot?
This is some primo information. THANKS Aristotle!!!!Axolotl wrote: Tue Oct 05, 2021 3:50 pm Example : delete file at next Windows startupMSDN: If dwFlags specifies MOVEFILE_DELAY_UNTIL_REBOOT and lpNewFileName is NULL, MoveFileEx registers the lpExistingFileName file to be deleted when the system restarts. If lpExistingFileName refers to a directory, the system removes the directory at restart only if the directory is empty.Code: Select all
MoveFileEx_("Some_file_i_dont_need_anymore", 0, #MOVEFILE_DELAY_UNTIL_REBOOT)

- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Randy
I *never* claimed to be a programmer.
-
- Addict
- Posts: 1058
- Joined: Sun Jul 25, 2004 4:21 pm
- Location: USoA
Re: How do I get #WM_QUIT on reboot?
Well. I thought it was a really great tip but cannot get it to work for me. I tried two ways:Randy Walker wrote: Fri Aug 29, 2025 9:35 pmThis is some primo information. THANKS Aristotle!!!!Axolotl wrote: Tue Oct 05, 2021 3:50 pm Example : delete file at next Windows startupMSDN: If dwFlags specifies MOVEFILE_DELAY_UNTIL_REBOOT and lpNewFileName is NULL, MoveFileEx registers the lpExistingFileName file to be deleted when the system restarts. If lpExistingFileName refers to a directory, the system removes the directory at restart only if the directory is empty.Code: Select all
MoveFileEx_("Some_file_i_dont_need_anymore", 0, #MOVEFILE_DELAY_UNTIL_REBOOT)
![]()
Code: Select all
MoveFileEx_("Some_file_i_dont_need_anymore", 0, #MOVEFILE_DELAY_UNTIL_REBOOT)
Code: Select all
D$ = "Some_file_i_dont_need_anymore"
MoveFileEx_(@D$, 0, #MOVEFILE_DELAY_UNTIL_REBOOT)
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Randy
I *never* claimed to be a programmer.
-
- Addict
- Posts: 1058
- Joined: Sun Jul 25, 2004 4:21 pm
- Location: USoA
Re: How do I get #WM_QUIT on reboot?
I had no luck getting this trick to work but I did a lot of research and hacking to find a way for an EXE to delete itself. The answer is here:Axolotl wrote: Tue Oct 05, 2021 3:50 pm Example : delete file at next Windows startupCode: Select all
MoveFileEx_("Some_file_i_dont_need_anymore", 0, #MOVEFILE_DELAY_UNTIL_REBOOT)
viewtopic.php?p=644643#p644643
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Randy
I *never* claimed to be a programmer.
Re: How do I get #WM_QUIT on reboot?
@Randy Waler:
To delete or rename a file, you must have either delete permission on the file or delete child permission in the parent directory.
More on this functions: MoveFileExW function (winbase.h)
The function stores the locations of the files to be renamed at restart in the following registry value:
BTW: The batch solution is a quite good one.
To delete or rename a file, you must have either delete permission on the file or delete child permission in the parent directory.
More on this functions: MoveFileExW function (winbase.h)
The function stores the locations of the files to be renamed at restart in the following registry value:
Code: Select all
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
-
- Addict
- Posts: 1058
- Joined: Sun Jul 25, 2004 4:21 pm
- Location: USoA
Re: How do I get #WM_QUIT on reboot?
I figured it was a permissions issue preventing your solution from working for me and decided best not to pursue it further since I would have no control over that on the end users machine. The bat solution fit the bill perfectly for me and has the added benefit of immediate cleanup, as opposed to waiting for next reboot, or forcing an unexpected reboot. In my case the Uninstall is not for user discretion. It is for banishment, removing all traces of the app and associated data on employees that have left the company. They can't restore and run from backup because the same cleanup will occur. This bat thing is the last part of cleanup that was missing from my banish procedure.Axolotl wrote: Sat Aug 30, 2025 10:50 am @Randy Waler:
To delete or rename a file, you must have either delete permission on the file or delete child permission in the parent directory.
BTW: The batch solution is a quite good one.
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Randy
I *never* claimed to be a programmer.