' * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ' * ' * Refreshing design, callbacks and string conversion (Visual Basic), part I ' * ' * sample code from ' * LotusScript to Lotus C API Programmer Guide by Normunds Kalnberzins, (c) 2000-2003 ' * ' * http://www.ls2capi.com ' * ' * Author: Normunds Kalnberzins ' * ' * This code has been written as a sample to illustrate aspects of handling of Lotus C API from VisualBasic ' * and may be reused, modified on full responsibility of the developer and provided this notice is preserved ' * ' * The author does not guaranty it to fit any particular purpose and it is up to the developer ' * to modify, test it and determine the limits of its applicability ' * ' * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ' * * * * * * * * START (Function library) [DBREFRESH] ' * * * * * * * * ' * ' * demonstrates db design refresh and use of string conversion ' * ' * * * * * * * * START (Declaration) [W32_NSFDBOPEN] ' * * * * * * * * ' * Declare Private Function W32_NSFDbOpen Lib "nnotes" Alias "NSFDbOpen" _ (ByVal dbName As String, hdb As Long) As Integer ' * * * * * * * * END (Declaration) [W32_NSFDBOPEN] ' * * * * * * * * ' * * * * * * * * START (Declaration) [W32_NSFDBCLOSE] ' * * * * * * * * ' * Declare Private Function W32_NSFDbClose Lib "nnotes.dll" Alias "NSFDbClose" (ByVal hdb As Long) As Integer ' * * * * * * * * END (Declaration) [W32_NSFDBCLOSE] ' * * * * * * * * ' * * * * * * * * START (Declaration) [W32_DESIGNREFRESH ' * * * * * * * * ' * Declare Private Function W32_DesignRefresh Lib "nnotes" Alias "DesignRefresh" _ (ByVal sServer As String, ByVal hdb As Long, ByVal dwFlags As Long, ByVal AbortCheck As Long, ByVal MessageProc As Long) As Integer ' * * * * * * * * END (Declaration) [W32_DESIGNREFRESH] ' * * * * * * * * ' * * * * * * * * START (Method) [REFRESHNOTESDATABASEDE ' * * * * * * * * ' * Public Sub RefreshNotesDatabaseDesign Dim s As New NotesSession Dim ndb As NotesDatabase Dim hdb As Long Dim irc As Integer Dim DoMsg As Long Const dbpath = "c:\daten\lotus\notesclient5\capi\ScratchRtLib.nsf" Const useNLSTranslate = True s.Initialize Set ndb = s.GetDatabase("", dbpath) If Not ndb.IsOpen Then Call ndb.Open If Not ndb.IsOpen Then Debug.Print "failed to open DB:" & dbpath: Exit Sub Debug.Print "opened db - ", ndb.Title irc = W32_NSFDbOpen(ndb.FilePath, hdb) If irc <> 0 Then Debug.Print getError(irc) Else If useNLSTranslate Then W32_DesignRefresh "", hdb&, 0, 0, AddressOf MsgProcNLS Else W32_DesignRefresh "", hdb&, 0, 0, AddressOf MsgProcNativeToUnicode End If End If Call W32_NSFDbClose(hdb) End Sub ' * * * * * * * * END (Method) [REFRESHNOTESDATABASEDESI ' * * * * * * * * ' * * * * * * * * START (Method) [GETERROR] ' * * * * * * * * ' * Public Function getError (errnum As Integer) As String Dim s As String * 256 W32_OSLoadString 0, errnum And &H3FFFFFFF, s, 256 getError = Left(s, InStr(s, Chr(0))) End Function ' * * * * * * * * END (Method) [GETERROR] ' * * * * * * * * ' * * * * * * * * END (Function library) [DBREFRESH] ' * * * * * * * *