Translating lotus API Data Types to LotusScript

类别:编程语言 点击:0 评论:0 推荐:

lotus API Data Type LotusScript Data Type char, char* ByVal String char far* ByVal String int Long (4-byte value) long Long WORD, SWORD Integer DWORD Long INT, UINT Integer SHORT, USHORT Integer LONG, ULONG Long NUMBER Double BOOL Long (in general,
sometimes Integer) BYTE, BOOLBYTE Byte in R5+,
cannot convert pre-R5 STATUS Integer HANDLE Long (Integer on Mac
and some UNIX) HMODULE Long NULL ByVal Integer (0)

In general, when you have a pointer (*) to a variable, you'll want to pass that parameter ByRef, otherwise you should pass it ByVal -- the exceptions are Strings (which you should pretty much always pass ByVal) and user-defined data types (which you have to pass ByRef). If you want to pass a NULL value to an API function, declare the parameter as an Integer and pass a zero ByVal.

As an example, these two commonly-used API functions:

STATUS LNPUBLIC NSFDbOpen(char far *PathName, DBHANDLE far *rethDB); STATUS LNPUBLIC NSFDbClose(DBHANDLE hDB);

are defined like this in LotusScript (on a Windows platform):

Declare Function NSFDbOpen Lib "nnotes.dll" (Byval PathName As String, _ rethDB As Long) As Integer Declare Function NSFDbClose Lib "nnotes.dll" (Byval hDB As Long) As Integer

Note that the function's return value (STATUS, in this case) is at the beginning of the function declaration in C, and the LNPUBLIC part of the function gets thrown away (that's just the calling convention in C, and has nothing to do with your LotusScript calls). If a C function returns "void", you can treat it like a Sub.
来自nsftool

本文地址:http://com.8s8s.com/it/it24719.htm