问题描述
关于分辨率的部分我自己编写了一个setResolution函数,可是调用之后没有反应,程序不报错但是也进行不下去。不知道哪里写错了,跪求各路大侠指点一下。。代码如下:internalclassTwCapability{//TW_CAPABILITYpublicTwCapability(TwCapcap){Cap=(short)cap;ConType=-1;}publicTwCapability(TwCapcap,shortsval){Cap=(short)cap;ConType=(short)TwOn.One;Handle=Twain.GlobalAlloc(0x42,6);IntPtrpv=Twain.GlobalLock(Handle);Marshal.WriteInt16(pv,0,(short)TwType.Int16);Marshal.WriteInt32(pv,2,(int)sval);Twain.GlobalUnlock(Handle);}~TwCapability(){if(Handle!=IntPtr.Zero)Twain.GlobalFree(Handle);}publicboolsetResolution(TwCapcap,intrval){Cap=(short)cap;ConType=(short)TwOn.Enum;Handle=Twain.GlobalAlloc(0x52,8);IntPtrpv=Twain.GlobalLock(Handle);Marshal.WriteInt32(pv,0,(short)TwType.Fix32);Marshal.WriteInt32(pv,4,(int)rval);Twain.GlobalUnlock(Handle);returntrue;}publicshortCap;publicshortConType;publicIntPtrHandle;}-----------------------------------------------------------------publicvoidAcquire(){TwRCrc;boolresx;boolresy;CloseSrc();if(appid.Id==IntPtr.Zero){Init(hwnd);if(appid.Id==IntPtr.Zero)return;}rc=DSMident(appid,IntPtr.Zero,TwDG.Control,TwDAT.Identity,TwMSG.OpenDS,srcds);if(rc!=TwRC.Success)return;TwCapabilitycap=newTwCapability(TwCap.XferCount,1);resx=cap.setResolution(TwCap.IXResolution,600);resy=cap.setResolution(TwCap.IYResolution,600);rc=DScap(appid,srcds,TwDG.Control,TwDAT.Capability,TwMSG.Set,cap);if(rc!=TwRC.Success||resx||resy){CloseSrc();return;}TwUserInterfaceguif=newTwUserInterface();guif.ShowUI=1;guif.ModalUI=1;guif.ParentHand=hwnd;rc=DSuserif(appid,srcds,TwDG.Control,TwDAT.UserInterface,TwMSG.EnableDS,guif);if(rc!=TwRC.Success){CloseSrc();return;}}//namespaceTwainLib
解决方案
解决方案二:
你好,朋友,你的这个问题解决了吗