Windows API

ID #1021

How to call WinAPI functions from Clarion applications?

For the first time it is necessary to declare in MAP-section the prototype of WinAPI-function in terms of Clarion, i.e. to replace C-data types with corresponding data types of Clarion. You may use service program winapi.exe which is delivered with Clarion. Its database content great variety already adapted prototypes for Clarion. As soon as procedure will be prototyped correctly, it may be used as usual Clarion-function.

Example:

! WinAPI prototype
LRESULT SendMessage(HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);
! Clarion prototype
SendMessage(UNSIGNED hWnd,UNSIGNED Msg,UNSIGNED wParam,LONG lParam), |
UNSIGNED,PASCAL,RAW,NAME('SendMessageA'),PROC
It should to pay special attention to attribute of procedure NAME. The matter is that functions WinAPI can be used both for usual null-terminated strings and for Unicode-string. Therefore Windows libraries export at least two names for the same function. Depending on types of string function will work, its name can be terminated by letter A (null-terminated strings) or W (wide strings). One more attribute demanding attention - RAW. It is necessary to specify it in the prototype of function if among its parameters there is a CSTRING-parameter. This attribute defines, that string parameter will be passed to procedure by its address. For detail information read the help.

Tags: prototype, declaration, API

Related entries:

Last update: 2007-07-17 11:03
Author: Aleksey Timkov
Revision: 1.0

Digg it! Print this record Send to a friend Show this as PDF file
Propose a translation for Propose a translation for
Please rate this entry:

Average rating: 2.67 out of 5 (3 Votes )

completely useless 1 2 3 4 5 most valuable

You can comment on this entry