[fpc-pascal] Basic Windows tutorial

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Thu Oct 22 18:50:27 CEST 2015


On 2015-10-22 14:49, Ryan Joseph wrote:
> Looks pretty straight forward and simple compared to Cocoa on the
> Mac.

Win32 API is not hard, it is just a lot more effort to write a program
using only the Windows API. eg: fpGUI Toolkit  also uses the Win32 API
to create windows, set border styles, window styles etc. But the API has
lots of options, thus lots of reading on MSDN. fpGUI hides that
complexity from the developer so they can get going much quicker, and
rather concentrate on implementing there application, that fiddling with
the intricacies of the Win32 or XLib API.

But I understand your goal.

> does it work with FPC? Do they have a plugin or something that
> supports the compiler or does it require some hacking?

No "hacking" is required. Geany IDE allows you to specify compiler
commands. You point it to the fpc.exe file, and tell it what compiler
parameters to use.

Fred van Stappen uses Geany with FPC. You can find his contact details
here [https://github.com/fredvs].

Alternatively, google something like "Geany IDE with FPC" and you will
find many links and youtube tutorials.


> Is there a reference to the API for FPC or do I need to open up
> source files?

The Windows and Messages units included with FPC, is what you need to
include in your application. Then reference the MSDN Win32 API
documentation to understand how to use the API calls.

AggPas also includes a very scaled down API requirements to get a Main
form displayed, set a Window Title, draw some text and implement a Event
Queue. Sake a look at AggPas in the
'platform/win/agg_platform_support.pas' unit. You can ignore the AggPas
code, and only pay attention to the Win32 API calls and event queue.
Look at the window_proc() function, DefWindowProc(), CreateWindow(),
MoveWindow(), ShowWindow() etc.


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp



More information about the fpc-pascal mailing list