home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2002 September
/
PCWorld_2002-09_cd.bin
/
Software
/
Topware
/
fprint
/
fpdk400.exe
/
samples
/
msvc
/
callback.mfc
/
FPCALLM.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1999-10-15
|
4KB
|
135 lines
// fpcallm.cpp : Defines the initialization routines for the DLL.
//
#include "stdafx.h"
#include "fpcallm.h"
#include "calldlg.h"
#include "fpapi.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//
// Note!
//
// If this DLL is dynamically linked against the MFC
// DLLs, any functions exported from this DLL which
// call into MFC must have the AFX_MANAGE_STATE macro
// added at the very beginning of the function.
//
// For example:
//
// extern "C" BOOL PASCAL EXPORT ExportedFunction()
// {
// AFX_MANAGE_STATE(AfxGetStaticModuleState());
// // normal function body here
// }
//
// It is very important that this macro appear in each
// function, prior to any calls into MFC. This means that
// it must appear as the first statement within the
// function, even before any object variable declarations
// as their constructors may generate calls into the MFC
// DLL.
//
// Please see MFC Technical Notes 33 and 58 for additional
// details.
//
/////////////////////////////////////////////////////////////////////////////
// CMFCcallbackApp
BEGIN_MESSAGE_MAP(CMFCcallbackApp, CWinApp)
//{{AFX_MSG_MAP(CMFCcallbackApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMFCcallbackApp construction
CMFCcallbackApp::CMFCcallbackApp()
{
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CMFCcallbackApp object
CMFCcallbackApp theApp;
/*--------------------------------------------------------------------------
| fpOnStartDocA
|
| FinePrint job callback function.
--------------------------------------------------------------------------*/
extern "C" DWORD WINAPI fpOnStartDocA (FpDocCallbackA *pDoc)
{
CCallbackDialog dlg;
HFinePrint hfp = 0;
TCHAR szPrinter[256] = {0};
LPTSTR pszMsg = new TCHAR [1024];
if (fpOpen (pDoc->szFinePrinter, &hfp) == 0) {
fpGetLayoutAttr (hfp, eliDestPrinter, szPrinter, sizeof (szPrinter));
fpSetLayoutAttr (hfp, eliLayout, (void *) eLayout8);
fpClose (hfp, FALSE);
}
// bring up a dialog box
MessageBeep (0);
switch (dlg.DoModal ()) {
case PB_Early:
// show the FinePrint dialog now
pDoc->dwShowDlg = ShowDlg_Early;
return (TRUE);
case PB_Late:
// show the FinePrint dialog later
pDoc->dwShowDlg = ShowDlg_Late;
return (TRUE);
}
// abort the print job
return (FALSE);
#if 0
TCHAR sz[256];
// bring up a message box
_stprintf (
sz,
TEXT ("Print job \"%s\" on printer \"%s\".\n\n\
\tYES = show FP dialog now\n\
\tNO = show FP dialog later\n\
\tCANCEL = abort job"),
pDoc->szJobName,
pDoc->szFinePrinter);
switch (MessageBox (NULL, sz, TEXT ("FinePrint callback DLL"), MB_SETFOREGROUND | MB_YESNOCANCEL)) {
case IDYES:
// show the FinePrint dialog now
pDoc->dwShowDlg = ShowDlg_Early;
return (TRUE);
case IDNO:
// show the FinePrint dialog later
pDoc->dwShowDlg = ShowDlg_Late;
return (TRUE);
default:
// abort the print job
return (FALSE);
}
#endif
}
/*--------------------------------------------------------------------------
| fpOnEndDocA
|
| FinePrint job callback function.
--------------------------------------------------------------------------*/
extern "C" DWORD WINAPI fpOnEndDocA (FpDocCallbackA *pDoc)
{
MessageBeep (0);
MessageBox (NULL, TEXT ("In fpOnEndDoc callback."), TEXT ("FinePrint callback DLL"), MB_SETFOREGROUND | MB_ICONINFORMATION | MB_OK);
return (TRUE);
}