Thursday, November 29, 2012

NativeBoost 1.7 for Pharo 2.0

A new NativeBoost version 1.7 for Pharo 2.0 (which is still alpha as of today) is now available.

Just fire up an updated fresh Pharo 2.0 image and select "Tools" and "Configuration Browser". Then select Native Boost and select "Install configuration (Stable version)".

- Igor changed the API of NativeBoost a little bit (avoid globals, etc.)
- Ciprian contributed special syntax for array arguments
- I contributed some more examples for Win32 by wrapping some common Win32 API functions

So if you are on Windows you can play with:

    NBWin32Shell shellBrowse: 'http://world.st' 
    NBWin32Shell getComputerName
NBWin32Shell showODBCSettings
NBWin32Shell lockWorkstation
...

A more complete list can be found here.

Using the shell you can also query infos about your system:

   NBWin32Shell getEnvironmentVariable: 'JAVA_HOME'
   NBWin32Shell getDriveType: (NBWin32Shell getHomeDrive)
   NBWin32Shell getPathEntries
   ...

You can also open the control panel and control panel applets:

   NBWin32Shell showControlPanel
   NBWin32Shell showDisplaySettingsBackground
   ...

See class NBWin32Shell for more examples.

Now there is also support for the "DebugOutputString" API - which allows you to write

    NBWin32Shell outputDebugString: 'Trace me'

These outputs can be viewed with tools like dbmon.exe (from WinSDK) or DebugView.
Very usefull if you run Pharo headless on Windows.

I also played with the MessageBox API allowing you to open native message boxes. Not yet complete but you can test with

  NBWin32MessageBox test

Additionally I started wrapping some Windows GDI functions - so if you need faster native drawing you can write:

   NBWin32Window getFocus getDC rectangleLeft: 10 top: 10 right: 100 bottom: 100


Note that NativeBoost will soon be integrated into Pharo 2.0 by default (before it goes beta).

No comments: