The following code demonstrates wrapping the Win32 API, in this case the IsInetOffline function in URL.DLL. The commented line is taken from a WIN32API.TXT file I found on the internet.
; Private Declare Function InetIsOffline Lib "url.dll" (ByVal dwflags As Long) As Long make "url_handle libload "url.dll to InetIsOffline? :dwflags end external "InetIsOffline? [ U4 InetIsOffline U4] :url_handle ifelse InetIsOffline? 0 <> 0 [ print [internet offline] ] [ print [internet online] ]I rather like the notation for defining the call to the DLL itself:
'external' <localsymbol> '[' <returntype> <dllsymbol> <arg1type> ... ']' <libloadvalue>
I've written a few bits and pieces of code which can be found over on the Lhogho forum. Enjoy!
No comments:
Post a Comment