All products / Saraff.Twain.DS / Contents
OnProcessRequest
Invoked to processing a TWAIN operations (Triplets).
Syntax
protected virtual TwRC OnProcessRequest(TwDG dg, TwDAT dat, TwMSG msg, IntPtr data)
Parameters
- dg: The Data Group of the operation triplet. Currently, only DG_CONTROL, DG_IMAGE, and DG_AUDIO are defined.
- dat: The Data Argument Type of the operation triplet.
- msg: The Message of the operation triplet.
- data: parameter is a pointer to the data (a variable or, more typically, a structure) that will be used according to the action specified by the operation triplet.
Return Value
TWAIN Return Codes.
Examples
protected override TwRC OnProcessRequest(TwDG dg, TwDAT dat, TwMSG msg, IntPtr data) {
if(dg==TwDG.Image) {
switch(dat) {
case TwDAT.ImageLayout:
return this._ImageLayoutProcessRequest(msg, data);
case TwDAT.ImageInfo:
if((this.State&DataSourceState.Ready)!=0) {
return this._ImageInfoProcessRequest(msg, data);
}
throw new DataSourceException(TwRC.Failure, TwCC.SeqError);
case TwDAT.ImageNativeXfer:
if((this.State&DataSourceState.Ready)!=0) {
return this._ImageNativeXferProcessRequest(msg, data);
}
throw new DataSourceException(TwRC.Failure, TwCC.SeqError);
case TwDAT.ImageMemXfer:
if((this.State&DataSourceState.Ready)!=0) {
return this._ImageMemXferProcessRequest(msg, data, false);
}
throw new DataSourceException(TwRC.Failure, TwCC.SeqError);
case TwDAT.ImageMemFileXfer:
if((this.State&DataSourceState.Ready)!=0) {
return this._ImageMemXferProcessRequest(msg, data, true);
}
throw new DataSourceException(TwRC.Failure, TwCC.SeqError);
case TwDAT.ImageFileXfer:
if((this.State&DataSourceState.Ready)!=0) {
return this._ImageFileXferProcessRequest(msg);
}
throw new DataSourceException(TwRC.Failure, TwCC.SeqError);
}
}
return base.OnProcessRequest(dg, dat, msg, data);
}