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'),PROCIt 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:
- How to prevent running of Application Wizard creating new application?
- How to run application that will not be displayed in task bar?
- How to construct a complicated filter for database?
- How to read from application environment variable?
- How to avoid this error in Clarion for DOS: Link Error: Group or Segclass exceeds 64 k?
Last update: 2007-07-17 11:03
Author: Aleksey Timkov
Revision: 1.0
You can comment on this entry