This project has moved. For the latest updates, please go here.

Error in Win8 64bit.

Jul 15, 2014 at 3:18 AM
Edited Jul 15, 2014 at 3:23 AM
Hi Saraff,

Got an error and can't fix it when I am working in windows8 64bit. I built your samples in vs 2013 and all set to .net 4.5 for x64 bit. Run it fine, however scan documents it shows those error below. An image has been attached. Could you please let me know how to make it work? Thanks
Please see image here:
http://postimg.org/image/ecjcgfiyl/full/

Image
Coordinator
Jul 15, 2014 at 9:21 AM
Hello, xiaoyuewanli!
This error is caused by your actions. NullReferenceException was throw from the fact that the variable was not initialized _bmi (line 37). However, the method Marshal.PtrToStructure (IntPtr, Type) can not return null. See Marshal.PtrToStructure (IntPtr, Type)
Jul 15, 2014 at 11:23 PM
Edited Jul 15, 2014 at 11:27 PM
Hi Saraff,

Thanks for your reply. I run the sample 2 downloaded from this website without any change. It runs perfect under any os x86 or x64 in windows7.
When I check it step by step, I find _pBitmap is assigned to 0 in TwainDotNet line 833. Is it normal? It is not 0 if I test in x86. It only happens in Windows 8 64bit and built in x64. Any other ideas? Thanks

L833:
              IntPtr _pBitmap=_Memory.Lock(_hBitmap);
                try {
                    Image _img=null;
                    this._images.Add(_img=DibToImage.WithStream(_pBitmap));
                    this._OnEndXfer(new EndXferEventArgs(_img));
                } finally {
                    _Memory.Unlock(_hBitmap);
                    _Memory.Free(_hBitmap);
                }
                if(this._dsmEntry.DSPendingXfer(this._appid,this._srcds,TwDG.Control,TwDAT.PendingXfers,TwMSG.EndXfer,_pxfr)!=TwRC.Success) {
                    break;
                }
Coordinator
Jul 16, 2014 at 1:55 PM
Hello, xiaoyuewanli!
File TwainDotNet.cs not in my project. This file was a different name. You can see this link itself https://sarafftwain.codeplex.com/SourceControl/latest
Therefore, to update the project and see this topic
The variable _pBitmap should not be equal to 0. Otherwise, it indicates that the scanner has not returned image.
Jul 16, 2014 at 11:19 PM
Edited Jul 16, 2014 at 11:21 PM
Hi Saraff,

Got it. Thanks a lot. This error is not about DSM. I tried that topic.
I have a look and try to fix.