OSDelete and Recycle Bin (OpenInsight 32-Bit)
At 13 JUL 2004 12:23:12AM [email protected] wrote:
I see that OSDELETE does not release to the recycle bin. Is there a way to do this? I haven't tested REMOVEDIR but my guess is it is the same.
So how to OSDELETE and in case the user fubar'd how to make sure it goes to the recycle bin.
thanks
[email protected] onmouseover=window.status=the new revelation technology .. a refreshing change;return(true)"
David Tod Sigafoos ~ SigSolutions
At 13 JUL 2004 09:37AM Steve Smith wrote:
DSig,
Here's a rough piece of code to get you started…
The function SHFileOperation in shell32.dll is one way to access this Windows "delete to recycle bin" functionality in 32 bit OpenInsight.
The DLL call accepts a structure (basically a big binary variable) which includes a pointer to the Basic+ filename variable.
So… you'll need to use Getpointer() to obtain a pointer to the filename variable (See Chapter 2 of the OI Programmers Reference Manual Pg 35) if this excites you unduly .
First, we prototype the Windows API function call within shell32.dll (SYSPROCS*DLL_SHELL32)
SHELL32 LONG STDCALL SHFileOperation(LPCHAR)
Then run (at the Editor exec prompt)
RUN DECLARE_FCNS "DLL_SHELL32"
Then try the following rough code -
subroutine delete_to_recycle(filename) * eg. fully qualified drive/path/file - c:\dsig.txt * Copyright © 2004 Steve Smith, State of the Art Systems Pty. Ltd. declare function SHFileOperation Filename =filename:char(0):char(0) hwnd=\00000000\ wFunc=\03000000\ pTo=\00000000\ * fFlags is set to \4000\ for del confirmation or \5000\ for silent fFlags=\5000\ fAnyOperationsAborted=\00000000\ hNameMappings=\00000000\ lpszProgressTitle=\00000000\ flush garbagecollect FilenameAddress=GetPointer(Filename) * now dissect the pointer into binary in our structure pFrom1=char(mod(FilenameAddress,256)) pFrom2=char(mod(int(FilenameAddress/256),256)) pFrom3=char(mod(int(FilenameAddress/(256^2)),256)) pFrom4=char(mod(int(FilenameAddress/(256^3)),256)) pFrom=pFrom1:pFrom2:pFrom3:pFrom4 * you can write the following three lines as one long line structure=hwnd:wFunc:pFrom:pTo structure := fFlags:fAnyOperationsAborted structure := hNameMappings:lpszProgressTitle result=SHFileOperation(structure) return result
At 13 JUL 2004 12:32PM [email protected] wrote:
you just stay up nights just thinkin this stuff up
thanks. I will add it to the routine. Might be good enhancement for OI
[email protected] onmouseover=window.status=the new revelation technology .. a refreshing change;return(true)"
David Tod Sigafoos ~ SigSolutions
At 13 JUL 2004 04:43PM Steve Smith wrote:
I was more worried that if I trashed the API call binary values that I'd delete my entire hard disk to the recycle bin.