Genii Weblog

Creating and modifying image resources with Midas 3.30

Thu 29 Apr 2004, 01:19 AM



by Ben Langhinrichs
While working on a new sample to be distributed with Midas version 3.30, I created this code for creating and modifying image resources with Midas Version 3.30.  It has gotten has gotten very simple.  Here is the whole agent for either creating or modifying an image resource:

Sub Initialize
   ' *** Domino back-end class objects
   Dim session As New NotesSession
   Dim db As NotesDatabase
   
   ' *** Midas back-end class objects
   Dim rtSession As New GeniiSession
   Dim rtitem As New GeniiRTItem
   
   ' *** Miscellaneous processing variables
   Dim fileName As String
   Dim pathName As String
   Dim pos As Integer
   
   Set db = session.CurrentDatabase
   
   pathName$ = Inputbox$("Enter the full pathname for the graphics file:", "Graphic Pathname", "")
   If Len(pathName) =Then Exit Sub
   
   fileName = pathName
   pos = Instr(fileName, "\")
   While pos > 0
      fileName = Mid$(fileName, pos+1, Len(fileName)-pos)
      pos = Instr(fileName, "\")
   Wend
   
   Set rtitem = rtSession.CreateImageResource(db.Server, db.FilePath, fileName, pathName)
   rtitem.Save
End Sub

By default, the CreateImageResource will overwrite the existing image resource, so this will either create or update the image resource.  Pretty simple, eh?

Copyright © 2004 Genii Software Ltd.

What has been said:

No documents found