Capture C API message signal in LotusScript

Hi! I want to capture messages from calls to C API function DesignRefresh:

STATUS LNPUBLIC DesignRefresh(

char *Server,

DBHANDLE  hDB,

DWORD  dwFlags,

ABORTCHECKPROC  AbortCheck,

OSSIGMSGPROC  MessageProc);

Is it possible to use OSSIGMSGPROC in any way from LotusScript? Or any other technique? The problem is I want to capture the message in the status bar that says if design refresh was successful or not…

Thanks!

Subject: Capture C API message signal in LotusScript

If you are using C API in Lotus Script, then the function “DesignRefresh” should return a code (0) if success and something else for some error. That something else can be then retrieved by the below function.=======================================

OPTIONS


'** Error code masks

Const ERR_MASK = &H3fff

Const PKG_MASK = &H3f00

Const ERRNUM_MASK = &H00ff



Declarations

Declare Function OSLoadString Lib “nnotes.dll” (Byval hModule As Long, Byval stringCode As Integer, _

Byval retBuffer As String, Byval bufferLength As Integer) As Integer

GET API ERROR


Function GetAPIError (errorCode As Long) As String

	

	Dim errorString As String*256

	Dim returnErrorString As String

	Dim resultStringLength As Long

	Dim errorCodeTranslated As Integer

	'** mask off the top 2 bits of the errorCode that was returned; this is

	'** what the ERR macro in the API does

	errorCodeTranslated = (errorCode And ERR_MASK)

	

	'** get the error code translation using the OSLoadString API function

	resultStringLength = OSLoadString(0, errorCodeTranslated, errorString, Len(errorString) - 1)

	

	'** strip off the null-termination on the string before you return it

	If (Instr(errorString, Chr(0)) > 0) Then

		returnErrorString = Left$(errorString, Instr(errorString, Chr(0)) - 1)

	Else

		returnErrorString = errorString

	End If

	

	GetAPIError = returnErrorString

	

End Function



=======================================HTH



Vinit

Subject: RE: Capture C API message signal in LotusScript

Thanks for posting! The problem is that DesignRefresh returns 0 even if design refresh fails, ie if template could not be found.Thats why I need to capture the status bar message.

Subject: Capture C API message signal in LotusScript

I think you would have to write your own C function to use DesignRefresh with your own defined MessageProc handler. You could create a DLL to do this.