\ File: ShellExecute.f
\ Author: Dirk Busch
\ Created: January 25th, 2004 - 17:22 - dbu
\ Updated: January 25th, 2004 - 17:22 - dbu
\
\ ShellExecute() support for Win32Forth
cr .( Loading ShellExecute support)
anew ShellExecute.f
INTERNAL
[UNDEFINED] ("ShellExecute) [IF]
: ("ShellExecute) { operation addr cnt hWnd -- errorcode } \ open file using default application
SW_SHOWNORMAL \ nShowCmd
Null \ default directory
Null \ parameters
addr cnt asciiz rel>abs \ file name to execute
operation rel>abs \ operation to perform
hWnd \ parent
Call ShellExecute ;
[THEN]
: ShellExecuteErr ( errorcode -- )
dup 32 <= \ error?
if ." Failed to execute file! (Error: "
base @ >r
dup . GetLastWinErrMsg count type
r> base !
." )"
abort
else drop
then ;
EXTERNAL
: "ShellEdit { addr cnt hWnd \ temp$ -- } \ edit file using default application
z" edit" rel>abs addr cnt hWnd ("ShellExecute) ShellExecuteErr ;
: "ShellExplore { addr cnt hWnd \ temp$ -- } \ Explores the folder
z" explore" rel>abs addr cnt "path-only" hWnd ("ShellExecute) ShellExecuteErr ;
: "ShellFind { addr cnt hWnd \ temp$ -- } \ Initiates a search starting from the specified directory
z" find" rel>abs addr cnt "path-only" hWnd ("ShellExecute) ShellExecuteErr ;
: "ShellOpen { addr cnt hWnd \ temp$ -- } \ open file using default application
z" open" rel>abs addr cnt hWnd ("ShellExecute) ShellExecuteErr ;
: "ShellPrint { addr cnt hWnd \ temp$ -- } \ print file using default application
z" print" rel>abs addr cnt hWnd ("ShellExecute) ShellExecuteErr ;
: "ShellProperties { addr cnt hWnd \ temp$ -- } \ print file using default application
z" properties" rel>abs addr cnt hWnd ("ShellExecute) ShellExecuteErr ;
: ShellEdit ( -<File>- )
/parse-s$ count conhndl "ShellEdit ;
: ShellExplore ( -<Folder>- )
/parse-s$ count conhndl "ShellExplore ;
: ShellFind ( -<Folder>- )
/parse-s$ count conhndl "ShellFind ;
: ShellOpen ( -<File>- )
/parse-s$ count conhndl "ShellOpen ;
: ShellPrint ( -<File>- )
/parse-s$ count conhndl "ShellPrint ;
: ShellProperties ( -<File/Folder>- )
/parse-s$ count conhndl "ShellProperties ;
MODULE