[fpc-pascal]Wiindows API calls.

Sebastian Günther sguenther at gmx.de
Sun Oct 15 10:22:09 CEST 2000


MPDJ wrote:
> 
> Hi,
> 
> I'm new to FPC under Windows, and I'm having trouble finding any information
> on using Windows API calls.

Just add the unit 'Windows' to the 'uses' list of your program, and you
can use almost all Win32 functions and declarations as you would use
them in C.


> HWND hwndWinamp = FindWindow("Winamp v1.x",NULL);

program Test;
uses Windows;
var
  hwndWinamp: HWND;
begin
  hwndWinamp := FindWindow('Winamp v1.x', nil);
  ...
end.


> #define IPC_STARTPLAY 102
> 
> /*
> ** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_STARTPLAY);
> **
> ** Using IPC_STARTPLAY is like hitting 'Play' in Winamp, mostly.
> */

in Pascal:

  ...
  const
    IPC_STARTPLAY = 102;
  begin
    ...
    SendMessage(hwnd_winamp, WM_WA_IPC, 0, IPC_STARTPLAY);
    ...
  end;


If you have the source code of the Free Pascal RTL, just have a look at
the files in the rtl\win32\wininc directory. There you can find all
declarations; it it very useful to have a 'grep'-like utility available
for searching them.


- Sebastian




More information about the fpc-pascal mailing list