亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? imagescanforgood.cpp

?? 圖像掃描類的完整代碼
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
完整的圖像掃描類 
 
 
 
發布時間:2007-11-19 23:37:47.0   瀏覽人數:377 
 
// ctwain.h - application interface to TWAIN Protocol
//
#ifndef CTWAIN_H
#define CTWAIN_H



#include "twain.h"



//結構和用法:
// CTwain 最好作為 mainframe的第二個基類來使用,
// 這樣,回調比較方便,程序也比較緊湊。
//
// RegisterApp 可以填入真實信息。
//
// 0. If !TwainAvailable(), 無twain,菜單被禁止,無須其他處理。
// 1. 在main frame window 建立后(on create),調用SetDefWindow(this), 
// 和 OpenSourceManager()。如果 OpenSourceManager() 失敗,你可以
// 提示用戶twain 出錯(這需要你附加代碼).
// 2. 當State() == SOURCE_MANAGER_OPEN 時,使 Acquire and Select Source 
// 命令可用。
// 3. 在 Acquire 命令響應中,調用 BeginAcquire.
// 4. Override CWnd::PreTranslateMessage(pMsg),加入:
// return (TwainMessageHook(pMsg) ||
// <base class>::PreTranslateMessage(pMsg);
// 5. Override CTwain::DibReceived 處理native transfers返回的dib句柄。
// 注意:在調用BeginAcquire后, 你可以傳輸多幅圖象,data source 
// 始終打開著,若要關閉,調用 CloseSource.
// 可待擴展:Add support for Memory and File transfer(可能不標準).




typedef enum {
NO_TWAIN_STATE, // 0 internal use only
PRE_SESSION, // 1 ground state, nothing loaded
SOURCE_MANAGER_LOADED, // 2 DSM loaded but not open
SOURCE_MANAGER_OPEN, // 3 DSM open
SOURCE_OPEN, // 4 some Source open - Negotiation state!
SOURCE_ENABLED, // 5 acquisition started
TRANSFER_READY, // 6 data ready to transfer
TRANSFERRING // 7 transfer started
} TW_STATE;



typedef enum {
TWERR_OPEN_DSM, // unable to load or open Source Manager
TWERR_OPEN_SOURCE, // unable to open Datasource
TWERR_ENABLE_SOURCE, // unable to enable Datasource
} TW_ERR;



class CTwain
{
public:



BOOL SetPixelType(TW_UINT32 pxlType);
CTwain(void);
~CTwain();



// General notes:
// 1. 一旦source manager 被裝載, 直到對象被釋放才被卸載。
// (或UnloadSourceManager)
// 第一次調用TwainAvailable時裝載 source manager.



// attributes i.e. query functions
int TwainAvailable(void);
// TRUE ,如果 TWAIN Datasource Manager 存在并被裝載。
// 不檢查是否有 datasources!
// 可用IsAvailable 來 enable or disable menu items .



TW_STATE State(void);
// Return the current (presumed) state of the Twain connection.



unsigned ResultCode(void);
// last result code (see twain.h)



unsigned ConditionCode(void);
// retrieve condition code from last triplet - see twain.h.



// Top-level operations
void SetDefWindow(CWnd* pWnd);
//def window 是主窗口。
// If no default window is set, AfxGetMainWnd() is used.



int SelectSource(CWnd* pWnd = NULL);
// Post the standard Select Source dialog



void ModalAcquire(CWnd* pWnd = NULL);
// Acquire images from current or default source.
// By default, displays the u/i of the source and acquires images
// until a CLOSEDSREQ is received from the source.
// Acquire returns the Twain connection to the starting state
// or to SOURCE_ENABLED, whichever is lower.



int BeginAcquire(CWnd* pWnd = NULL);
// Open and enable the default source.
// TRUE if successful, FALSE if something goes wrong.
// If successful, State() == SOURCE_ENABLED.
// You must now pass all messages to MessageHook until the state
// drops below SOURCE_OPEN: In MFC, override PreTranslateMessage.
// If BeginAcquire fails, it returns TWAIN to the state it
// found it in.



void RegisterApp( // Record application information
int nMajorNum, int nMinorNum, // major and incremental revision of application. E.g.
// for version 2.1, nMajorNum == 2 and nMinorNum == 1
int nLanguage, // language of this version (use TWLG_xxx from TWAIN.H)
int nCountry, // country of this version (use TWCY_xxx from TWAIN.H)
LPSTR lpszVersion, // version info string e.g. "1.0b3 Beta release"
LPSTR lpszMfg, // name of manufacturer/developer e.g. "Crazbat Software"
LPSTR lpszFamily, // product family e.g. "BitStomper"
LPSTR lpszProduct); // specific product e.g. "BitStomper Deluxe Pro"
// This is not necessary for acquisition, but is required for full
// TWAIN compliance.



// 內部操作:
int OpenSourceManager(CWnd* pWnd = NULL);
// (Load and) open the Datasource Manager
// Loads the DSM if necessary, opens it if necessary.
// If State >= 3, does nothing and returns TRUE.



int OpenDefaultSource(void);
// Open the default datasource (last source selected in Select Source dialog.)
// Invalid (returns FALSE) if State > 3 (a source is already open)
// Invalid (returns FALSE) if State < 3 (DSM is not open)
// If successful, returns TRUE with State == 4.
// Otherwise, returns FALSE with State unchanged.



void SetShowUI(BOOL bShow = 1);
// Set flag for whether source should be enabled with
// user interface visible (bShow == TRUE) or not.
// At construction, ShowUI is set TRUE.



BOOL GetShowUI(void);
// Return state of ShowUI flag.



int EnableSource(CWnd* pWnd = NULL);
// Enable the open source, which allows image acquisition to begin.
// Invalid if State != 4 (source open).
// If successful, returns TRUE with State == 5.
// Otherwise, returns FALSE with State unchanged.



int DisableSource(void);
// Disable the current source.
// If State == 5, disables the current source and returns TRUE.
// If State < 5, does nothing and returns TRUE.
// If State > 5, does nothing and returns FALSE.



int CloseSource(void);
int CloseSourceManager(CWnd* pWnd = NULL);
int UnloadSourceManager(void);



int DropToState(int nS, CWnd* pWnd = NULL);



// 底層操作
int LoadSourceManager(void);
// loads the DSM (Datasource Manager) into process space



void ModalEventLoop(void);
// get and dispatch messages until source is disabled.



int TwainMessageHook(LPMSG lpmsg);



int EndXfer(void);
// In State 7, ends the current transfer by sending MSG_ENDXFER.
// If successful, goes to State 6 if there are more transfers
// available (pendingXfers != 0), or to State 5 if not.
// Returns TRUE if the resulting State < 7.



int CancelXfers(void);
// In State 6, cancels any pending transfers.
// (In State 7, does an EndXfer first)
// If successful, goes to State 5.
// Returns TRUE if the resulting State < 6.



// DS,SM
int DS(unsigned long dg, unsigned dat, unsigned msg, void FAR *pd);
// send a triplet to the current Datasource.
// returns TRUE if the result code (rc) == RC_SUCCESS, FALSE otherwise.
// Note that this is not meaningful with some triplets.
// Does ASSERT(nState < 4);



int SM(unsigned long dg, unsigned dat, unsigned msg, void FAR *pd);
// Send a triplet to the Source Manager.
// returns TRUE if the result code (rc) == RC_SUCCESS, FALSE otherwise.
// Note that this is not meaningful with some triplets.
// Does ASSERT(nState > 1);



// 回調函數
virtual void XferReady(LPMSG lpmsg);
// called when source has one or more xfers ready
// This default method assumes XferMech = Native,
// gets each native (DIB) image and calls back to DibReceived.



virtual void CloseDsRequest(void);
// called when the open source asks to be 'closed'
// It is sufficient to disable the source on this request,
// but this default handler calls CloseSource.



virtual void DibReceived(HGLOBAL hDib);
// called by the default XferReady handler
// when it has successfully transferred a DIB.
// This default handler just calls GlobalFree(hDib).



virtual void StateChange(int nState);
// called after each Twain State transition.
// nState is the new State. When this callback
// occurs, the state transition has already happened.
// Note - first call is the transition to State 1
// which occurs at construction.



virtual void TwainError(TW_ERR e);
// Called when an unexpected TWAIN malfunction occurs.
// See TW_ERR declaration at beginning of this file.



protected:



void SetState(TW_STATE nS); // assume Twain in State nS



CWnd* DefWnd(CWnd* pWnd = NULL);
// Returns pWnd if it's non-null, otherwise it
// finds a safe non-null default substitute.



BOOL bTrace; // enable TRACE output
TW_STATE nState; // current state
TW_STATE nStartState; // starting state for some operation
TW_IDENTITY AppId; // application identity structure
TW_INT16 rc; // last result code 
TW_USERINTERFACE twUI;
BOOL bShowUI;
TW_PENDINGXFERS pendingXfers;
HANDLE hDib; // bitmap returned by native transfer
CWnd* pDefWnd; // default window
};



#endif




// ctwain.cpp - implementation of a mfc TWAIN class



//進行掃描處理的類 



#include "stdafx.h"
#include "ctwain.h"



#ifdef _DEBUG

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一级黄色大片| 欧美日韩精品欧美日韩精品一| 亚欧色一区w666天堂| 亚洲欧美在线另类| 中文字幕欧美日韩一区| 国产精品视频一二三| 国产精品丝袜黑色高跟| 国产精品色哟哟网站| 欧美国产乱子伦| 国产精品久久精品日日| 自拍偷拍欧美激情| 亚洲一区二区三区在线看| 一区二区三区.www| 午夜激情久久久| 久久国产精品99精品国产 | 国产欧美日韩综合精品一区二区| 日韩精品中文字幕一区二区三区| 欧美一二三在线| 久久久久88色偷偷免费| 国产嫩草影院久久久久| 亚洲精品美国一| 免费人成在线不卡| 国产成人自拍网| 在线视频欧美区| 2023国产一二三区日本精品2022| 欧美国产日本韩| 日韩精品视频网站| 国产成人aaaa| 欧美午夜精品理论片a级按摩| 欧美一级日韩一级| 国产午夜精品一区二区三区嫩草| 一区在线中文字幕| 丝袜诱惑制服诱惑色一区在线观看 | 一区二区三区中文字幕电影| 午夜在线电影亚洲一区| 国产一区二区电影| 欧美少妇一区二区| 国产蜜臀97一区二区三区| 亚洲第一在线综合网站| 国产成人av在线影院| 欧美日本视频在线| 国产精品色一区二区三区| 日韩av电影免费观看高清完整版 | 蜜臀a∨国产成人精品| 91麻豆国产福利在线观看| 日韩一区二区不卡| 亚洲一区二区三区视频在线| 国产精品系列在线播放| 777午夜精品免费视频| 成人欧美一区二区三区小说| 极品少妇一区二区三区精品视频 | 成人久久视频在线观看| 欧美一区二区三区男人的天堂 | 欧美亚洲高清一区| 国产日韩欧美综合一区| 久久精品国产亚洲高清剧情介绍| 91国产丝袜在线播放| 国产精品美女久久久久aⅴ国产馆| 日韩电影在线观看电影| 欧美亚洲丝袜传媒另类| 亚洲日本在线看| 成人福利视频在线| 国产欧美日本一区视频| 久久疯狂做爰流白浆xx| 日韩丝袜情趣美女图片| 日韩国产欧美三级| 在线播放国产精品二区一二区四区| 中文字幕一区二区三区在线观看 | 欧美亚洲国产一区二区三区va | 欧美精品一二三| 亚洲老司机在线| 在线亚洲精品福利网址导航| 亚洲婷婷综合久久一本伊一区| 国产91精品一区二区| 国产色产综合色产在线视频| 国产高清精品网站| 国产精品污污网站在线观看| 国产成人午夜电影网| 国产网站一区二区三区| 国产99久久久国产精品| 国产精品色一区二区三区| 成人精品电影在线观看| 国产精品不卡视频| 一本色道久久综合亚洲精品按摩| 亚洲欧洲另类国产综合| 欧美亚洲免费在线一区| 日韩精品乱码免费| 精品国产乱码久久久久久1区2区| 精品一区二区在线观看| 久久免费国产精品| 成人av影视在线观看| 亚洲少妇30p| 欧美军同video69gay| 奇米在线7777在线精品| 久久毛片高清国产| 色婷婷精品久久二区二区蜜臂av| 一区二区三区精品视频在线| 欧美一区二区三区免费| 国产精品18久久久久| 亚洲婷婷在线视频| 日韩午夜av电影| 99久久久国产精品免费蜜臀| 亚洲综合在线视频| 精品久久人人做人人爰| 成人黄色777网| 婷婷国产在线综合| 久久久久国产一区二区三区四区 | 国产在线观看一区二区| 自拍偷在线精品自拍偷无码专区 | 亚洲人成网站色在线观看| 欧美福利视频导航| 成人免费av资源| 免费观看30秒视频久久| 亚洲色图在线看| 日韩精品一区二| 欧美日韩国产美| 成人sese在线| 久久99国产精品成人| 一区二区成人在线| 久久久久久久久久久久久久久99| 色诱视频网站一区| 国产在线国偷精品产拍免费yy| 一区二区三区在线观看动漫| 久久综合九色综合97婷婷女人| 日本高清不卡一区| 成人激情小说网站| 久久成人免费网| 图片区小说区区亚洲影院| 中文字幕一区二区三区不卡 | 午夜av一区二区| 亚洲欧洲另类国产综合| 久久免费看少妇高潮| 7777精品伊人久久久大香线蕉完整版 | 精品国产乱码久久久久久浪潮| 在线观看免费亚洲| 成人精品小蝌蚪| 国产精品综合在线视频| 免费看欧美女人艹b| 亚洲国产精品一区二区www在线 | 免费在线看成人av| 亚洲已满18点击进入久久| 国产精品少妇自拍| 国产婷婷色一区二区三区| 日韩女优视频免费观看| 欧美人妇做爰xxxⅹ性高电影| 99精品国产一区二区三区不卡| 激情综合网av| 另类综合日韩欧美亚洲| 日韩av电影天堂| 日本不卡一区二区三区| 全国精品久久少妇| 奇米影视7777精品一区二区| 香蕉久久夜色精品国产使用方法| 亚洲精品日日夜夜| 亚洲精品v日韩精品| 亚洲精品第一国产综合野| 一区二区三区四区在线播放| 伊人一区二区三区| 洋洋成人永久网站入口| 亚洲国产视频一区二区| 亚洲国产一区二区视频| 日韩电影一区二区三区| 久久99精品久久久久久国产越南 | 欧美性猛交xxxxxxxx| 欧美日韩在线播放三区四区| 欧美精品久久久久久久多人混战| 欧美日韩夫妻久久| 欧美大胆一级视频| 国产午夜精品久久久久久久 | 精品一区二区精品| 国产91综合网| 色久综合一二码| 欧美精品日日鲁夜夜添| 欧美va亚洲va在线观看蝴蝶网| 久久综合九色综合97婷婷| 欧美国产成人在线| 亚洲中国最大av网站| 日本不卡视频一二三区| 国产精品一区久久久久| 91捆绑美女网站| 欧美日韩国产a| 日本一区二区三区dvd视频在线| 亚洲色图清纯唯美| 美女视频黄免费的久久| 国产精品一区2区| 在线看国产日韩| 26uuu亚洲综合色| 亚洲毛片av在线| 激情综合五月婷婷| 91福利小视频| 久久久精品天堂| 亚洲愉拍自拍另类高清精品| 久久精品免费看| 色先锋资源久久综合| 欧美一区二区三区的| 中文字幕人成不卡一区| 精品一二三四区| 欧美日韩中文字幕一区二区| 国产欧美精品一区aⅴ影院| 午夜久久久久久久久|