OPTIONS "C_CALL LABELCHECK"
NUMERIC DIGITS 10
LIBRARY rexxgui
DO
FUNCDEF("BeginPaint","32u,void,void stor","user32")
FUNCDEF("EndPaint","32,void,void","user32")
CATCH FAILURE
CONDITION("M")
RETURN
END
guierr = "SYNTAX"
guiheading = 1
twainerr = "SYNTAX"
twainheading = 1
dib = 0
DO
guiwindowdefaults(, , , , "TWAIN")
RXFUNCQUERY()
twaininit(1 , "Twain Demo", 1)
guicreatewindow('NORMAL')
twainopendsm(guiwindow)
CATCH SYNTAX
CONDITION('M')
twainclosedsm()
RETURN
END
again:
DO FOREVER
guigetmsg()
IF EXISTS('GuiObject') == 0 THEN DO
IF EXISTS('GuiSignal') THEN DO
END
END
ELSE DO
IF EXISTS('GuiSignal') == 0 THEN DROP (guiobject)
ELSE SELECT guiobject
WHEN 'TWAIN' THEN DO
IF guisignal == "XFER" THEN DO
twaingetimageinfo("BitmapInfo")
twaingetimage("HandleBitmap")
guirefresh(, 1)
END
END
OTHERWISE
END
END
CATCH SYNTAX
CONDITION('M')
SIGNAL again
CATCH HALT
FINALLY
guidestroywindow()
END
RETURN
acquiretwain:
twainfreedib(dib)
twainacquire(1)
RETURN
picktwainsource:
twainselectsource()
RETURN
handlebitmap:
dib = twaincreatedib(ARG(1))
RETURN 1
wm_paint:
hdc = beginpaint(guiwindow, ps)
twaindrawdib(dib, hdc)
endpaint(guiwindow, ps)
RETURN "" |