miércoles, 7 de enero de 2009

It's time to get Funcky.... again

In the old Clipper times, one of the most appreciated libraries for Clipper was Funcky.

For sure, Funcky was one of the most complete function libraries with more than 1000 different functios for almost everything. The time has passed and about 5 years ago, Funcky's author, Dirk Lesko, created a new version of Funcky for Windows programming languages.

Release 6.0 of Funcky is the result of 2 years of development, it's not longer a LIB, now is a COM component that you can use via OLE form any programming language: C++, Visual Basic, Delphi, Visual Objects, etc.

(x)Harbour is not a very well known programming language yet (only by us), and if you visit the Funcky's web page, you will see that (x)Harbour is not mentioned in the list of the compatible programming languages, but thinking that there's a Funcky version for Borland C++, is not difficult to imagine that you can use it with xHarbour.

Funcky 6.0 includes a LIB file to be linked to a Borland C++ application, to use it with xHarbour you need to wrap all the functions, but the best and easier way to use Funcky in your xHarbour applications is via OLE.

Funcky works not only for graphical Windows applications, you can use it also for your xHarbour console based applications or with Web based applications.

Funcky has A BUNCH of functions (in fact, they are "methods" of the Funcky object) for A LOT of stuff, some functions are quite useful, some other are just for fun, but it's interesting to look at them. Funcky has several objects in the complete library, to use them is very easy:

oFuncky := TOleAuto():New("Funcky")

or

oFuncky := CreateObject("Funcky")

And you are done !, all the functions are "encapsulated" into the oFuncky variable, for example, if we want to get a list of all the storage units of your computer (drives, hard disk, memory cards, mapped drives, etc.) we will use the method: AllDrives(), like this :

cDrives := oFuncky:AllDrives()

And this method will return a string with all the letters of the current active storage units ("a: c: d: w:" for example), the Funcky object alone has over 400 methods to do a lot of stuff, the manual is self explained and documents all the features of the library.

But Funcky is only one object, inside the component there's also another 30 specialized objects, with their owns methods, events and datas. There's an object for any programming task you can imagine.

Let's do something more complex, for example to get the trace route to an IP address, to do so, we can use an FunckyTraceRoute object, like this:

oFunckyTrace := TOleAuto():New("FUNCkyTraceRoute")

nTotal = 0
aTrace := {}

oFunckyTrace:FindFirst("ciber-tec.com")

DO WHILE oFunckyTrace:Found()

AADD(aTrace,oFunckyTrace:Name+" "+ALLTRIM(STR(oFunckyTrace:RTT))+" ms")
oFunckyTrace:FindNext()

ENDDO

Achoice(0,0,50,50,aTrace)

Want a list of all the printers installed in your computer ?, then we use the FunckyFindPrinter object, now in the xHarbour way:

aPrinters := {}

WITH OBJECT oFunckyPrinters := TOleAuto():New("FUNCkyFindPrinter")

:FindFirst()


DO WHILE :Found()

AADD(aPrinters, :Name())

:FindNext()

ENDDO


END WITH

AChoice (0,0,50,05,aPrinters)


As you may noticed, to use Funcky is very easy, the documentation is very useful, complete and comes with samples for all the methods, it comes in a Windows help file so you can read it any time you need it. There's no an xHarbour specific documentation, but you can use the samples of Visual Basic or Delphi with minor fixes.

One of the main advantages of Funcky is that the values used as parameters to the methods, and the values returned by them are only of 3 data types: Logical, Character or Numeric, so you don't need to struggle with "C" data types such bytes, chars, longs, doubles, etc.

I've written a little sample of how to use Funcky with FiveWin, you can download it clicking here, source code is included and the EXE file also, in case you don't have a way to recompile it, but be aware that you will need to have Funcky installed in your computer.

Funcky is a COM component so you will have to install and register it in all the computers that use your program.

If you don't have Funcky, you can download a "lite" version from www.funcky.com, this lite version is not the full featured one, but has A LOT of nice useful functions such e-mail sending and others you can use and distribute for free in all your programs.

The full product is available for 349.00 USD, if you still have you old Funcky for Clipper version, you only pay 149.00 USD, to be honest, worth the price.

No hay comentarios:

Publicar un comentario