Codebase list swi-prolog / 109af2a1-1aa9-45ee-9e2f-3bf3c7edfa79/main packages / windows
109af2a1-1aa9-45ee-9e2f-3bf3c7edfa79/main

Tree @109af2a1-1aa9-45ee-9e2f-3bf3c7edfa79/main (Download .tar.gz)

# Foreign language demo for Windows

This directory contains two examples of foreign-language extensions.

  - dlltest.dll
    Simple code illustrating very basic functionality of the
    interface.  Load it using:

        ?- load_foreign_library(dlltest).

    It defines the following predicates:

     - say_hello(+Text)
       Shows a simple Windows message-box containing Text.
     - mclock(-MilliSeconds)
       Return the number of milli-seconds elapsed since the library was loaded.
     - rlc_color(+Which, +R, +G, +B)
       Set the color of the plwin window. Which is one of {window, text,
       highlight, highlighttext}, RGB are integers between 0 and 255 for
       the color components.

    In addition, it illustrates how to hook into a Prolog abort.

  - plregtry.dll
    Defines predicates to access the Windows registry.  It is a much
    more elaborate example, and also a useful library. Its not
    documented, but with some knowledge of the Windows API it should
    be fairly easy to figure out how it works.