Step 5 - PowerScript Functions

Apply the following changes to your PowerScript functions, if found in your source code, in order to use the corresponding 64-bit features.

  • If you are passing Structures to External Functions: (read more)

    You can pass PowerBuilder structures to external C functions if they have the same definitions and alignment as the structure's components. The DLL or shared library must be compiled using byte alignment; no padding is added to align fields within the structure.

    The default structure member alignment for Windows APIs and Visual C++ is now 8 bytes. The structure member alignment was changed to 8 bytes for both 64-bit and 32-bit applications. This was an intentional change so that you can now call Windows APIs easier and use the same code for both 64-bit and 32-bit applications.

    This structure member alignment was covered in Step 1.

  • If you need to use the Registry to store a value of type RegLonLong! then use the following PowerScript function:

    RegistrySet ( key, valuename, valuetype, value ) (Source)

    valuetype

    • RegLongLong! -- A 64-bit number which is the longlong type ranging from 0 -9,223,372,036,854,775,807, because the registry key value cannot accept a negative number.

  • If you need to use the Registry to get a stored value of type RegLongLong! then use the following PowerScript function:

    RegistryGet ( key, valuename {, valuetype }, valuevariable ) (Source)

    valuetype

    • RegLongLong! -- A 64-bit number which is the longlong type ranging from 0 -9,223,372,036,854,775,807, because the registry key value cannot accept a negative number.

  • If you need to convert two Long datatype values into a LongLong datatype, use the following method:

    LongLong

    Combines two unsigned longs into a longlong value.

    Example:

    • UnsignedLong lLow //Low long 32 bits

    • UnsignedLong lHigh //High long 32 bits

    • longlong LLValue //LongLong value 64 bits

    • lLow = 1234567890

    • lHigh = 9876543210

    • LLValue = LongLong(lLow, lHigh)

    • MessageBox("LongLong value", LLValue)

    • Combines two unsigned longs into a longlong value.