Hi,
I'm testing some TWAIN code (EZTwain Pro). I can scan single and multiple scans direct to TIF files but is has an enormous advantage if I could scan into DIB's - Device Independent Bitmaps. In that way you could scan multiple pages in memory in an array of DIBs. The TWAIN library has also a great and powerful DIB function collection.
But unfortunately everything that stores or handle a DIB let A5v5 crash and burn with Unhandled Exceptions. Never seen these so much as the last few days, :(
It has something to do with global memory and the DIB handle, Xbasic doesn't like them.
To access the information in a DIB you must either lock the DIB handle to obtain a pointer.
e.g. The next code causes a Unhandled Exception Error.
I know that support has stopped on version 5 but who knows a Wizard of OZ comes with a solution.
It is odd that there are lots of file and blob functions but none helped me to get a picture into a Device Context of the USER CONTROL such as the Clock Example. Of course I can use the picture object but then I have to scan everything into separate file of the wrong format (bmp/jpg) and I need tif files.
I'm testing some TWAIN code (EZTwain Pro). I can scan single and multiple scans direct to TIF files but is has an enormous advantage if I could scan into DIB's - Device Independent Bitmaps. In that way you could scan multiple pages in memory in an array of DIBs. The TWAIN library has also a great and powerful DIB function collection.
But unfortunately everything that stores or handle a DIB let A5v5 crash and burn with Unhandled Exceptions. Never seen these so much as the last few days, :(
It has something to do with global memory and the DIB handle, Xbasic doesn't like them.
(Next explanation is coming from the manual)
A DIB consists of a header giving height, width, bits per pixel, resolution, and so forth, followed by a color table if needed, followed by the pixels of the image. Windows stores DIBs in global memory blocks and work with the handles of these blocks. Problem is that these are not pointers.To access the information in a DIB you must either lock the DIB handle to obtain a pointer.
e.g. The next code causes a Unhandled Exception Error.
Code:
[LEFT]'Some new types[/LEFT] declarestruct hdib L1hdib declarestruct hwnd L1hwnd [LEFT]'DLL functions declare Eztwain3 TWAIN_Acquire (hdib)(hwnd) declare Eztwain3 DIB_WriteToFilename L(hdib)C declare Eztwain3 DIB_Free L(hdib)[/LEFT] [LEFT]dim hd as {hdib} hd = TWAIN_Acquire(0) if hd <> 0 then DIB_WriteToFilename(hd, "my_scan.tif") end if DIB_Free(hd)[/LEFT] hd = 0
Such as:
Know some Xbasic code how to get a DIB (Device Independent Bitmap - BMP) into a DDB (Device Dependent Bitmap) or DC. The DC - Device Context is the draw region in a USER CONTROL.Know some code how to use Blobs in conjunction with Bitmaps, DIBs and DDBs. I didn't found the solution in the help files so far.
It is odd that there are lots of file and blob functions but none helped me to get a picture into a Device Context of the USER CONTROL such as the Clock Example. Of course I can use the picture object but then I have to scan everything into separate file of the wrong format (bmp/jpg) and I need tif files.
I read the Dr Wayne papers but so far I had not the magic click in my head.
Comment