News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

INVOKE DeleteFolder

Started by hfheatherfox07, July 14, 2011, 11:24:56 PM

Previous topic - Next topic

hfheatherfox07

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!


Tedd

No snowflake in an avalanche feels responsible.

hfheatherfox07


Vortex

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

hfheatherfox07

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

hfheatherfox07

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 ...

-Alex-

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.

hfheatherfox07