Seite 1 von 1

Scanner ansprechen

Verfasst: 11.11.2005 17:09
von Donald
Hi,

hat es schon geschafft einen Scanner von PB aus anzusprechen,
OHNE zusätzliche DLL ?

Verfasst: 11.11.2005 17:48
von bobobo
twain oder was?

Verfasst: 11.11.2005 19:33
von Donald
bobobo hat geschrieben:twain oder was?
jau

Verfasst: 11.11.2005 19:55
von bobobo

Verfasst: 11.11.2005 20:08
von Donald
Na bobobo, da haste wohl nicht was überlesen.

Suche ne Möglichkeit ohne zusätzliche DLL.

Die DLL von Andreas kenne ich bereits.


Donald

Verfasst: 12.11.2005 19:39
von bobobo
dann such mal hier http://forums.purebasic.com/english/vie ... ight=twain

oder gar hier http://www.twain.org/

eventuell hilft die Doku oder gar das toolkit

twain ohne dll (oder deren Entsprechungen) ist allerdings wie Atmen ohne Luft oder Denken ohne Hirn.

Verfasst: 12.11.2005 20:53
von Kiffi
> Suche ne Möglichkeit ohne zusätzliche DLL.

Wieso? Möchtest Du alles in einer EXE haben? Wenn's keine ActiveX-DLL ist,
dann könntest Du Dir u.U. mal die LoadDllMemory-Lib aus dem PBOSL-Paket
anschauen.

Grüße ... Kiffi

Verfasst: 14.03.2006 00:34
von Falko
http://www.dosadi.com/eztwain1.htm

Diese DLL ist publikdomain und ist superklein.
64kb lassen sich überall verstecken und es sind viele Funktionen dabei.
Die Headerdatei erklärt alles was man braucht.
Ich habe heute endlich meine Webcam, mein Pinnacle StudioTV als auch meinen Scanner damit komplett über PB benutzen können.

Viel Spass beim ausprobieren

:allright:

Ein Wrapper ist leicht mit ts-soft seiner DLL2PBLib erstellt und hier ein Beispiel von
meinem kleinen Testsource in PB4 Beta 6.

Gruß Falko

Code: Alles auswählen

IncludeFile("EZTW32.PB")
EZTW32_Init()
#BitTiefe_0=32
#BitTiefe_1=16
#BitTiefe_2=8
#BitTiefe_3=4

OpenWindow(0, 700, 10, 640, 480,"Test")
CreateGadgetList(WindowID(0))
CreateImage(0,640,480,#BitTiefe_0)
TWAIN_SelectImageSource(hwnd)        ; Gerät auswählen
TWAIN_AcquireToClipboard(0,0)        ; kopiere ins Clipboard
;GetClipboardImage(0)
If StartDrawing(ImageOutput(0))
  DrawingMode(#PB_2DDrawing_Default)
  hbm.l=GetClipboardImage(#PB_Clipboard_Image,#BitTiefe_1)
  ResizeImage(0,640,480)
  If hbm
    DrawImage(hbm,0,0,640,480)
    StopDrawing()
 Else
    Debug "nix im Clipboard"
  EndIf
EndIf

ImageGadget(0,0,0,640,480,ImageID(0))

Repeat
eventID.l = WaitWindowEvent()
Until EventID = #PB_Event_CloseWindow 
  
CloseWindow(0)
EZTW32_End()
Der Wrapper im Frühstadium

:lol: :lol:

EZTW32.PB

Code: Alles auswählen

; Source generiert durch DLL2PBLib
; Copyright 2005 by Thomas Schulz (TS-Soft)


; Globale Variablen deklaration
Global DllMain.l
Global TWAIN_AbortAllPendingXfers.l
Global TWAIN_AcquireNative.l
Global TWAIN_AcquireToClipboard.l
Global TWAIN_AcquireToFilename.l
Global TWAIN_BreakModalLoop.l
Global TWAIN_CloseSource.l
Global TWAIN_CloseSourceManager.l
Global TWAIN_CreateDibPalette.l
Global TWAIN_DS.l
Global TWAIN_DibDepth.l
Global TWAIN_DibHeight.l
Global TWAIN_DibNumColors.l
Global TWAIN_DibWidth.l
Global TWAIN_DisableSource.l
Global TWAIN_DrawDibToDC.l
Global TWAIN_EasyVersion.l
Global TWAIN_EnableSource.l
Global TWAIN_EndXfer.l
Global TWAIN_ErrorBox.l
Global TWAIN_Fix32ToFloat.l
Global TWAIN_FreeNative.l
Global TWAIN_GetBitDepth.l
Global TWAIN_GetCapCurrent.l
Global TWAIN_GetConditionCode.l
Global TWAIN_GetCurrentResolution.l
Global TWAIN_GetCurrentUnits.l
Global TWAIN_GetHideUI.l
Global TWAIN_GetPixelType.l
Global TWAIN_GetResultCode.l
Global TWAIN_GetYResolution.l
Global TWAIN_IsAvailable.l
Global TWAIN_LoadNativeFromFile.l
Global TWAIN_LoadNativeFromFilename.l
Global TWAIN_LoadSourceManager.l
Global TWAIN_MessageHook.l
Global TWAIN_Mgr.l
Global TWAIN_ModalEventLoop.l
Global TWAIN_NegotiatePixelTypes.l
Global TWAIN_NegotiateXferCount.l
Global TWAIN_OpenDefaultSource.l
Global TWAIN_OpenSourceManager.l
Global TWAIN_RegisterApp.l
Global TWAIN_ReportLastError.l
Global TWAIN_SelectImageSource.l
Global TWAIN_SetBitDepth.l
Global TWAIN_SetBrightness.l
Global TWAIN_SetCapOneValue.l
Global TWAIN_SetContrast.l
Global TWAIN_SetCurrentPixelType.l
Global TWAIN_SetCurrentResolution.l
Global TWAIN_SetCurrentUnits.l
Global TWAIN_SetHideUI.l
Global TWAIN_SetXferMech.l
Global TWAIN_State.l
Global TWAIN_ToFix32.l
Global TWAIN_UnloadSourceManager.l
Global TWAIN_WaitForNativeXfer.l
Global TWAIN_WriteDibToFile.l
Global TWAIN_WriteNativeToFile.l
Global TWAIN_WriteNativeToFilename.l
Global TWAIN_XferMech.l

; Init-Funktion
ProcedureDLL EZTW32_Init()
  Shared DLL.l
  DLL = LoadLibrary_("EZTW32.DLL")
  If DLL
    DllMain = GetProcAddress_(DLL, "DllMain")
    TWAIN_AbortAllPendingXfers = GetProcAddress_(DLL, "TWAIN_AbortAllPendingXfers")
    TWAIN_AcquireNative = GetProcAddress_(DLL, "TWAIN_AcquireNative")
    TWAIN_AcquireToClipboard = GetProcAddress_(DLL, "TWAIN_AcquireToClipboard")
    TWAIN_AcquireToFilename = GetProcAddress_(DLL, "TWAIN_AcquireToFilename")
    TWAIN_BreakModalLoop = GetProcAddress_(DLL, "TWAIN_BreakModalLoop")
    TWAIN_CloseSource = GetProcAddress_(DLL, "TWAIN_CloseSource")
    TWAIN_CloseSourceManager = GetProcAddress_(DLL, "TWAIN_CloseSourceManager")
    TWAIN_CreateDibPalette = GetProcAddress_(DLL, "TWAIN_CreateDibPalette")
    TWAIN_DS = GetProcAddress_(DLL, "TWAIN_DS")
    TWAIN_DibDepth = GetProcAddress_(DLL, "TWAIN_DibDepth")
    TWAIN_DibHeight = GetProcAddress_(DLL, "TWAIN_DibHeight")
    TWAIN_DibNumColors = GetProcAddress_(DLL, "TWAIN_DibNumColors")
    TWAIN_DibWidth = GetProcAddress_(DLL, "TWAIN_DibWidth")
    TWAIN_DisableSource = GetProcAddress_(DLL, "TWAIN_DisableSource")
    TWAIN_DrawDibToDC = GetProcAddress_(DLL, "TWAIN_DrawDibToDC")
    TWAIN_EasyVersion = GetProcAddress_(DLL, "TWAIN_EasyVersion")
    TWAIN_EnableSource = GetProcAddress_(DLL, "TWAIN_EnableSource")
    TWAIN_EndXfer = GetProcAddress_(DLL, "TWAIN_EndXfer")
    TWAIN_ErrorBox = GetProcAddress_(DLL, "TWAIN_ErrorBox")
    TWAIN_Fix32ToFloat = GetProcAddress_(DLL, "TWAIN_Fix32ToFloat")
    TWAIN_FreeNative = GetProcAddress_(DLL, "TWAIN_FreeNative")
    TWAIN_GetBitDepth = GetProcAddress_(DLL, "TWAIN_GetBitDepth")
    TWAIN_GetCapCurrent = GetProcAddress_(DLL, "TWAIN_GetCapCurrent")
    TWAIN_GetConditionCode = GetProcAddress_(DLL, "TWAIN_GetConditionCode")
    TWAIN_GetCurrentResolution = GetProcAddress_(DLL, "TWAIN_GetCurrentResolution")
    TWAIN_GetCurrentUnits = GetProcAddress_(DLL, "TWAIN_GetCurrentUnits")
    TWAIN_GetHideUI = GetProcAddress_(DLL, "TWAIN_GetHideUI")
    TWAIN_GetPixelType = GetProcAddress_(DLL, "TWAIN_GetPixelType")
    TWAIN_GetResultCode = GetProcAddress_(DLL, "TWAIN_GetResultCode")
    TWAIN_GetYResolution = GetProcAddress_(DLL, "TWAIN_GetYResolution")
    TWAIN_IsAvailable = GetProcAddress_(DLL, "TWAIN_IsAvailable")
    TWAIN_LoadNativeFromFile = GetProcAddress_(DLL, "TWAIN_LoadNativeFromFile")
    TWAIN_LoadNativeFromFilename = GetProcAddress_(DLL, "TWAIN_LoadNativeFromFilename")
    TWAIN_LoadSourceManager = GetProcAddress_(DLL, "TWAIN_LoadSourceManager")
    TWAIN_MessageHook = GetProcAddress_(DLL, "TWAIN_MessageHook")
    TWAIN_Mgr = GetProcAddress_(DLL, "TWAIN_Mgr")
    TWAIN_ModalEventLoop = GetProcAddress_(DLL, "TWAIN_ModalEventLoop")
    TWAIN_NegotiatePixelTypes = GetProcAddress_(DLL, "TWAIN_NegotiatePixelTypes")
    TWAIN_NegotiateXferCount = GetProcAddress_(DLL, "TWAIN_NegotiateXferCount")
    TWAIN_OpenDefaultSource = GetProcAddress_(DLL, "TWAIN_OpenDefaultSource")
    TWAIN_OpenSourceManager = GetProcAddress_(DLL, "TWAIN_OpenSourceManager")
    TWAIN_RegisterApp = GetProcAddress_(DLL, "TWAIN_RegisterApp")
    TWAIN_ReportLastError = GetProcAddress_(DLL, "TWAIN_ReportLastError")
    TWAIN_SelectImageSource = GetProcAddress_(DLL, "TWAIN_SelectImageSource")
    TWAIN_SetBitDepth = GetProcAddress_(DLL, "TWAIN_SetBitDepth")
    TWAIN_SetBrightness = GetProcAddress_(DLL, "TWAIN_SetBrightness")
    TWAIN_SetCapOneValue = GetProcAddress_(DLL, "TWAIN_SetCapOneValue")
    TWAIN_SetContrast = GetProcAddress_(DLL, "TWAIN_SetContrast")
    TWAIN_SetCurrentPixelType = GetProcAddress_(DLL, "TWAIN_SetCurrentPixelType")
    TWAIN_SetCurrentResolution = GetProcAddress_(DLL, "TWAIN_SetCurrentResolution")
    TWAIN_SetCurrentUnits = GetProcAddress_(DLL, "TWAIN_SetCurrentUnits")
    TWAIN_SetHideUI = GetProcAddress_(DLL, "TWAIN_SetHideUI")
    TWAIN_SetXferMech = GetProcAddress_(DLL, "TWAIN_SetXferMech")
    TWAIN_State = GetProcAddress_(DLL, "TWAIN_State")
    TWAIN_ToFix32 = GetProcAddress_(DLL, "TWAIN_ToFix32")
    TWAIN_UnloadSourceManager = GetProcAddress_(DLL, "TWAIN_UnloadSourceManager")
    TWAIN_WaitForNativeXfer = GetProcAddress_(DLL, "TWAIN_WaitForNativeXfer")
    TWAIN_WriteDibToFile = GetProcAddress_(DLL, "TWAIN_WriteDibToFile")
    TWAIN_WriteNativeToFile = GetProcAddress_(DLL, "TWAIN_WriteNativeToFile")
    TWAIN_WriteNativeToFilename = GetProcAddress_(DLL, "TWAIN_WriteNativeToFilename")
    TWAIN_XferMech = GetProcAddress_(DLL, "TWAIN_XferMech")
  EndIf
EndProcedure
; End-Funktion
ProcedureDLL EZTW32_End()
  Shared DLL.l
  FreeLibrary_(DLL)
EndProcedure
; Allgemeine Funktionen
ProcedureDLL.l DllMain(a.l,b.l,c.l)
  ProcedureReturn CallFunctionFast(DllMain,a,b,c)
EndProcedure

ProcedureDLL.l TWAIN_AbortAllPendingXfers()
  ProcedureReturn CallFunctionFast(TWAIN_AbortAllPendingXfers)
EndProcedure

ProcedureDLL.l TWAIN_AcquireNative(a.l,b.l)
  ProcedureReturn CallFunctionFast(TWAIN_AcquireNative,a,b)
EndProcedure

ProcedureDLL.l TWAIN_AcquireToClipboard(a.l,b.l)
  ProcedureReturn CallFunctionFast(TWAIN_AcquireToClipboard,a,b)
EndProcedure

ProcedureDLL.l TWAIN_AcquireToFilename(a.l,b.l)
  ProcedureReturn CallFunctionFast(TWAIN_AcquireToFilename,a,b)
EndProcedure

ProcedureDLL.l TWAIN_BreakModalLoop()
  ProcedureReturn CallFunctionFast(TWAIN_BreakModalLoop)
EndProcedure

ProcedureDLL.l TWAIN_CloseSource()
  ProcedureReturn CallFunctionFast(TWAIN_CloseSource)
EndProcedure

ProcedureDLL.l TWAIN_CloseSourceManager(a.l)
  ProcedureReturn CallFunctionFast(TWAIN_CloseSourceManager,a)
EndProcedure

ProcedureDLL.l TWAIN_CreateDibPalette(a.l)
  ProcedureReturn CallFunctionFast(TWAIN_CreateDibPalette,a)
EndProcedure

ProcedureDLL.l TWAIN_DS(a.l,b.l,c.l,d.l)
  ProcedureReturn CallFunctionFast(TWAIN_DS,a,b,c,d)
EndProcedure

ProcedureDLL.l TWAIN_DibDepth(a.l)
  ProcedureReturn CallFunctionFast(TWAIN_DibDepth,a)
EndProcedure

ProcedureDLL.l TWAIN_DibHeight(a.l)
  ProcedureReturn CallFunctionFast(TWAIN_DibHeight,a)
EndProcedure

ProcedureDLL.l TWAIN_DibNumColors(a.l)
  ProcedureReturn CallFunctionFast(TWAIN_DibNumColors,a)
EndProcedure

ProcedureDLL.l TWAIN_DibWidth(a.l)
  ProcedureReturn CallFunctionFast(TWAIN_DibWidth,a)
EndProcedure

ProcedureDLL.l TWAIN_DisableSource()
  ProcedureReturn CallFunctionFast(TWAIN_DisableSource)
EndProcedure

ProcedureDLL.l TWAIN_DrawDibToDC(a.l,b.l,c.l,d.l,e.l,f.l,g.l,h.l)
  ProcedureReturn CallFunctionFast(TWAIN_DrawDibToDC,a,b,c,d,e,f,g,h)
EndProcedure

ProcedureDLL.l TWAIN_EasyVersion()
  ProcedureReturn CallFunctionFast(TWAIN_EasyVersion)
EndProcedure

ProcedureDLL.l TWAIN_EnableSource(a.l)
  ProcedureReturn CallFunctionFast(TWAIN_EnableSource,a)
EndProcedure

ProcedureDLL.l TWAIN_EndXfer()
  ProcedureReturn CallFunctionFast(TWAIN_EndXfer)
EndProcedure

ProcedureDLL.l TWAIN_ErrorBox(a.l)
  ProcedureReturn CallFunctionFast(TWAIN_ErrorBox,a)
EndProcedure

ProcedureDLL.l TWAIN_Fix32ToFloat(a.l)
  ProcedureReturn CallFunctionFast(TWAIN_Fix32ToFloat,a)
EndProcedure

ProcedureDLL.l TWAIN_FreeNative(a.l)
  ProcedureReturn CallFunctionFast(TWAIN_FreeNative,a)
EndProcedure

ProcedureDLL.l TWAIN_GetBitDepth()
  ProcedureReturn CallFunctionFast(TWAIN_GetBitDepth)
EndProcedure

ProcedureDLL.l TWAIN_GetCapCurrent(a.l,b.l,c.l)
  ProcedureReturn CallFunctionFast(TWAIN_GetCapCurrent,a,b,c)
EndProcedure

ProcedureDLL.l TWAIN_GetConditionCode()
  ProcedureReturn CallFunctionFast(TWAIN_GetConditionCode)
EndProcedure

ProcedureDLL.l TWAIN_GetCurrentResolution()
  ProcedureReturn CallFunctionFast(TWAIN_GetCurrentResolution)
EndProcedure

ProcedureDLL.l TWAIN_GetCurrentUnits()
  ProcedureReturn CallFunctionFast(TWAIN_GetCurrentUnits)
EndProcedure

ProcedureDLL.l TWAIN_GetHideUI()
  ProcedureReturn CallFunctionFast(TWAIN_GetHideUI)
EndProcedure

ProcedureDLL.l TWAIN_GetPixelType()
  ProcedureReturn CallFunctionFast(TWAIN_GetPixelType)
EndProcedure

ProcedureDLL.l TWAIN_GetResultCode()
  ProcedureReturn CallFunctionFast(TWAIN_GetResultCode)
EndProcedure

ProcedureDLL.l TWAIN_GetYResolution()
  ProcedureReturn CallFunctionFast(TWAIN_GetYResolution)
EndProcedure

ProcedureDLL.l TWAIN_IsAvailable()
  ProcedureReturn CallFunctionFast(TWAIN_IsAvailable)
EndProcedure

ProcedureDLL.l TWAIN_LoadNativeFromFile(a.l)
  ProcedureReturn CallFunctionFast(TWAIN_LoadNativeFromFile,a)
EndProcedure

ProcedureDLL.l TWAIN_LoadNativeFromFilename(a.l)
  ProcedureReturn CallFunctionFast(TWAIN_LoadNativeFromFilename,a)
EndProcedure

ProcedureDLL.l TWAIN_LoadSourceManager()
  ProcedureReturn CallFunctionFast(TWAIN_LoadSourceManager)
EndProcedure

ProcedureDLL.l TWAIN_MessageHook(a.l)
  ProcedureReturn CallFunctionFast(TWAIN_MessageHook,a)
EndProcedure

ProcedureDLL.l TWAIN_Mgr(a.l,b.l,c.l,d.l)
  ProcedureReturn CallFunctionFast(TWAIN_Mgr,a,b,c,d)
EndProcedure

ProcedureDLL.l TWAIN_ModalEventLoop()
  ProcedureReturn CallFunctionFast(TWAIN_ModalEventLoop)
EndProcedure

ProcedureDLL.l TWAIN_NegotiatePixelTypes(a.l)
  ProcedureReturn CallFunctionFast(TWAIN_NegotiatePixelTypes,a)
EndProcedure

ProcedureDLL.l TWAIN_NegotiateXferCount(a.l)
  ProcedureReturn CallFunctionFast(TWAIN_NegotiateXferCount,a)
EndProcedure

ProcedureDLL.l TWAIN_OpenDefaultSource()
  ProcedureReturn CallFunctionFast(TWAIN_OpenDefaultSource)
EndProcedure

ProcedureDLL.l TWAIN_OpenSourceManager(a.l)
  ProcedureReturn CallFunctionFast(TWAIN_OpenSourceManager,a)
EndProcedure

ProcedureDLL.l TWAIN_RegisterApp(a.l,b.l,c.l,d.l,e.l,f.l,g.l,h.l)
  ProcedureReturn CallFunctionFast(TWAIN_RegisterApp,a,b,c,d,e,f,g,h)
EndProcedure

ProcedureDLL.l TWAIN_ReportLastError(a.l)
  ProcedureReturn CallFunctionFast(TWAIN_ReportLastError,a)
EndProcedure

ProcedureDLL.l TWAIN_SelectImageSource(a.l)
  ProcedureReturn CallFunctionFast(TWAIN_SelectImageSource,a)
EndProcedure

ProcedureDLL.l TWAIN_SetBitDepth(a.l)
  ProcedureReturn CallFunctionFast(TWAIN_SetBitDepth,a)
EndProcedure

ProcedureDLL.l TWAIN_SetBrightness(a.l,b.l)
  ProcedureReturn CallFunctionFast(TWAIN_SetBrightness,a,b)
EndProcedure

ProcedureDLL.l TWAIN_SetCapOneValue(a.l,b.l,c.l)
  ProcedureReturn CallFunctionFast(TWAIN_SetCapOneValue,a,b,c)
EndProcedure

ProcedureDLL.l TWAIN_SetContrast(a.l,b.l)
  ProcedureReturn CallFunctionFast(TWAIN_SetContrast,a,b)
EndProcedure

ProcedureDLL.l TWAIN_SetCurrentPixelType(a.l)
  ProcedureReturn CallFunctionFast(TWAIN_SetCurrentPixelType,a)
EndProcedure

ProcedureDLL.l TWAIN_SetCurrentResolution(a.l,b.l)
  ProcedureReturn CallFunctionFast(TWAIN_SetCurrentResolution,a,b)
EndProcedure

ProcedureDLL.l TWAIN_SetCurrentUnits(a.l)
  ProcedureReturn CallFunctionFast(TWAIN_SetCurrentUnits,a)
EndProcedure

ProcedureDLL.l TWAIN_SetHideUI(a.l)
  ProcedureReturn CallFunctionFast(TWAIN_SetHideUI,a)
EndProcedure

ProcedureDLL.l TWAIN_SetXferMech(a.l)
  ProcedureReturn CallFunctionFast(TWAIN_SetXferMech,a)
EndProcedure

ProcedureDLL.l TWAIN_State()
  ProcedureReturn CallFunctionFast(TWAIN_State)
EndProcedure

ProcedureDLL.l TWAIN_ToFix32(a.l,b.l)
  ProcedureReturn CallFunctionFast(TWAIN_ToFix32,a,b)
EndProcedure

ProcedureDLL.l TWAIN_UnloadSourceManager()
  ProcedureReturn CallFunctionFast(TWAIN_UnloadSourceManager)
EndProcedure

ProcedureDLL.l TWAIN_WaitForNativeXfer(a.l)
  ProcedureReturn CallFunctionFast(TWAIN_WaitForNativeXfer,a)
EndProcedure

ProcedureDLL.l TWAIN_WriteDibToFile(a.l,b.l)
  ProcedureReturn CallFunctionFast(TWAIN_WriteDibToFile,a,b)
EndProcedure

ProcedureDLL.l TWAIN_WriteNativeToFile(a.l,b.s)
  ProcedureReturn CallFunctionFast(TWAIN_WriteNativeToFile,a,b)
EndProcedure

ProcedureDLL.l TWAIN_WriteNativeToFilename(a.l,b.l)
  ProcedureReturn CallFunctionFast(TWAIN_WriteNativeToFilename,a,b)
EndProcedure

ProcedureDLL.l TWAIN_XferMech()
  ProcedureReturn CallFunctionFast(TWAIN_XferMech)
EndProcedure

Verfasst: 14.03.2006 01:00
von ts-soft
>> Ein Wrapper ist leicht mit ts-soft seiner DLL2Lib erstellt
DLL2Lib ist von Binary Soft Inc

Aber vielleicht meinste ja doch mein DLL2PBLib :freak:

Verfasst: 12.12.2007 23:59
von scholly
Falko hat geschrieben:Viel Spass beim ausprobieren
Ich hab über den Quelle-Requester herausbekommen, daß mein Scanner als Flachbett Scanner 101.25199 (32-32) identifiziert wird.

Gibt es irgendeinen Weg/eine Funktion, die ich nicht erkenne, mit der ich direkt abfragen kann, ob dieser Scanner an oder aus ist (Rückgabe TRUE oder FALSE) ?

mDv... scholly