[REBOL] Re: View/Pro and accessing Windows Printer API (gdi32.dll)
From: greggirwin:mindspring at: 29-Jun-2002 9:23
Hi Bo,
<< ;hprinter is the handle that should be returned by 'openprinter above if
I
understand how 'openprinter works. >>
I think you need to pass a buffer and then check that when the call returns.
That's what I had to do to use the return connection ID from InternetDial.
Here's the idea. I have to run right now, but I'll check back tomorrow, or
mail me directly if this causes more confusion.
win-lib: load/library %wininet.dll
internet-dial: make routine! [
hwnd-parent [integer!]
connectoid [string!]
flags [integer!]
rtn-conn-id [char*] ; LPDWORD - either string! or char* work
here
reserved [integer!]
return: [integer!]
] win-lib "InternetDial"
;-- Internal support routines
null-buff: func [
{Returns a null-filled buffer of the specified length.}
len [integer!]
][
to-string array/initial len #"^@"
]
;-- Interface routines
connect: func [
{Initiates dial-up connection. Returns connection ID (to use with
disconnect) if successful; false otherwise.}
dial-up-name [string!]
/local id
][
id: null-buff 4
last-error: internet-dial no-hwnd dial-up-name dial-unattended id
zero
either all [(last-error = 0) (id <> null-buff 4)] [
last-error: none
return to-integer to-binary head reverse id
][
return false
]
]
HTH!
--Gregg