Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

specifying struct! in routine!

 [1/4] from: anton::lexicon::net at: 13-Aug-2002 1:36


Hello, anyone know how to specify a structure in a routine definition? Example console session:
>> make routine! [lpNetResource [struct!]] mpr "WNetUseConnectionA"
** Script Error: Invalid argument: struct! ** Near: make routine! [lpNetResource [struct!]] mpr "WNetUseConnectionA" I have defined a structure that I want to pass in: NETRESOURCE: make struct! [ dwScope [integer!] ; Long dwType [integer!] ; Long dwDisplayType [integer!] ; Long dwUsage [integer!] ; Long lpLocalName [string!] lpRemoteName [string!] lpComment [string!] lpProvider [string!] ] none ; (no initial values) Can anyone give any clues? This is for mapping a network drive in windows. Anton.

 [2/4] from: petr:krenzelok:trz:cz at: 12-Aug-2002 18:21


-- Unable to decode HTML file!! --

 [3/4] from: anton:lexicon at: 13-Aug-2002 2:36


Well, good old google. I found an example. I now do it like this: NETRESOURCE: [ dwScope [integer!] ... etc. ] make routine! compose/only/deep [ lpNetResource [struct! (NETRESOURCE)] ] mpr "WNetUseConnectionA" As NETRESOURCE is just a block now, I have to make struct! NETRESOURCE [...] instead. No problem. Note, the /only refinement of 'compose is only available in the betas after the last official release of rebol, which is; REBOL/View 1.2.1.3.1 21-Jun-2001 Anton.

 [4/4] from: greggirwin:mindspring at: 12-Aug-2002 11:00


Hi Anton, << Hello, anyone know how to specify a structure in a routine definition? >> It's not as straight-forward as it could be. :) NETRESOURCE: make struct! [ dwScope [integer!] dwType [integer!] dwDisplayType [integer!] dwUsage [integer!] lpLocalName [string!] lpRemoteName [string!] lpComment [string!] lpProvider [string!] ] none ; (no initial values) net-use-connection: make routine! compose/deep [ ;...params lpNetRes [struct! [(first NETRESOURCE)]] ;...more params return: [integer!] ] mpr "WNetUseConnectionA" HTH! --Gregg