WINAPI Examples


Example 1:

 

*

 

 

.Retrieve and display the Windows version.

.

 

 

GetVer

PROFILE

kernel32,GetVersion,INT2

RET2

INTEGER

2

  

...

 

  

WINAPI

GetVer GIVING RET2

  

DISPLAY

RET2

 

The WINAPI instruction retrieves the Windows version and places the result in an INTEGER field.

 

Example 2:

 

*

 

 

.Example of calling a function with a null parameter.

.

 

 

Function

PROFILE

LibName,FuncName,INT4,INT4,DIM,INT4

RESULT

INTEGER

4

VAR1

INTEGER

4

VAR2

INTEGER

4

  

...

 

  

WINAPI

Function GIVING RESULT USING VAR1,,VAR2

 

The DIM field is not passed, therefore its place is saved by the extra comma.

 

Example 3:

 

*

 

 

. Sample to execute a PL/B Web Server test JavaScript Functions named 'PlbApiTest'

. and 'PlbApiTest1' which can be found in the 'plbwebctls.js' JavaScript file.

.

 

 

SampJSN

PROFILE

JS, PlbApiTest, INT1, DIM

SampJS

PROFILE

!JS, PlbApiTest, DIM, DIM

SampJS1

PROFILE

!JS, PlbApiTest1, DIM, DIM

Dimparm

DIM

40

Num

INTEGER

1

.

 

 

 

MOVE

"5" TO DimParm

 

WINAPI

SampJsN Giving Num Using Dimparm

 

The last WINAPI called the JavaScript function named 'PlbApiTest' which exists in the 'plbwebctls.js' that has been automatically downloaded from the PL/B Web Server when the program was started.

 



PL/B Language Reference WHEREIS Example WORD Examples