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

about OpenDSM

Jul 17, 2014 at 3:12 AM
Hey Saraff...

在 Saraff.Twain.Twain32.OpenDSM() 位置 D:\My Documents\Downloads\sarafftwain-34054\trunk\Twain32.cs:行号 147
在 zcst_rz.SaraffCore.ScanPanel..ctor() 位置 D:\My Documents\Visual Studio 2010\Projects\zcst_rz\zcst_rz\SaraffCore\ScanPanel.cs:行号 128
在 zcst_rz.Controls.ZzsRz.btn_getresult_Click(Object sender, EventArgs e) 位置 D:\My Documents\Visual Studio 2010\Projects\zcst_rz\zcst_rz\Controls\ZzsRz.cs:行号 707
在 System.Windows.Forms.Control.OnClick(EventArgs e)
在 System.Windows.Forms.Button.OnClick(EventArgs e)
在 System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
在 System.Windows.Forms.Control.WndProc(Message& m)
在 System.Windows.Forms.ButtonBase.WndProc(Message& m)
在 System.Windows.Forms.Button.WndProc(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
在 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
在 System.Windows.Forms.Application.Run(Form mainForm)
在 zcst_rz.Program.Main() 位置 D:\My Documents\Visual Studio 2010\Projects\zcst_rz\zcst_rz\Program.cs:行号 28
在 System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
在 System.Threading.ThreadHelper.ThreadStart()
Coordinator
Jul 17, 2014 at 9:03 AM
Hello, JohnnyLeung!
And what exception (type) and the message?
Jul 17, 2014 at 3:33 PM
Hello SARAFF!
this ERROR is at add your dll to my application.
so
i finded reasons
your dll at 64 bit ,if scan not have any paper,dont run _twain32_AcquireCompleted().
but my application need your dll
s scan status, at this time,my application is crash.

and i write a function in your dll,create a new eventargs.
at your EnableSource end, if enablesource is false,i will active eventargs.ask to my application.
the problem is fixed.

:-)
Coordinator
Jul 17, 2014 at 6:12 PM
Hello, JohnnyLeung!
I think that this problem can be solved in another way.
private bool _isEnable=false;

private void button1_Click(object sender,EventArgs e) {
    try {
        this._isEnable=false;
        this._twain.Acquire();
        if(!this._isEnable) {
            // <<< _EnableDataSource is false
        }
    } catch(Exception ex) {
        MessageBox.Show(ex.Message,"SAMPLE1",MessageBoxButtons.OK,MessageBoxIcon.Error);
    }
}

private void _twain_TwainStateChanged(object sender,Twain32.TwainStateEventArgs e) {
    try {
        if((e.TwainState&Twain32.TwainStateFlag.DSEnabled)!=0) {
            this._isEnable=true;
        }
    } catch(Exception ex) {
        MessageBox.Show(ex.Message,"SAMPLE1",MessageBoxButtons.OK,MessageBoxIcon.Error);
    }
}
However, you need to update your project to version 1.0.11.376 (https://sarafftwain.codeplex.com/SourceControl/latest).
Marked as answer by JohnnyLeung on 7/18/2014 at 8:17 PM
Jul 17, 2014 at 6:37 PM
Hey
i will try it
thx