Twain_DSM
1.0
|
Impl Class to hold list of connected applications. More...
Classes | |
struct | _pod |
We use a pod (Pieces of Data) system because it help prevents us from making dumb initialization mistakes. More... | |
Public Member Functions | |
CTwnDsmAppsImpl () | |
Our CTwnDsmAppsImpl constructor. | |
int | scanDSDir (char *_szAbsPath, TW_IDENTITY *_pAppId) |
Scan for Data Sources. More... | |
const char * | StringFromCC (const TW_UINT16 cc) |
Translates the cc passed in into a string and returns it. More... | |
TW_INT16 | LoadDS (TW_IDENTITY *_pAppId, char *_pPath, TWID_T _DsId, bool _boolKeepOpen) |
Loads a DS from disk and adds it to a global list of DS's. More... | |
void | AppSetConditionCode (TW_IDENTITY *_pAppId, TW_UINT16 _ConditionCode) |
Set the condition code. More... | |
Public Attributes | |
struct CTwnDsmAppsImpl::_pod | pod |
Pieces of data for CTwnDsmAppsImpl. | |
CAppList | m_AppInfo |
list of applications. | |
Impl Class to hold list of connected applications.
In 32bit enviroments each application will connect to a seperate instance of DSM data but with this list it allows ONE application to connect several time, as long as it uses a different name with each connection. I'm still not sure why you'd want to do that, but there it is. This class is intended to hide the gory details of how we're storing the data, so an impl is used.
void CTwnDsmAppsImpl::AppSetConditionCode | ( | TW_IDENTITY * | _pAppId, |
TW_UINT16 | _ConditionCode | ||
) |
Set the condition code.
[in] | _pAppId | Origin of message |
[in] | _ConditionCode | new code to remember |
The same rules apply here as they do for AppGetConditionCode. This is the implemenation function.
Definition at line 660 of file apps.cpp.
Referenced by CTwnDsmApps::AppSetConditionCode().
TW_INT16 CTwnDsmAppsImpl::LoadDS | ( | TW_IDENTITY * | _pAppId, |
char * | _pPath, | ||
TWID_T | _DsId, | ||
bool | _boolKeepOpen | ||
) |
Loads a DS from disk and adds it to a global list of DS's.
Load a driver.
[in] | _pAppId | Origin of message |
[in] | _pPath | The path to the library to open |
[in] | _DsId | the source array index |
[in] | _boolKeepOpen | if set to true keeps DS open after successful load |
This is the implementation function. We use this both to browse for drivers during MSG_GETFIRST/MSG_GETNEXT and to load a specific driver during MSG_OPENDS. Which is why we need the path and the keep open flag...
int CTwnDsmAppsImpl::scanDSDir | ( | char * | _szAbsPath, |
TW_IDENTITY * | _pAppId | ||
) |
Scan for Data Sources.
Find all of the drivers.
Recursively navigate the TWAIN datasource dir looking for data sources. Store all valid data sources in _pList upto a maximum of MAX_NUM_DS data sources.
[in] | _szAbsPath | starting directory to begin search. |
[out] | _pAppId | the application requesting scan. |
We recursively descend into the driver directory, looking for files with a .ds extension, opening them and getting their TW_IDENTITY. Which is why it's critical that drivers do as little as possible during this operation. It's easy to know when it's happening, because the application's TW_IDENTITY is empty, which is the hint that the DSM is browsing...
const char * CTwnDsmAppsImpl::StringFromCC | ( | const TW_UINT16 | cc | ) |