Step 3:
Declare native classes and global functions
For each native class that the nonvisual extension supports,
declare an ANSI C++ class that inherits from IPBX_NonVisualObject, which
is the ancestor class for all nonvisual PowerBuilder native
classes.
The declaration of the class can be placed in a header file, and
it must include Invoke and Destroy methods. This is a simple prototype
for a nonvisual class:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
#include "pbext.h" class CMyClass : public IPBX_NonVisualObject { enum MethodIDs { mFunca = 0, mFuncb = 1 }; public: // constructor, destructor CMyClass() virtual ~CMyClass() // member methods PBXRESULT Invoke( IPB_Session *session, pbobject obj, pbmethodID mid, PBCallInfo *ci ); void Destroy(); private: void funcA(IPB_Session* session, pbobject obj, PBCallInfo* ci); void funcB(IPB_Session* session, pbobject obj, PBCallInfo* ci); }; |
If you declare global functions in your extension, the extension
must export the PBX_InvokeGlobalFunction method. The
following PBX_GetDescription call declares three global functions:
bitAnd, bitOr, and bitXor:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
PBXEXPORT LPCTSTR PBXCALL PBX_GetDescription() { static const TCHAR desc[] = { "globalfunctions " "function int bitAnd(int a, int b) " "function int bitOr(int a, int b) " "function int bitXor(int a, int b) " "end globalfunctions " }; return desc; } |
Document get from Powerbuilder help
Thank you for watching.
Subscribe
Login
0 Comments
Oldest