亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
精品国产乱码久久久久久久| 久久99精品国产.久久久久久| 亚洲成av人片一区二区梦乃| 精品一区二区在线看| 成人国产视频在线观看| 色婷婷亚洲精品| 久久久精品免费观看| 亚洲欧洲日韩综合一区二区| 久久精品国产在热久久| 欧美性生交片4| 国产精品福利一区二区三区| 精品一区二区三区在线观看国产| 在线精品视频一区二区| 国产精品无遮挡| 久久精品国产秦先生| 欧美性高清videossexo| 最近日韩中文字幕| 懂色av一区二区夜夜嗨| 精品免费日韩av| 美腿丝袜亚洲综合| 制服.丝袜.亚洲.中文.综合| 亚洲国产一区二区三区| 91视频观看视频| 国产精品久久夜| 大胆欧美人体老妇| 国产欧美日韩视频在线观看| 国产一区二区三区在线观看精品| 日韩视频永久免费| 理论电影国产精品| 日韩欧美一级特黄在线播放| 日韩二区三区在线观看| 日本一区二区久久| 国产日韩v精品一区二区| 成人一区二区视频| 国产毛片一区二区| 久久精品国产精品青草| 欧美一区二区在线不卡| 日本不卡一区二区三区高清视频| 欧美日韩美少妇| 亚洲123区在线观看| 欧美日韩大陆在线| 日韩精品欧美精品| 日韩视频免费观看高清在线视频| 蜜臀av性久久久久蜜臀aⅴ | 国产亚洲精品aa午夜观看| 韩国午夜理伦三级不卡影院| 日韩精品中文字幕在线不卡尤物| 久久av中文字幕片| 国产日韩欧美综合一区| 成人免费高清在线| 亚洲最色的网站| 欧美综合亚洲图片综合区| 欧美三级中文字幕在线观看| 亚洲综合视频在线| 4hu四虎永久在线影院成人| 免费在线视频一区| 欧美韩国日本不卡| 色综合久久综合| 亚洲亚洲精品在线观看| 日韩精品一区二区三区三区免费| 国产呦精品一区二区三区网站| 中文字幕欧美区| 91高清视频免费看| 美女在线视频一区| 亚洲欧美在线另类| 欧美一区二区日韩一区二区| 国内精品国产成人国产三级粉色 | 成人综合日日夜夜| 伊人开心综合网| 精品国产一区二区三区忘忧草| 国产成人精品在线看| 亚洲综合男人的天堂| 日韩欧美在线123| fc2成人免费人成在线观看播放| 亚洲国产成人91porn| 久久亚洲一级片| 色天使色偷偷av一区二区| 韩国精品久久久| 亚洲一区二区三区四区的| 久久在线观看免费| 欧美天天综合网| 风间由美一区二区三区在线观看 | 亚洲无线码一区二区三区| 国产亚洲午夜高清国产拍精品| 91在线视频播放地址| 久久99久久久久久久久久久| 亚洲免费在线观看| 久久精品亚洲乱码伦伦中文 | 日韩欧美你懂的| 一本久久a久久免费精品不卡| 国产在线一区观看| 天天av天天翘天天综合网色鬼国产| 欧美国产精品专区| 精品国产一二三区| 欧美精品第一页| 欧洲一区二区三区在线| www.日韩精品| 国产精品99久久久久久宅男| 青青草国产精品97视觉盛宴| 亚洲影院在线观看| 亚洲人成网站影音先锋播放| 久久久亚洲国产美女国产盗摄 | 亚洲成人一区在线| 蜜桃视频第一区免费观看| 亚洲欧洲成人精品av97| 国产视频在线观看一区二区三区| 日韩午夜av一区| 91精品国产色综合久久ai换脸| 欧亚洲嫩模精品一区三区| 91在线观看污| 一本色道久久综合亚洲91| 一本一道综合狠狠老| 不卡视频在线观看| 99久久伊人精品| kk眼镜猥琐国模调教系列一区二区 | 日韩一区精品字幕| 日韩精品91亚洲二区在线观看| 亚洲成人av一区二区三区| 亚洲成精国产精品女| 午夜精品久久久久久久久久 | 国产精品少妇自拍| 国产精品国产三级国产普通话三级| 国产婷婷精品av在线| 国产女同性恋一区二区| 欧美精品久久久久久久久老牛影院| 国模冰冰炮一区二区| 欧美国产1区2区| 中文字幕久久午夜不卡| 中文字幕一区二区视频| 亚洲天堂av老司机| 一个色在线综合| 三级久久三级久久久| 久久精品99久久久| 国产伦精品一区二区三区免费迷| 国产精品18久久久久久vr| 成人av在线资源网| 欧美午夜电影网| 日韩欧美综合在线| 国产精品乱码久久久久久| 一区二区在线免费| 麻豆freexxxx性91精品| 丁香啪啪综合成人亚洲小说 | 亚洲香肠在线观看| 琪琪一区二区三区| 国产大陆亚洲精品国产| aaa欧美色吧激情视频| 欧美日本在线看| 久久免费视频色| 欧美二区乱c少妇| 91麻豆精品国产91久久久更新时间| 国产精品亚洲成人| 丁香五精品蜜臀久久久久99网站| av成人免费在线| 欧美日韩性生活| 欧美国产一区视频在线观看| 亚洲永久精品国产| 久久99国产精品久久| 91色乱码一区二区三区| 3d成人动漫网站| 国产精品不卡一区二区三区| 亚洲成av人片一区二区三区| 国产99久久久久久免费看农村| 91精品福利视频| 2024国产精品| 亚洲电影一级黄| 波波电影院一区二区三区| 欧美午夜精品久久久久久孕妇| 久久综合色之久久综合| 亚洲一二三专区| www.色综合.com| 精品999久久久| 视频一区二区三区在线| 99国产精品久久久| 日韩视频永久免费| 亚洲在线观看免费视频| 成人av在线一区二区三区| 欧美一级黄色片| 成人免费视频在线观看| 国产一区二区美女诱惑| 欧美一区二区二区| 亚洲一区在线观看视频| 9i看片成人免费高清| 久久久久99精品一区| 久久狠狠亚洲综合| 91麻豆精品国产自产在线观看一区| 亚洲精品自拍动漫在线| 成人黄色a**站在线观看| 久久奇米777| 久久精品国产99国产| 欧美一级搡bbbb搡bbbb| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 欧美日韩一区二区三区四区| 国产精品灌醉下药二区| 高清shemale亚洲人妖| 久久久一区二区| 国产美女精品人人做人人爽| 精品av久久707| 国产一区二区三区美女| 久久奇米777| 国产iv一区二区三区|