Declare Function mac_OSGetSystemTempDirectory Lib "NotesLib" Alias "OSGetSystemTempDirectory" ( Byval S As String) As Integer
Declare Function linux_OSGetSystemTempDirectory Lib "libnotes.so" Alias "OSGetSystemTempDirectory" ( Byval S As String) As Integer
Const ERR_UNSUPPORTED_PLATFORM = 20300 ' or other value you choose.
Function GetNotesTempDirectory() As String
' Returns the path of the temporary directory used by Notes.
Dim session As New NotesSession
Dim d As String * 256
Dim s%
Select Case session.Platform
Case "Linux"
s% = linux_OSGetSystemTempDirectory(d)
Case "Macintosh"
s% = mac_OSGetSystemTempDirectory(d)
Case "Windows/32"
s% = w32_OSGetSystemTempDirectory(d)
Case Else
Error ERR_UNSUPPORTED_PLATFORM, "In GetNotesTempDirectory, platform not supported: " & session.Platform
End Select
GetNotesTempDirectory = Left$(d, s%)
End Function
Hmmm... this is a copy paste from moorthydaniel's blog... seemed to be a nice one...
So its my turn to share the same
God got to understand those lib stuffs... seems like a head ache :(
Hope this helps :)
It's easy to understand - all it's doing is accepting string and returning an integer depending on platform, which is the size of the string - the size is needed, since the string is originally 256 characters, but if the return size is 50 character for example, we only need first 50 characters (I think length method is useless here so we need to know the exact size of the string therefore the integer return value)!! Welcome to the world of C programming! Hope this makes sense.
ReplyDeleteA nice one. Thank you :)
ReplyDeleteVery useful thanks for this
ReplyDelete