Example: Calling PowerBuilder functions
In
this code fragment, the class and method ID returned by calls to
the IPB_Session GetClass and GetMethodID methods
are used to initialize a PBCallInfo structure, called ci,
using the IPB_Session InitCallInfo method.
After a new pbstring variable is created,
the value of that string is set to the value of the first argument
in the PBCallInfo structure.
|
1 |
BOOL CALLBACK CFontEnumerator::EnumFontProc<br>(<br>   LPLOGFONT lplf, <br>   LPNEWTEXTMETRIC lpntm, <br>   DWORD FontType, <br>   LPVOID userData<br>)<br>{<br>   UserData* ud = (UserData*)userData;<br>   pbclass clz = ud-><span>session->GetClass</span>(ud->object);<br>   pbmethodID mid = ud-><span>session->GetMethodID</span><br>      (clz, "onnewfont", PBRT_EVENT, "IS");<br> <br>   PBCallInfo ci;<br>   ud-><span>session->InitCallInfo</span>(clz, mid, &ci);<br> <br>// create a new string variable and set its value<br>// to the value in the first argument in the <br>// PBCallInfo structure<br>   pbstring str = ud-><span>session->NewString</span><br>      (lplf->lfFaceName);<br>   ci.pArgs-><span>GetAt(0)</span>-><span>SetString</span>(str);<br> <br>   ud-><span>session->TriggerEvent</span>(ud->object, mid, &ci);<br>   pbint ret = ci.returnValue-><span>GetInt</span>();<br> <br>   ud-><span>session->FreeCallInfo</span>(&ci);<br>   return ret == 1 ? TRUE : FALSE;<br>} |
Document get from Powerbuilder help
Thank you for watching.
Subscribe
Login
0 Comments
Oldest