00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef STRICT
00030 #define STRICT
00031 #endif
00032
00033 #include <memory.h>
00034 #include "wresource.h"
00035 #include "wcommon.h"
00036
00037 static LP_PRINT prlist = NULL;
00038
00039
00040
00041
00042 void PrintRegister (LP_PRINT lpr)
00043 {
00044 LP_PRINT next;
00045 next = prlist;
00046 prlist = lpr;
00047 lpr->next = next;
00048 }
00049
00050 LP_PRINT PrintFind (HDC hdc)
00051 {
00052 LP_PRINT this;
00053 this = prlist;
00054 while (this && (this->hdcPrn != hdc))
00055 {
00056 this = this->next;
00057 }
00058 return this;
00059 }
00060
00061 void PrintUnregister (LP_PRINT lpr)
00062 {
00063 LP_PRINT this, prev;
00064 prev = (LP_PRINT) NULL;
00065 this = prlist;
00066 while (this && (this != lpr))
00067 {
00068 prev = this;
00069 this = this->next;
00070 }
00071 if (this && (this == lpr))
00072 {
00073
00074 if (prev)
00075 prev->next = this->next;
00076 else
00077 prlist = this->next;
00078 }
00079 }
00080
00081
00082
00083
00084 EXPORT BOOL CALLBACK PrintDlgProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
00085 {
00086 LP_PRINT lpr;
00087 HWND parent;
00088 parent = GetParent (hDlg);
00089 lpr = (LP_PRINT) GetWindowLong (parent, 4);
00090 switch (message)
00091 {
00092 case WM_INITDIALOG:
00093 lpr->hDlgPrint = hDlg;
00094 SetWindowText (hDlg, (LPSTR) lParam);
00095 EnableMenuItem (GetSystemMenu (hDlg, FALSE), SC_CLOSE, MF_GRAYED);
00096 return TRUE;
00097 case WM_COMMAND:
00098 lpr->bUserAbort = TRUE;
00099 lpr->hDlgPrint = 0;
00100 EnableWindow (GetParent (hDlg), TRUE);
00101 EndDialog (hDlg, FALSE);
00102 return TRUE;
00103 }
00104 return FALSE;
00105 }
00106
00107 EXPORT BOOL CALLBACK PrintAbortProc (HDC hdcPrn, int code)
00108 {
00109 MSG msg;
00110 LP_PRINT lpr;
00111 lpr = PrintFind (hdcPrn);
00112 while (!lpr->bUserAbort && PeekMessage (&msg, 0, 0, 0, PM_REMOVE))
00113 {
00114 if (!lpr->hDlgPrint || !IsDialogMessage (lpr->hDlgPrint, &msg))
00115 {
00116 TranslateMessage (&msg);
00117 DispatchMessage (&msg);
00118 }
00119 }
00120 return (!lpr->bUserAbort);
00121 }
00122