Translating lotus API Data Types to LotusScript

王朝other·作者佚名  2006-01-09
宽屏版  字体: |||超大  

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

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
© 2005- 王朝网络 版权所有