Hi, I was wondering if anybody ever used the "INVOKE DeleteFolder" and has an example ... NOT the same as "INVOKE DeleteFile"
I can not understand how to write a proc for it....
Also here is an example that I made of "INVOKE DeleteFile" ...what I was trying to do is delete all the files "Recent" folder....
The files in there are .lnk so if you have short cut file called "test.asm" it is really "test.asm.lnk" ....My example works fine if I actually do one folder at a time and name it each time....
Why does \*.lnk Work?
Is there a way to do it this way with out an open file name were I have to chose the files ?
Thank You!
SHFileOperation should do what you want.
http://msdn.microsoft.com/en-us/library/bb762164%28v=VS.85%29.aspx
Quote from: Tedd on July 15, 2011, 12:29:58 PM
SHFileOperation should do what you want.
http://msdn.microsoft.com/en-us/library/bb762164%28v=VS.85%29.aspx
Thank you ,
I found an example right here on the forum , now that I know to look for SHFileOperation
http://www.masm32.com/board/index.php?PHPSESSID=45161102b7e9b36e503418a4d40f36ce&action=printpage;topic=10083.0
I will try it Tonight
Hi hfheatherfox07,
The SHAddToRecentDocs function can be used to clear the recent documents list.
.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\shell32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\shell32.lib
.code
start:
invoke SHAddToRecentDocs,SHARD_PATH,NULL
invoke ExitProcess,0
END start
Thank you Vortex, I was not aware of "SHARD_PATH" ... I was going about it the long way by first getting the user name ....
:U
Quote from: Vortex on July 16, 2011, 07:33:36 AM
Hi hfheatherfox07,
The SHAddToRecentDocs function can be used to clear the recent documents list.
.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\shell32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\shell32.lib
.code
start:
invoke SHAddToRecentDocs,SHARD_PATH,NULL
invoke ExitProcess,0
END start
Sorry vortex that did not work for me; it deletes the whole Recent folder ...but when you look for hidden folders it seemed only to make the entire folder's attribute "hidden"
and the whole folder and it's contents are still there just with hidden attributes...weird ....
Here is something that I came up with thanks to another code that I have seen on this forum... I used parts to make my original example work ...
If u want just to delete a folder, here is my code:
include masm32rt.inc
.data
fileop SHFILEOPSTRUCT<>
Dir db "C:\Users\Alex\AppData\Local\Temp",0
.code
start:
mov fileop.wFunc,FO_DELETE
mov fileop.pFrom,offset Dir
mov fileop.fFlags,FOF_NOCONFIRMATION
invoke SHFileOperation,addr fileop
invoke ExitProcess,0
end start
It will delete the whole folder, and ofcourse all subfolders and files, will not ask u, if u r really sure, and it will display an error, if something gone wrong.
Thank You