Home › Forums › TWAIN Classic › Building TWAIN Data Sources using MFC Libraries
- This topic has 1 reply, 2 voices, and was last updated 18 years, 4 months ago by ajayld.
- AuthorPosts
HI.
I develop a data source which implements the TWAIN interface from twain.org so I can use it as data source for photoshop or something similar. My source uses some dialog windows that are easy to build using Mircosoft’s MFC Framework. The code I’m trying with compiles fine but the TWAIN Datasource Manager does not communicate with my file. I placed a debug message within the DS_Entry method that at least should appear in the debug console of visual studio when the source manager lists all available data sources.I think there is missing something. My dll exports DS_Entry correct i think – a dll explorer can find it. Maybe theres somebody around how can help me…
The project is setup as ‘shared mfc-dll’.
As you’ll see i kept the visual studio generated code as it was and only added DS_Entry, the export statement and included “twain.h”.
Here i have some code so u can see whats going on:
/** mfc.twain.def **/
LIBRARY "mfc.twain"
CODE PRELOAD MOVEABLE DISCARDABLE
DATA PRELOAD SINGLE MOVEABLE
HEAPSIZE 5120
EXPORTS
DS_Entry @1
/** mfc.twain.h **/
class CmfctwainApp : public CWinApp
{
public:
CmfctwainApp();
~CmfctwainApp();
// Überschreibungen
public:
virtual BOOL InitInstance();
DECLARE_MESSAGE_MAP()
};
/** mfc.twain.cpp **/
// CmfctwainApp
BEGIN_MESSAGE_MAP(CmfctwainApp, CWinApp)
END_MESSAGE_MAP()
CmfctwainApp::CmfctwainApp()
{
// Alle wichtigen Initialisierungen in InitInstance positionieren
}
CmfctwainApp theApp;
// CmfctwainApp Initialisierung
BOOL CmfctwainApp::InitInstance()
{
CWinApp::InitInstance();
/**************************
* other initializations
*************************/
.
.
.
return TRUE;
}
/** mfc.twain_main.cpp **/
.
.
.
TW_UINT16 CALLBACK DS_Entry(pTW_IDENTITY pSrc, TW_UINT32 DG,
TW_UINT16 DAT, TW_UINT16 MSG,
TW_MEMREF pData)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
.
.
.
return TWRC_SUCCESS;
}I have the same problem!! I have observed another behavior. When you rename the extensions of other DS files in your twain_32 folder, your DS will start appearing in the list of Data Sources (which implies control came inside your DS_Entry function)
Bye
Ajay- AuthorPosts