Domino 9 und frühere Versionen > ND8: Entwicklung

Datei per Script öffnen

<< < (2/2)

eknori:

--- Code: ---Declare Function FindExecutable Lib "shell32.dll" Alias "FindExecutableA" (Byval lpFile As String, Byval lpDirectory As String, Byval sResult As String) As Long
--- Ende Code ---


--- Code: ---Function FindExecutableByExtension( FullPath As String ) As Variant
'// Finds the location of an application for a file
'// Called by : Sub DetachAndEdit
'// Calls : none
          Dim success&, pos&, sResult$, RetVal$, lpFile$, lpDirectory$, msg$
         
          sResult = Space$ ( MAX_PATH )
          lpFile$ = ExtractFileName ( FullPath )
          lpDirectory$ = Left$ ( FullPath , Len( FullPath ) - Len( lpFile$ ) )
          success = FindExecutable ( lpFile$ , lpDirectory$ , sResult )
         
          Select Case success
          Case ERROR_FILE_NO_ASSOCIATION: msg = "no association"
          Case ERROR_FILE_NOT_FOUND: msg = "file not found"
          Case ERROR_PATH_NOT_FOUND: msg = "path not found"
          Case ERROR_BAD_FORMAT: msg = "bad format"
          Case Is >= ERROR_FILE_SUCCESS:
               pos = Instr ( sResult , Chr$ ( 0 ) )
               If pos Then RetVal = Left$ ( sResult , pos - 1 )
          End Select
          FindExecutableByExtension = RetVal
     End Function
     
--- Ende Code ---

Ist aus meiner alten clsAttachment aus der Sandbox.

Tim Pistor:
strCommand = {cmd /c start AcroRd32.exe }+ strPrintPath
intRun = Shell(strCommand,3)

geht das?

eknori:
ja, so geht es natürlich auch ...

Jörg Barth:
Oder mit
Declare Function ShellExecute Lib "shell32" Alias "ShellExecuteA" (Byval HWND As Long,  Byval mode As String,    Byval url As String,    Byval a1 As Variant,  Byval a2 As Variant,    Byval nShowCmd As Integer ) As Long

Dim lg As Long
Call   shellexecute(lg,"Open",Pfad zur PDF-Datei,"1","1","1")

bikerboy:
@Tim Pistor

Ich nehme das kürzeste


@Alle

Danke für die muntere Teilnahmen

Navigation

[0] Themen-Index

[*] Vorherige Sete

Zur normalen Ansicht wechseln