Windows API Calls for Powerbuilder 5.0

¹®Á¦

GetKeyboardState( ) & SetKeyboardState( )

ÇØ°á

The first function returns the present state of every key on the keyboard into an array of 256 integers based on the characters ASCII representation. The second function sets the keyboard to the state given in the array. A zero value represents that the key is not pressed. There is no Powerbuilder equivalent.

Global External Function:
FUNCTION boolean GetKeyboardState(ref integer kbarray[256]) LIBRARY "USER32.DLL"
FUNCTION boolean SetKeyboardState(ref integer kbarray[256]) LIBRARY "USER32.DLL"

Script:
//GetKeyboardState( )
boolean rtn
integer ipkey[256]
rtn = GetKeyboardState(ref ipkey)

//SetKeyboardState( )
rtn = SetKeyboardState(ref ipkey)
if rtn = false then
        Messagebox("Failed","Something went wrong when loading into array")
else
        Messagebox("Successful","Keyboard state is loaded back into buffer")
end if

 

ÂüÁ¶