Hoi Patrick,
Herby I post some code. I stripped it a bit but the essentials are still in
it. I hope it makes things clear for you.
Thanks,
Hendrik Jan
===================================================
Option Explicit
Declare Function GetCommandLine Lib "kernel32" Alias "GetCommandLineA" ()
As Long
Public Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal
lpString As Long) As Long
Public Declare Function lstrcpy Lib "kernel32" Alias "lstrcpyA" (ByVal
lpString1 As String, ByVal lpString2 As Long) As Long
Public Sub AutoOpen()
'---------------------------------------------------------------------------------------
'Beschrijving : Deze sub wordt uitgevoerd bij het starten van Correspondentie
'Historie
'---------------------------------------------------------------------------------------
'Datum Wie Povir Beschrijving
'---------- --- -----
------------------------------------------------------------
'10/01/2006 EK/HJS 7020 Eerste versie
'---------------------------------------------------------------------------------------
'error handling
On Error GoTo ErrHandler
'statements
'here is other code
'de commandline uitlezen voor het document dat moet worden afgehandeld
Call gen_HandleCommandLineParams("Document")
'here is other code
Exit Sub
'----------
ErrHandler:
Call err_ErrorHandler(Err, "modStartUp - AutoOpen")
End Sub
Public Sub gen_HandleCommandLineParams(acWaarde As String)
'------------------------------------------------------------------------------------------------
'Beschrijving : Uitlezen van de commandlineparameters en deze in de array
met parameters plaatsen
'In : acWaarde - "Document" dan nog geen extra info ophalen
'------------------------------------------------------------------------------------------------
'Historie
'------------------------------------------------------------------------------------------------
'Datum Wie Povir Beschrijving
'---------- --- -----
------------------------------------------------------------------------
'10/01/2006 EK 7020 Eerste versie
'------------------------------------------------------------------------------------------------
'error handling
On Error GoTo ErrHandler
'vars
Dim lcCommandLine As String
'statements
'lees commandline uit en zet deze in de var lcCommandLine
lcCommandLine = CmdLinetoString(GetCommandLine())
'here is other code
Exit Sub
'------------
ErrHandler:
Call err_ErrorHandler(Err, "gen_HandleCommandLineParams")
End Sub
Public Function CmdLinetoString(ByVal lngPtr As Long) As String
'--------------------------------------------------------------------------------------------
'Beschrijving :
'Historie
'--------------------------------------------------------------------------------------------
'Datum Wie Povir Beschrijving
'---------- --- -----
--------------------------------------------------------------------
'10/01/2006 EK 7020 Eeerste versie
'--------------------------------------------------------------------------------------------
'error handling
On Error GoTo ErrHandler
'vars
Dim strReturn As String
Dim StringLength As Long
'get the length of the string (not including the terminating null
character)
StringLength = lstrlen(lngPtr)
'initialize our string so it has enough characters including the null
character
strReturn = String$(StringLength + 1, 0)
'copy the string we have a pointer to into our new string
lstrcpy strReturn, lngPtr
'now strip off the null character at the end
strReturn = Left$(strReturn, StringLength)
'return the string
CmdLinetoString = strReturn
Exit Function
'------------
ErrHandler:
Call err_ErrorHandler(Err, "modGeneral - CmdLineToString")
End Function
===================================================
Thanks,
Hendrik Jan