Lists the PowerBuilder syntax for calling Windows API functions. Also included is the PowerBuilder script needed to make the function calls
- 32 Bit - Windows API Calls for PowerBuilder
The following information lists the PowerBuilder syntax for calling Windows API functions. Also included is the PowerBuilder script needed to make the function call. If you would like an example of these API calls the sample pbl is located on the Powersoft FTP server. The file can be downloaded from:
These API calls are only a subset of all the API calls available. For a more complete listing of API calls you can consult the windows SDK helpfile which is named either win32.hlp or win32sdk.hlp(depending on what compiler the SDK has been installed from). Technote #44648 can assist you with the function declaration of the API call from powerscript.
The following API calls are referenced in this document:
| Arc | GetCurrentDirectoryA | Mouse_Event |
| Beep | GetCurrentThread | MoveToEx |
| BringWindowToTop | GetCursor | MoveWindow |
| Chord | GetCursorPos | Pie |
| CloseHandle | GetDC | Polygon |
| CloseWindow | GetKeyboardState | PostMessageA |
| CopyFileA | GetKeyState | Rectangle |
| CreateDirectoryA | GetModuleHandleA | ReleaseCapture |
| DeleteFileA | GetParent | SetCapture |
| DeleteMenu | GetPixel | SetComputerNameA |
| DestroyWindow | GetSystemTime | SetCurrentDirectoryA |
| DllRegisterServer | GetSystemMenu | SetCursorPos |
| Ellipse | GetSystemMetrics | SetFocus |
| ExitWindowsEx | GetThreadPriority | SetKeyboardState |
| FatalExit | GetUserNameA | SetPixel |
| FindWindowA | GetWindowsDirectory | Sleep |
| FreeLibrary | GlobalMemoryStatus | SndPlaySoundA |
| GetBkColor | LineTo | SwapMouseButton |
| GetCapture | LoadLibraryA | WaveOutGetNumDevs |
| GetComputerNameA | mciSendStringA | WinExec |
| GetClassNameA | MessageBoxA | ... |
| ADDITIONS: | GetVolumnInformationA | ... |
Arc( )
This function draws an arc based on the coordinates the function receives. There is no PowerBuilder equivalent.
Global External Function:
FUNCTION boolean Arc(ulong hwnd, long r1, long r2, long r3, long r4, long a1, long a2, long a3, long a4) LIBRARY "Gdi32.dll"
Function ulong GetDC(ulong hwnd) library "user32.dll"
Script:
Boolean rtn
ulong l_handle, l_device
long lv[8]
l_handle = handle(w_main) // 'w_main' is the name of the sample window.
l_device = GetDC(l_handle)
lv[ ] = {10,40,300,220,0,0,180,0}
rtn = Arc(l_device, lv[1], lv[2], lv[3], lv[4], lv[5], lv[6], lv[7], lv[8])
Beep( )
The Beep function causes the system to make an internal beep sound. This is identical to the PowerBuilder function Beep( ).
Global External Function:
FUNCTION boolean Beep(long freq,long dur) LIBRARY "Kernel32.dll"
Script:
Boolean rtn
Long ll_freq, ll_dur
ll_freq = 500
ll_dur = 20
rtn = Beep(ll_freq, ll_dur)
BringWindowToTop( )
The BringWindowToTop function sends a message to the target window telling it to come to the foreground. The PowerBuilder equivalent is limited to PowerBuilder Windows only, the script is as follows: <window > .bringtotop = true






