{{tag>category:"OpenInsight 32-Bit" author:"dsig@sigafoos.org" author:"Steve Smith"}} [[https://www.revelation.com/the-works|Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community]] ==== OSDelete and Recycle Bin (OpenInsight 32-Bit) ==== === At 13 JUL 2004 12:23:12AM dsig@sigafoos.org 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 dsig@sigafoos.org.com onmouseover=window.status=the new revelation technology .. a refreshing change;return(true)" [url=http://www.sigafoos.org/samweb]DSig's Radio Free Oregon[/url] 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) [b] SHELL32 LONG STDCALL SHFileOperation(LPCHAR) [/b] Then run (at the Editor exec prompt) RUN DECLARE_FCNS "DLL_SHELL32" Then try the following rough code - [b] subroutine delete_to_recycle(filename) * eg. fully qualified drive/path/file - c:\dsig.txt * Copyright (c) 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 [/b] ---- === At 13 JUL 2004 12:32PM dsig@sigafoos.org 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 dsig@sigafoos.org.com onmouseover=window.status=the new revelation technology .. a refreshing change;return(true)" [url=http://www.sigafoos.org/samweb]DSig's Radio Free Oregon[/url] 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. [[https://www.revelation.com/revweb/oecgi4p.php/O4W_HANDOFF?DESTN=O4W_RUN_FORM&INQID=WORKS_READ&SUMMARY=1&KEY=BFF47C0C15B1D6D885256ED0001818F0|View this thread on the Works forum...]]