Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

simple flash viewer with shell32.dll

 [1/2] from: jason::cunliffe::verizon::net at: 16-Oct-2002 12:50

This is a very crude demo of a Flash [.SWF] file viewer. It uses the cool shell32.dll work posted by James and Gregg recently ./Jason 8<-------------------- REBOL [ Title: "ShellExecute with simple View demo to watch Flash files" Date: 2002-10-16 File: %ShellExecute.r Description: "Simple Rebol Flash viewer uses Windows shell32.dll " Authors: [ "James Marsden" [james--mustard--co--nz] "Gregg Irwin" [greggirwin--mindspring--com] "Jason Cunliffe" [jasonic--nomadics--org] ] To-Do: {1. Add auto-detection to locate of Flash player with user prompts 2. Add button and list handling for multiple file selection 3. Test with new standard file requestor 4. Include %make-swf.r wrapper for 100% rebol-flash slide show interface 5. Sequencer interface with optional XML export. } ] ; -------------------------- ; SHELL-EXECUTE ; -------------------------- ; thanks to James and Gregg ;C:\WINDOWS\SYSTEM\shell32.dll shell-lib: load/library %shell32.dll shell-execute: make routine! [ hwndParent [integer!] lpOperation [string!] lpFile [string!] lpParameters [string!] lpDirectory [string!] nShowCmd [integer!] return: [integer!] ] shell-lib "ShellExecuteA" ; options for the nShowCmd parameter (most people use 4 or 5) SW_HIDE: 0 ; Hides the window and activates another window. SW_SHOWNORMAL: 1 ; Activates and displays a window. If the window is ;minimized or maximized, Windows restores it to its original size and ;position. An application should specify this flag when displaying the window ;for the first time. SW_SHOWMINIMIZED: 2 ; Activates the window and displays it as a minimized window. SW_MAXIMIZE: 3 ; Maximizes the specified window. SW_SHOWMAXIMIZED: 3 ; Activates the window and displays it as a maximized window. SW_SHOWNOACTIVATE: 4 ; Displays a window in its most recent size and ;position. The active window remains active. SW_SHOW: 5 ; Activates the window and displays it in its current size and position. SW_MINIMIZE: 6 ; Minimizes the specified window and activates the next ;top-level window in the z-order. SW_SHOWMINNOACTIVE: 7 ; Displays the window as a minimized window. ;The active window remains active. SW_SHOWNA: 8 ; Displays the window in its current state. The active window remains active. SW_RESTORE: 9 ; Activates and displays the window. If the window is ;minimized or maximized, Windows restores it to its original size and ;position. An application should specify this flag when restoring a minimized ;window. SW_SHOWDEFAULT: 10 ; Sets the show state based on the SW_ flag specified in ;the STARTUPINFO structure passed to the CreateProcess function by the ;program that started the application. An application should call ShowWindow ;with this flag to set the initial show state of its main window. ; USAGE EXAMPLES ; Shell-Execute 0 "OPEN" "BananaEdit.exe" "a_new_doc.ban" "c:\" 5 ; Shell-Execute 0 "OPEN" "c:\my documents\status reports.doc" "" c:\mydocuments 3 ; Shell-Execute 0 "PRINT" "c:\my documents\status reports.doc" "" c:\mydocuments 0 ; Shell-Execute 0 "OPEN" "c:\" "" "c:\" 4 ;--------------------------- ; FLASH PLAYER ;--------------------------- ; you may need to adjust this variable for your system SAFlashPlayer: "C:\Program Files\Macromedia\Flash MX\Players\SAFlashPlayer.exe " ;raw command line test ;Shell-Execute 0 "OPEN" SAFlashPlayer "d:\TEMP\ddd_0000.swf" "e:\TEMP" 5 ;minimal view interface show-swf: [Shell-Execute 0 "OPEN" SAFlashPlayer swf-file "d:\TEMP" 5] selected-file: swf-file-string: swf-path-string: copy "" select-swf-file: func [][ selected-file: swf-file-string: swf-path-string: copy "" selected-file: first request-file/keep/filter/title ".swf" "Select a Flash file" "SELECT" swf-file-string: to-string to-local-file selected-file swf-path-string: to-string to-local-file to-string first split-path selected-file ] show-swf: does [shell-execute 0 "OPEN" SAFlashPlayer swf-file-string swf-path-string 5] swflo: layout [ button "select swf file" [select-swf-file] button "display" [show-swf] button "quit" red [unview/all] ] usage: "view swflo" print usage view swflo

 [2/2] from: james:mustard at: 17-Oct-2002 13:25

Hi Jason, One feature that you may not be aware of is that ShellExecute will automatically find file associations for swf files like so: Shell-Execute 0 "OPEN" "myswf-file.swf" "" "e:\TEMP" 5 This removes the need to specify the location of the shockwave player and the default player for shockwave files will be used. OTOH if you wish to specifically make them use a certain player then you do need to specify the program and place the swf file in the parameter section. James.