LotusScript to C API Programming Guide

rtLib Domino Rich Text Management template
Home
Show details for ContentContent
Purchase
Ready-to-use samples
Show details for Online resourcesOnline resources
Forum
Links
Happy readers

Anonymous

login


 

Hosted by Prominic.NET, Inc.
Main topic: ConvertItemToText

ConvertItemToText (by Eric Forte, 04/22/2005 02:30:04 PM)

This is actually something I posted today to ND6 Forum as well.

I'm sort of at my wit's end here. I've had a fair amount of success writing programs using the the LS2C API, but this little snippet keeps crashing my Notes client. In short, I'm cycling through all selected Bookmark documents in the Bookmarks database and I'm crashing right at the call to ConvertItemToText.

Any idea what I'm missing? For now, I just want to print out the contents of the URL field. If I get more adventurous, I'd like to write back to it.

I've included my function declaration too.

Thanks

==================

Declare Function W32_ConvertItemToText Lib "nnotes" Alias "ConvertItemToText" (Byval item_value As Any, Byval item_length As Long, Byval delim As String, Byval charsPerLine As Integer, buffer_handle As Long, buffer_length As Long, Byval stripTabs As Long) As Integer

Sub Initialize

Dim s As New NotesSession

Dim dc As notesdocumentcollection

Dim doc As NotesDocument

Dim iBlock As Blockid, iType As Integer, vBlock As Blockid, vLen As Long

Dim buffLen As Long

Dim hBuf As Long

Dim irc As Integer, lineLen As Integer

Dim itemName As String

buffLen = 256

itemName = "URL"

Set dc = s.CurrentDatabase.UnprocessedDocuments

Set doc = dc.GetFirstDocument

While Not doc Is Nothing

irc = W32_NSFItemInfo(doc.handle, itemName, Len(itemName), iBlock, iType, vBlock, vLen)

If irc = 0 Then

irc = W32_ConvertItemToText(vBlock.pool, vLen, "\n", 80, hBuf, buffLen, 1)

If irc = 0 Then

pBuffer = W32_OSLockObject(vBlock.pool) + vBlock.block

If pBuffer <> 0 Then

Print "memory:", pBuffer

W32_OSUnlockObject (vBlock.pool)

End If

Else

Print getError(irc)

End If

Else

Print getError(irc)

End If

Set doc = dc.GetNextDocument(doc)

Wend

End Sub