LotusScript to C API Programming Guide

rtLib Domino Rich Text Management template
Home
Show details for ContentContent
Purchase
Ready-to-use samples
Hide details for Online resourcesOnline resources
Technotes and goodies
Reference
Header files
Forum
Links
Happy readers

Anonymous

login


 

Hosted by Prominic.NET, Inc.
Main topic: CreateProcessA in kernel32

CreateProcessA in kernel32 (by Ferenc Gogola, 07/24/2007 02:17:44 AM)

Hi Normunds, thanks for your work. First I have a roundabout way with MS WordBasic from LotusScript it was not very elegant but worked. Second I have found in LotusScript's function Shellid() from R6 it's working too but I need the solution in R5 also.

Here is the R6 RunApp

app is the full path and cmd arguments i.e. "c:\windows\notepad.exe test.txt"

Private Function RunApp(app As String) As Variant

   RunApp = False

   On Error Goto catch

   

   Dim taskid As Variant

   

   Const SYNCHRONIZE = &H100000

   Const INFINITE = &HFFFF

   Const WAIT_OBJECT_0 = 0

   Const WAIT_TIMEOUT = &H102

   

   Dim lPid As Long

   Dim lHnd As Long

   Dim lRet As Long

   Dim txtApp As String

   

   lPid = Shellid(app, 1)

   If lPid <> 0 Then

      lHnd = OpenProcess(SYNCHRONIZE, 0, lPid)

      If lHnd <> 0 Then

         lRet = WaitForSingleObject(lHnd, INFINITE)

         CloseHandle (lHnd)

      End If

   End If

   

   RunApp = True

exitFunction:

   Exit Function

catch:

   Error Err, Lsi_info(2) & ":" & Erl & ">" & Err & " " & Error$

   Resume exitFunction

End Function

Best regards: Ferenc