Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

main.h File Reference

Go to the source code of this file.

Defines

#define IDM_OPENFILE   100
#define IDM_SAVEFILE   101
#define IDM_SAVEFILEAS   102
#define IDM_PRINT   103
#define IDM_EXIT   104
#define IDM_ENTERNEW   200
#define IDM_CHOOSECOLOR   201
#define IDM_CHOOSEFONT   202
#define IDM_FINDTEXT   203
#define IDM_REPLACETEXT   204
#define IDM_STANDARD   205
#define IDM_HOOK   206
#define IDM_CUSTOM   207
#define IDM_PERCEPUAL   400
#define IDM_COLOR   401
#define IDM_SATURATION   402
#define IDM_ASCII   403
#define IDM_BINARY   404
#define IDM_AUTO   405
#define IDM_ABC   406
#define IDM_DEFG   407
#define IDM_INP_AUTO   408
#define IDM_INP_GRAY   409
#define IDM_INP_RGB   410
#define IDM_INP_CMYK   411
#define IDM_CSA   412
#define IDM_CRD   413
#define IDM_INTENT   414
#define IDM_PROFCRD   415
#define IDM_ABOUT   300
#define IDEDIT   500
#define IDS_DIALOGFAILURE   1
#define IDS_STRUCTSIZE   2
#define IDS_INITIALIZATION   3
#define IDS_NOTEMPLATE   4
#define IDS_NOHINSTANCE   5
#define IDS_LOADSTRFAILURE   6
#define IDS_FINDRESFAILURE   7
#define IDS_LOADRESFAILURE   8
#define IDS_LOCKRESFAILURE   9
#define IDS_MEMALLOCFAILURE   10
#define IDS_MEMLOCKFAILURE   11
#define IDS_NOHOOK   12
#define IDS_SETUPFAILURE   13
#define IDS_PARSEFAILURE   14
#define IDS_RETDEFFAILURE   15
#define IDS_LOADDRVFAILURE   16
#define IDS_GETDEVMODEFAIL   17
#define IDS_INITFAILURE   18
#define IDS_NODEVICES   19
#define IDS_NODEFAULTPRN   20
#define IDS_DNDMMISMATCH   21
#define IDS_CREATEICFAILURE   22
#define IDS_PRINTERNOTFOUND   23
#define IDS_NOFONTS   24
#define IDS_SUBCLASSFAILURE   25
#define IDS_INVALIDFILENAME   26
#define IDS_BUFFERTOOSMALL   27
#define IDS_FILTERSTRING   28
#define IDS_UNKNOWNERROR   29
#define FILE_LEN   128

Functions

LRESULT CALLBACK MainWndProc (HWND, UINT, WPARAM, LPARAM)
BOOL CALLBACK About (HWND, UINT, WPARAM, LPARAM)
BOOL CALLBACK EnterNew (HWND, UINT, WPARAM, LPARAM)
BOOL CALLBACK FileOpenHookProc (HWND, UINT, WPARAM, LPARAM)
BOOL CALLBACK FileSaveHookProc (HWND, UINT, WPARAM, LPARAM)
BOOL CALLBACK ChooseColorHookProc (HWND, UINT, WPARAM, LPARAM)
BOOL CALLBACK ChooseFontHookProc (HWND, UINT, WPARAM, LPARAM)
BOOL CALLBACK FindTextHookProc (HWND, UINT, WPARAM, LPARAM)
BOOL CALLBACK ReplaceTextHookProc (HWND, UINT, WPARAM, LPARAM)
BOOL CALLBACK PrintDlgHookProc (HWND, UINT, WPARAM, LPARAM)
BOOL CALLBACK PrintSetupHookProc (HWND, UINT, WPARAM, LPARAM)
BOOL InitApplication (HANDLE)
BOOL InitInstance (HANDLE, int)
BOOL OpenNewFile (HWND)
BOOL SaveToFile (HWND)
BOOL SaveAs (HWND)
void SearchFile (LPFINDREPLACE)
BOOL ChooseNewFont (HWND)
BOOL ChooseNewColor (HWND)
void PrintFile (HWND)
void CallFindText (HWND)
void CallReplaceText (HWND)
void ProcessCDError (DWORD, HWND)
void ColorSpaceControl (LPSTR FileName, LPSTR SaveFileName, WORD InpDrvClrSp, DWORD Intent, WORD CSAType, BOOL AllowBinary)
void CreateCRDControl (LPSTR FileName, LPSTR SaveFileName, DWORD Inter_Intent, BOOL AllowBinary)
void CreateINTENTControl (LPSTR FileName, LPSTR SaveFileName, DWORD Inter_Intent)
void CreateProfCRDControl (LPSTR DevProfile, LPSTR TargetProfile, LPSTR SaveFileName, DWORD Inter_Intent, BOOL AllowBinary)


Define Documentation

#define FILE_LEN   128
 

Definition at line 90 of file aug98/test/main.h.

Referenced by EnterNew(), OpenFiles(), and SearchFile().

#define IDEDIT   500
 

Definition at line 54 of file aug98/test/main.h.

Referenced by EnterNew().

#define IDM_ABC   406
 

Definition at line 39 of file aug98/test/main.h.

Referenced by MainWndProc().

#define IDM_ABOUT   300
 

Definition at line 50 of file aug98/test/main.h.

Referenced by MainWndProc().

#define IDM_ASCII   403
 

Definition at line 36 of file aug98/test/main.h.

Referenced by MainWndProc().

#define IDM_AUTO   405
 

Definition at line 38 of file aug98/test/main.h.

Referenced by MainWndProc().

#define IDM_BINARY   404
 

Definition at line 37 of file aug98/test/main.h.

Referenced by MainWndProc().

#define IDM_CHOOSECOLOR   201
 

Definition at line 24 of file aug98/test/main.h.

Referenced by MainWndProc().

#define IDM_CHOOSEFONT   202
 

Definition at line 25 of file aug98/test/main.h.

Referenced by MainWndProc().

#define IDM_COLOR   401
 

Definition at line 34 of file aug98/test/main.h.

Referenced by MainWndProc().

#define IDM_CRD   413
 

Definition at line 46 of file aug98/test/main.h.

Referenced by MainWndProc(), OpenFiles(), and SaveAs().

#define IDM_CSA   412
 

Definition at line 45 of file aug98/test/main.h.

Referenced by MainWndProc(), OpenFiles(), and SaveAs().

#define IDM_CUSTOM   207
 

Definition at line 30 of file aug98/test/main.h.

Referenced by CallFindText(), CallReplaceText(), ChooseNewColor(), ChooseNewFont(), MainWndProc(), OpenNewFile(), PrintFile(), and SaveAs().

#define IDM_DEFG   407
 

Definition at line 40 of file aug98/test/main.h.

Referenced by MainWndProc().

#define IDM_ENTERNEW   200
 

Definition at line 23 of file aug98/test/main.h.

Referenced by MainWndProc().

#define IDM_EXIT   104
 

Definition at line 20 of file aug98/test/main.h.

Referenced by MainWndProc(), and WndProc().

#define IDM_FINDTEXT   203
 

Definition at line 26 of file aug98/test/main.h.

Referenced by MainWndProc().

#define IDM_HOOK   206
 

Definition at line 29 of file aug98/test/main.h.

Referenced by CallFindText(), CallReplaceText(), ChooseNewColor(), ChooseNewFont(), MainWndProc(), OpenNewFile(), PrintFile(), and SaveAs().

#define IDM_INP_AUTO   408
 

Definition at line 41 of file aug98/test/main.h.

Referenced by MainWndProc(), and OpenFiles().

#define IDM_INP_CMYK   411
 

Definition at line 44 of file aug98/test/main.h.

Referenced by MainWndProc(), and OpenFiles().

#define IDM_INP_GRAY   409
 

Definition at line 42 of file aug98/test/main.h.

Referenced by MainWndProc(), and OpenFiles().

#define IDM_INP_RGB   410
 

Definition at line 43 of file aug98/test/main.h.

Referenced by MainWndProc(), and OpenFiles().

#define IDM_INTENT   414
 

Definition at line 47 of file aug98/test/main.h.

Referenced by MainWndProc().

#define IDM_OPENFILE   100
 

Definition at line 16 of file aug98/test/main.h.

Referenced by MainWndProc().

#define IDM_PERCEPUAL   400
 

Definition at line 33 of file aug98/test/main.h.

Referenced by MainWndProc().

#define IDM_PRINT   103
 

Definition at line 19 of file aug98/test/main.h.

#define IDM_PROFCRD   415
 

Definition at line 48 of file aug98/test/main.h.

Referenced by MainWndProc(), OpenFiles(), and SaveAs().

#define IDM_REPLACETEXT   204
 

Definition at line 27 of file aug98/test/main.h.

Referenced by MainWndProc().

#define IDM_SATURATION   402
 

Definition at line 35 of file aug98/test/main.h.

Referenced by MainWndProc().

#define IDM_SAVEFILE   101
 

Definition at line 17 of file aug98/test/main.h.

#define IDM_SAVEFILEAS   102
 

Definition at line 18 of file aug98/test/main.h.

#define IDM_STANDARD   205
 

Definition at line 28 of file aug98/test/main.h.

Referenced by CallFindText(), CallReplaceText(), ChooseNewColor(), ChooseNewFont(), MainWndProc(), OpenNewFile(), PrintFile(), and SaveAs().

#define IDS_BUFFERTOOSMALL   27
 

Definition at line 84 of file aug98/test/main.h.

Referenced by ProcessCDError().

#define IDS_CREATEICFAILURE   22
 

Definition at line 79 of file aug98/test/main.h.

Referenced by ProcessCDError().

#define IDS_DIALOGFAILURE   1
 

Definition at line 58 of file aug98/test/main.h.

Referenced by ProcessCDError().

#define IDS_DNDMMISMATCH   21
 

Definition at line 78 of file aug98/test/main.h.

Referenced by ProcessCDError().

#define IDS_FILTERSTRING   28
 

Definition at line 85 of file aug98/test/main.h.

#define IDS_FINDRESFAILURE   7
 

Definition at line 64 of file aug98/test/main.h.

Referenced by ProcessCDError().

#define IDS_GETDEVMODEFAIL   17
 

Definition at line 74 of file aug98/test/main.h.

Referenced by ProcessCDError().

#define IDS_INITFAILURE   18
 

Definition at line 75 of file aug98/test/main.h.

Referenced by ProcessCDError().

#define IDS_INITIALIZATION   3
 

Definition at line 60 of file aug98/test/main.h.

Referenced by ProcessCDError().

#define IDS_INVALIDFILENAME   26
 

Definition at line 83 of file aug98/test/main.h.

Referenced by ProcessCDError().

#define IDS_LOADDRVFAILURE   16
 

Definition at line 73 of file aug98/test/main.h.

Referenced by ProcessCDError().

#define IDS_LOADRESFAILURE   8
 

Definition at line 65 of file aug98/test/main.h.

Referenced by ProcessCDError().

#define IDS_LOADSTRFAILURE   6
 

Definition at line 63 of file aug98/test/main.h.

Referenced by ProcessCDError().

#define IDS_LOCKRESFAILURE   9
 

Definition at line 66 of file aug98/test/main.h.

Referenced by ProcessCDError().

#define IDS_MEMALLOCFAILURE   10
 

Definition at line 67 of file aug98/test/main.h.

Referenced by ProcessCDError().

#define IDS_MEMLOCKFAILURE   11
 

Definition at line 68 of file aug98/test/main.h.

Referenced by ProcessCDError().

#define IDS_NODEFAULTPRN   20
 

Definition at line 77 of file aug98/test/main.h.

Referenced by ProcessCDError().

#define IDS_NODEVICES   19
 

Definition at line 76 of file aug98/test/main.h.

Referenced by ProcessCDError().

#define IDS_NOFONTS   24
 

Definition at line 81 of file aug98/test/main.h.

Referenced by ProcessCDError().

#define IDS_NOHINSTANCE   5
 

Definition at line 62 of file aug98/test/main.h.

Referenced by ProcessCDError().

#define IDS_NOHOOK   12
 

Definition at line 69 of file aug98/test/main.h.

Referenced by ProcessCDError().

#define IDS_NOTEMPLATE   4
 

Definition at line 61 of file aug98/test/main.h.

Referenced by ProcessCDError().

#define IDS_PARSEFAILURE   14
 

Definition at line 71 of file aug98/test/main.h.

Referenced by ProcessCDError().

#define IDS_PRINTERNOTFOUND   23
 

Definition at line 80 of file aug98/test/main.h.

Referenced by ProcessCDError().

#define IDS_RETDEFFAILURE   15
 

Definition at line 72 of file aug98/test/main.h.

Referenced by ProcessCDError().

#define IDS_SETUPFAILURE   13
 

Definition at line 70 of file aug98/test/main.h.

Referenced by ProcessCDError().

#define IDS_STRUCTSIZE   2
 

Definition at line 59 of file aug98/test/main.h.

Referenced by ProcessCDError().

#define IDS_SUBCLASSFAILURE   25
 

Definition at line 82 of file aug98/test/main.h.

Referenced by ProcessCDError().

#define IDS_UNKNOWNERROR   29
 

Definition at line 86 of file aug98/test/main.h.

Referenced by ProcessCDError().


Function Documentation

BOOL CALLBACK About HWND  ,
UINT  ,
WPARAM  ,
LPARAM 
 

Definition at line 622 of file aug98/test/main.c.

00627 { 00628 switch (message) 00629 { 00630 case WM_INITDIALOG: /* message: initialize dialog box */ 00631 return (TRUE); 00632 00633 case WM_COMMAND: /* message: received a command */ 00634 if (LOWORD(wParam) == IDOK /* "OK" box selected? */ 00635 || LOWORD(wParam) == IDCANCEL) { /* System menu close command? */ 00636 EndDialog(hDlg, TRUE); /* Exits the dialog box */ 00637 return (TRUE); 00638 } 00639 break; 00640 } 00641 return (FALSE); /* Didn't process a message */ 00642 00643 // avoid compiler warnings at W3 00644 lParam; 00645 }

void CallFindText HWND   ) 
 

Definition at line 1608 of file aug98/test/main.c.

01609 { 01610 01611 frText.lStructSize = sizeof( frText ); 01612 frText.hwndOwner = hWnd; 01613 frText.hInstance = (HANDLE)hInst; 01614 frText.lpstrFindWhat = szFindString; 01615 frText.lpstrReplaceWith = (LPSTR)NULL; 01616 frText.wFindWhatLen = sizeof(szFindString); 01617 frText.wReplaceWithLen = 0; 01618 frText.lCustData = 0; 01619 lpBufPtr = FileBuf; 01620 01621 switch( wMode ) 01622 { 01623 case IDM_STANDARD: 01624 frText.Flags = FR_NOMATCHCASE | FR_NOUPDOWN | FR_NOWHOLEWORD; 01625 frText.lpfnHook = (LPFRHOOKPROC)(FARPROC)NULL; 01626 frText.lpTemplateName = (LPSTR)NULL; 01627 break; 01628 01629 case IDM_HOOK: 01630 frText.Flags = FR_NOMATCHCASE | FR_NOUPDOWN | FR_NOWHOLEWORD | 01631 FR_ENABLEHOOK; 01632 frText.lpfnHook = (LPFRHOOKPROC)MakeProcInstance(FindTextHookProc, NULL); 01633 frText.lpTemplateName = (LPSTR)NULL; 01634 break; 01635 01636 case IDM_CUSTOM: 01637 frText.Flags = FR_NOMATCHCASE | FR_NOUPDOWN | FR_NOWHOLEWORD | 01638 FR_ENABLEHOOK | FR_ENABLETEMPLATE; 01639 frText.lpfnHook = (LPFRHOOKPROC)MakeProcInstance(FindTextHookProc, NULL); 01640 frText.lpTemplateName = (LPSTR)MAKEINTRESOURCE(FINDDLGORD); 01641 break; 01642 } 01643 01644 if ((hDlgFR = FindText(&frText)) == NULL) 01645 ProcessCDError(CommDlgExtendedError(), hWnd ); 01646 01647 }

void CallReplaceText HWND   ) 
 

Definition at line 1667 of file aug98/test/main.c.

01668 { 01669 frText.lStructSize = sizeof( frText ); 01670 frText.hwndOwner = hWnd; 01671 frText.hInstance = (HANDLE)hInst; 01672 frText.lpstrFindWhat = szFindString; 01673 frText.lpstrReplaceWith = szReplaceString; 01674 frText.wFindWhatLen = sizeof(szFindString); 01675 frText.wReplaceWithLen = sizeof( szReplaceString ); 01676 frText.lCustData = 0; 01677 lpBufPtr = FileBuf; 01678 01679 switch( wMode ) 01680 { 01681 case IDM_STANDARD: 01682 frText.Flags = FR_NOMATCHCASE | FR_NOUPDOWN | FR_NOWHOLEWORD; 01683 frText.lpfnHook = (LPFRHOOKPROC)(FARPROC)NULL; 01684 frText.lpTemplateName = (LPSTR)NULL; 01685 break; 01686 01687 case IDM_HOOK: 01688 frText.Flags = FR_NOMATCHCASE | FR_NOUPDOWN | FR_NOWHOLEWORD | 01689 FR_ENABLEHOOK; 01690 frText.lpfnHook = (LPFRHOOKPROC)MakeProcInstance(ReplaceTextHookProc, NULL); 01691 frText.lpTemplateName = (LPSTR)NULL; 01692 break; 01693 01694 case IDM_CUSTOM: 01695 frText.Flags = FR_NOMATCHCASE | FR_NOUPDOWN | FR_NOWHOLEWORD | 01696 FR_ENABLEHOOK | FR_ENABLETEMPLATE; 01697 frText.lpfnHook = (LPFRHOOKPROC)MakeProcInstance(ReplaceTextHookProc, NULL); 01698 frText.lpTemplateName = (LPSTR)MAKEINTRESOURCE(REPLACEDLGORD); 01699 break; 01700 } 01701 01702 if ( (hDlgFR = ReplaceText( &frText )) == NULL ) 01703 ProcessCDError(CommDlgExtendedError(), hWnd ); 01704 01705 }

BOOL CALLBACK ChooseColorHookProc HWND  ,
UINT  ,
WPARAM  ,
LPARAM 
 

Definition at line 1055 of file aug98/test/main.c.

01060 { 01061 01062 switch (message) 01063 { 01064 case WM_COMMAND: 01065 if (LOWORD(wParam) == IDOK) 01066 { 01067 if (MessageBox( hDlg, "Are you sure you want to change the color?", 01068 "Information", MB_YESNO ) == IDYES ) 01069 break; 01070 return (TRUE); 01071 01072 } 01073 break; 01074 } 01075 return (FALSE); 01076 01077 // avoid compiler warnings at W3 01078 lParam; 01079 01080 }

BOOL CALLBACK ChooseFontHookProc HWND  ,
UINT  ,
WPARAM  ,
LPARAM 
 

Definition at line 1175 of file aug98/test/main.c.

01180 { 01181 01182 switch (message) 01183 { 01184 case WM_INITDIALOG: 01185 if (chf.Flags & CF_ENABLETEMPLATE) 01186 { 01187 ShowWindow(GetDlgItem(hDlg, stc4), SW_HIDE); 01188 ShowWindow(GetDlgItem(hDlg, cmb4), SW_HIDE); 01189 } 01190 break; 01191 01192 case WM_COMMAND: 01193 if (LOWORD(wParam) == IDOK) 01194 { 01195 if (MessageBox( hDlg, "Are you sure you want to change the font?", 01196 "Information", MB_YESNO ) == IDYES ) 01197 break; 01198 return (TRUE); 01199 01200 } 01201 break; 01202 } 01203 return (FALSE); 01204 01205 // avoid compiler warnings at W3 01206 lParam; 01207 01208 }

BOOL ChooseNewColor HWND   ) 
 

Definition at line 1100 of file aug98/test/main.c.

01101 { 01102 01103 DWORD dwColor; 01104 DWORD dwCustClrs[16]; 01105 BOOL fSetColor = FALSE; 01106 int i; 01107 01108 01109 for (i=0; i < 15; i++) 01110 dwCustClrs[i] = RGB( 255, 255, 255); 01111 01112 dwColor = RGB( 0, 0, 0 ); 01113 01114 chsclr.lStructSize = sizeof(CHOOSECOLOR); 01115 chsclr.hwndOwner = hWnd; 01116 chsclr.hInstance = (HANDLE)hInst; 01117 chsclr.rgbResult = dwColor; 01118 chsclr.lpCustColors = (LPDWORD)dwCustClrs; 01119 chsclr.lCustData = 0L; 01120 01121 switch( wMode ) 01122 { 01123 case IDM_HOOK: 01124 case IDM_CUSTOM: 01125 chsclr.Flags = CC_PREVENTFULLOPEN | CC_ENABLEHOOK; 01126 chsclr.lpfnHook = (LPCCHOOKPROC)MakeProcInstance(ChooseColorHookProc, NULL); 01127 chsclr.lpTemplateName = (LPSTR)NULL; 01128 break; 01129 01130 case IDM_STANDARD: 01131 chsclr.Flags = CC_PREVENTFULLOPEN; 01132 chsclr.lpfnHook = (LPCCHOOKPROC)(FARPROC)NULL; 01133 chsclr.lpTemplateName = (LPSTR)NULL; 01134 break; 01135 01136 01137 } 01138 01139 if ( fSetColor = ChooseColor( &chsclr )) 01140 { 01141 crColor = chsclr.rgbResult; 01142 return (TRUE); 01143 } 01144 else 01145 { 01146 ProcessCDError(CommDlgExtendedError(), hWnd ); 01147 return FALSE; 01148 } 01149 }

BOOL ChooseNewFont HWND   ) 
 

Definition at line 1228 of file aug98/test/main.c.

01229 { 01230 01231 HDC hDC; 01232 01233 hDC = GetDC( hWnd ); 01234 chf.hDC = CreateCompatibleDC( hDC ); 01235 ReleaseDC( hWnd, hDC ); 01236 chf.lStructSize = sizeof(CHOOSEFONT); 01237 chf.hwndOwner = hWnd; 01238 chf.lpLogFont = &lf; 01239 chf.Flags = CF_SCREENFONTS | CF_EFFECTS; 01240 chf.rgbColors = RGB(0, 255, 255); 01241 chf.lCustData = 0; 01242 chf.hInstance = (HANDLE)hInst; 01243 chf.lpszStyle = (LPSTR)NULL; 01244 chf.nFontType = SCREEN_FONTTYPE; 01245 chf.nSizeMin = 0; 01246 chf.nSizeMax = 0; 01247 01248 switch( wMode ) 01249 { 01250 case IDM_STANDARD: 01251 chf.Flags = CF_SCREENFONTS | CF_EFFECTS; 01252 chf.lpfnHook = (LPCFHOOKPROC)(FARPROC)NULL; 01253 chf.lpTemplateName = (LPSTR)NULL; 01254 break; 01255 01256 case IDM_HOOK: 01257 chf.Flags = CF_SCREENFONTS | CF_EFFECTS | CF_ENABLEHOOK; 01258 chf.lpfnHook = (LPCFHOOKPROC)MakeProcInstance(ChooseFontHookProc, NULL); 01259 chf.lpTemplateName = (LPSTR)NULL; 01260 break; 01261 01262 case IDM_CUSTOM: 01263 chf.Flags = CF_SCREENFONTS | CF_EFFECTS | CF_ENABLEHOOK | 01264 CF_ENABLETEMPLATE; 01265 chf.lpfnHook = (LPCFHOOKPROC)MakeProcInstance(ChooseFontHookProc, NULL); 01266 chf.lpTemplateName = (LPSTR)MAKEINTRESOURCE(FORMATDLGORD31); 01267 break; 01268 } 01269 01270 01271 if( ChooseFont( &chf ) == FALSE ) 01272 { 01273 DeleteDC( hDC ); 01274 ProcessCDError(CommDlgExtendedError(), hWnd ); 01275 return FALSE; 01276 } 01277 01278 01279 DeleteDC( hDC ); 01280 01281 return (TRUE); 01282 }

void ColorSpaceControl LPSTR  FileName,
LPSTR  SaveFileName,
WORD  InpDrvClrSp,
DWORD  Intent,
WORD  CSAType,
BOOL  AllowBinary
 

void CreateCRDControl LPSTR  FileName,
LPSTR  SaveFileName,
DWORD  Inter_Intent,
BOOL  AllowBinary
 

Definition at line 91 of file aug98/test/control.c.

00096 { 00097 BOOL Ret; 00098 CHANDLE cp; 00099 HGLOBAL hCP; 00100 HGLOBAL hBuffer; 00101 MEMPTR lpBuffer; 00102 OFSTRUCT OfStruct; 00103 HFILE hOutput; 00104 DWORD cbSize; 00105 CSIG Intent; 00106 00107 if( !LoadCP32( (LPCSTR) FileName, &hCP, (LPCHANDLE) &cp) ) 00108 { 00109 return; 00110 } 00111 00112 switch (Inter_Intent) 00113 { 00114 case 0: Intent = icPerceptual; break; 00115 case 1: Intent = icRelativeColorimetric; break; 00116 case 2: Intent = icSaturation; break; 00117 case 3: Intent = icAbsoluteColorimetric; break; 00118 default: return; 00119 } 00120 00121 Ret = GetPS2ColorRenderingDictionary(cp, Intent, NULL, &cbSize, AllowBinary); 00122 if (Ret) 00123 { 00124 if (!MemAlloc(cbSize, &hBuffer, &lpBuffer)) 00125 return; 00126 Ret = GetPS2ColorRenderingDictionary(cp, Intent, lpBuffer, &cbSize, AllowBinary); 00127 hOutput = OpenFile(SaveFileName, &OfStruct, OF_CREATE); 00128 cbSize = _lwrite(hOutput, lpBuffer, cbSize); 00129 _lclose(hOutput); 00130 MemFree(hBuffer); 00131 } 00132 FreeCP(hCP); 00133 00134 if (!Ret) 00135 MessageBox( GetFocus(), "No CRD created.", NULL, MB_OK ); 00136 }

void CreateINTENTControl LPSTR  FileName,
LPSTR  SaveFileName,
DWORD  Inter_Intent
 

Definition at line 25 of file aug98/test/control.c.

00029 { 00030 BOOL Ret; 00031 CHANDLE cp; 00032 HGLOBAL hCP; 00033 HGLOBAL hBuffer; 00034 MEMPTR lpBuffer; 00035 OFSTRUCT OfStruct; 00036 HFILE hOutput; 00037 DWORD cbSize; 00038 CSIG Intent; 00039 00040 if( !LoadCP32( (LPCSTR) FileName, &hCP, (LPCHANDLE) &cp) ) 00041 { 00042 return; 00043 } 00044 00045 switch (Inter_Intent) 00046 { 00047 case 0: Intent = icPerceptual; break; 00048 case 1: Intent = icRelativeColorimetric; break; 00049 case 2: Intent = icSaturation; break; 00050 case 3: Intent = icAbsoluteColorimetric; break; 00051 default: return; 00052 } 00053 00054 Ret = GetPS2ColorRenderingIntent(cp, Intent, NULL, &cbSize); 00055 if (Ret) 00056 { 00057 if (!MemAlloc(cbSize, &hBuffer, &lpBuffer)) 00058 return; 00059 Ret = GetPS2ColorRenderingIntent(cp, Intent, lpBuffer, &cbSize); 00060 hOutput = OpenFile(SaveFileName, &OfStruct, OF_CREATE); 00061 cbSize = _lwrite(hOutput, lpBuffer, cbSize); 00062 _lclose(hOutput); 00063 MemFree(hBuffer); 00064 } 00065 FreeCP(hCP); 00066 00067 if (!Ret) 00068 MessageBox( GetFocus(), "No PS2 Intent created.", NULL, MB_OK ); 00069 }

void CreateProfCRDControl LPSTR  DevProfile,
LPSTR  TargetProfile,
LPSTR  SaveFileName,
DWORD  Inter_Intent,
BOOL  AllowBinary
 

Definition at line 158 of file aug98/test/control.c.

00164 { 00165 BOOL Ret; 00166 CHANDLE cpDev, cpTar; 00167 HGLOBAL hDevCP = 0, hTarCP = 0; 00168 HGLOBAL hBuffer; 00169 MEMPTR lpBuffer; 00170 OFSTRUCT OfStruct; 00171 HFILE hOutput; 00172 DWORD cbSize; 00173 CSIG Intent; 00174 00175 LoadCP32( (LPCSTR) DevProfile, &hDevCP, (LPCHANDLE) &cpDev); 00176 LoadCP32( (LPCSTR) TargetProfile, &hTarCP, (LPCHANDLE) &cpTar); 00177 00178 if (!hDevCP || !hTarCP) 00179 { 00180 if (hDevCP) FreeCP(hDevCP); 00181 if (hTarCP) FreeCP(hTarCP); 00182 return; 00183 } 00184 00185 switch (Inter_Intent) 00186 { 00187 case 0: Intent = icPerceptual; break; 00188 case 1: Intent = icRelativeColorimetric; break; 00189 case 2: Intent = icSaturation; break; 00190 case 3: Intent = icAbsoluteColorimetric; break; 00191 default: return; 00192 } 00193 00194 Ret = GetPS2PreviewColorRenderingDictionary(cpDev, cpTar, Intent, NULL, &cbSize, AllowBinary); 00195 if (Ret) 00196 { 00197 if (!MemAlloc(cbSize, &hBuffer, &lpBuffer)) 00198 return; 00199 Ret = GetPS2PreviewColorRenderingDictionary(cpDev, cpTar, Intent, lpBuffer, &cbSize, AllowBinary); 00200 hOutput = OpenFile(SaveFileName, &OfStruct, OF_CREATE); 00201 cbSize = _lwrite(hOutput, lpBuffer, cbSize); 00202 _lclose(hOutput); 00203 MemFree(hBuffer); 00204 } 00205 FreeCP(hDevCP); 00206 FreeCP(hTarCP); 00207 00208 if (!Ret) 00209 MessageBox( GetFocus(), "No CRD created.", NULL, MB_OK ); 00210 }

BOOL CALLBACK EnterNew HWND  ,
UINT  ,
WPARAM  ,
LPARAM 
 

Definition at line 570 of file aug98/test/main.c.

00575 { 00576 CHAR Buf[FILE_LEN-1]; 00577 00578 switch (message) 00579 { 00580 case WM_INITDIALOG: /* message: initialize dialog box */ 00581 return (TRUE); 00582 00583 case WM_COMMAND: /* message: received a command */ 00584 if (LOWORD(wParam) == IDOK) 00585 { 00586 GetDlgItemText( hDlg, IDEDIT, Buf, FILE_LEN-1); 00587 strcpy( FileBuf, Buf); 00588 lpBufPtr = FileBuf; 00589 dwFileSize = strlen(FileBuf); 00590 EndDialog( hDlg, TRUE ); 00591 return (TRUE); 00592 } 00593 else if (LOWORD(wParam) == IDCANCEL) 00594 { /* System menu close command? */ 00595 EndDialog(hDlg, FALSE); /* Exits the dialog box */ 00596 return (TRUE); 00597 } 00598 break; 00599 } 00600 return (FALSE); /* Didn't process a message */ 00601 00602 // avoid compiler warnings at W3 00603 lParam; 00604 }

BOOL CALLBACK FileOpenHookProc HWND  ,
UINT  ,
WPARAM  ,
LPARAM 
 

Definition at line 669 of file aug98/test/main.c.

00674 { 00675 00676 int hFile; 00677 CHAR szTempText[256]; 00678 CHAR szString[256]; 00679 OFSTRUCT OfStruct; 00680 00681 switch (message) 00682 { 00683 00684 case WM_COMMAND: 00685 if (LOWORD(wParam) == IDOK) 00686 { 00687 GetDlgItemText( hDlg, edt1, szTempText, 00688 sizeof( szTempText ) - 1); 00689 00690 if ( OpenFileName.Flags & OFN_PATHMUSTEXIST ) 00691 { 00692 sprintf( szString, "Are you sure you want to open %s?", 00693 szTempText); 00694 if ( MessageBox( hDlg, szString, "Information", 00695 MB_YESNO ) == IDYES ) 00696 00697 break; 00698 return (TRUE); 00699 } 00700 00701 // check to see if the Create File box has been checked 00702 if ( (BOOL)(SendMessage( GetDlgItem(hDlg, chx2), 00703 BM_GETCHECK, 0, 0L )) == TRUE ) 00704 { 00705 // if so, create the file 00706 if ((hFile = OpenFile(szTempText, 00707 &OfStruct, 00708 OF_CREATE)) == -1) 00709 { 00710 MessageBox( hDlg, 00711 "Directory could not be created.", 00712 NULL, 00713 MB_OK ); 00714 return (FALSE); 00715 } 00716 00717 strcpy(FileBuf, "Empty"); 00718 lpBufPtr = FileBuf; 00719 dwFileSize = strlen(FileBuf); 00720 if (_lwrite( hFile, (LPSTR)&FileBuf[0], dwFileSize)==-1) 00721 MessageBox( hDlg, "Error writing file.", NULL, MB_OK ); 00722 00723 // close the file 00724 _lclose( hFile ); 00725 } 00726 00727 } 00728 break; 00729 } 00730 return (FALSE); 00731 00732 // avoid compiler warnings at W3 00733 lParam; 00734 00735 }

BOOL CALLBACK FileSaveHookProc HWND  ,
UINT  ,
WPARAM  ,
LPARAM 
 

Definition at line 885 of file aug98/test/main.c.

00890 { 00891 CHAR szTempText[256]; 00892 CHAR szString[256]; 00893 00894 switch (message) 00895 { 00896 case WM_COMMAND: 00897 if (LOWORD(wParam) == IDOK) 00898 { 00899 GetDlgItemText( hDlg, edt1, szTempText, 00900 sizeof( szTempText ) - 1); 00901 if ( OpenFileName.Flags & OFN_ENABLETEMPLATE ) 00902 { 00903 // check to see if the Create File box has been checked 00904 if ( (BOOL)(SendMessage( GetDlgItem(hDlg, chx2), 00905 BM_GETCHECK, 0, 0L )) == FALSE ) 00906 OpenFileName.Flags |= OFN_FILEMUSTEXIST; 00907 break; 00908 00909 } 00910 else 00911 { 00912 sprintf( szString, "Are you sure you want to save %s?", 00913 szTempText); 00914 if ( MessageBox( hDlg, szString, "Information", 00915 MB_YESNO ) == IDYES ) 00916 break; 00917 return(TRUE); 00918 } 00919 00920 } 00921 break; 00922 } 00923 return (FALSE); 00924 00925 // avoid compiler warnings at W3 00926 lParam; 00927 00928 }

BOOL CALLBACK FindTextHookProc HWND  ,
UINT  ,
WPARAM  ,
LPARAM 
 

Definition at line 1556 of file aug98/test/main.c.

01561 { 01562 01563 switch (message) 01564 { 01565 case WM_INITDIALOG: 01566 if (frText.Flags & FR_ENABLETEMPLATE ) 01567 { 01568 ShowWindow(GetDlgItem(hDlg, chx1), SW_HIDE); 01569 ShowWindow(GetDlgItem(hDlg, grp1), SW_HIDE); 01570 ShowWindow(GetDlgItem(hDlg, chx2), SW_HIDE); 01571 ShowWindow(GetDlgItem(hDlg, rad1), SW_HIDE); 01572 ShowWindow(GetDlgItem(hDlg, rad2), SW_HIDE); 01573 } 01574 MessageBox( hDlg, 01575 "Hook installed.", 01576 "Information", MB_OK ); 01577 return (TRUE); 01578 01579 01580 default: 01581 break; 01582 } 01583 return (FALSE); 01584 01585 // avoid compiler warnings at W3 01586 lParam; 01587 wParam; 01588 }

BOOL InitApplication HANDLE   ) 
 

Definition at line 185 of file aug98/test/main.c.

00186 { 00187 WNDCLASS wc; 00188 00189 /* Fill in window class structure with parameters that describe the */ 00190 /* main window. */ 00191 00192 wc.style = 0; /* Class style(s). */ 00193 wc.lpfnWndProc = (WNDPROC)MainWndProc; /* Function to retrieve messages for */ 00194 /* windows of this class. */ 00195 wc.cbClsExtra = 0; /* No per-class extra data. */ 00196 wc.cbWndExtra = 0; /* No per-window extra data. */ 00197 wc.hInstance = hInstance; /* Application that owns the class. */ 00198 wc.hIcon = LoadIcon(NULL, IDI_ICON1); 00199 wc.hCursor = LoadCursor(NULL, IDC_ARROW); 00200 wc.hbrBackground = GetStockObject(WHITE_BRUSH); 00201 wc.lpszMenuName = "CmnDlgMenu"; /* Name of menu resource in .RC file. */ 00202 wc.lpszClassName = "CmnDlgWClass"; /* Name used in call to CreateWindow. */ 00203 00204 /* Register the window class and return success/failure code. */ 00205 00206 return (RegisterClass(&wc)); 00207 00208 }

BOOL InitInstance HANDLE  ,
int 
 

Definition at line 224 of file aug98/test/main.c.

00227 { 00228 HWND hWND; /* Main window handle. */ 00229 00230 /* Save the instance handle in static variable, which will be used in */ 00231 /* many subsequence calls from this application to Windows. */ 00232 00233 hInst = hInstance; 00234 00235 /* Create a main window for this application instance. */ 00236 00237 hWND = CreateWindow( 00238 "CmnDlgWClass", /* See RegisterClass() call. */ 00239 "CIEBASED_CDEF Color Space", /* Text for window title bar. */ 00240 WS_OVERLAPPEDWINDOW, /* Window style. */ 00241 CW_USEDEFAULT, /* Default horizontal position. */ 00242 CW_USEDEFAULT, /* Default vertical position. */ 00243 CW_USEDEFAULT, /* Default width. */ 00244 CW_USEDEFAULT, /* Default height. */ 00245 NULL, /* Overlapped windows have no parent. */ 00246 NULL, /* Use the window class menu. */ 00247 hInstance, /* This instance owns this window. */ 00248 NULL /* Pointer not needed. */ 00249 ); 00250 00251 /* If window could not be created, return "failure" */ 00252 00253 if (!hWND) 00254 return (FALSE); 00255 00256 hWnd = hWND; 00257 /* Make the window visible; update its client area; and return "success" */ 00258 00259 ShowWindow(hWnd, nCmdShow); /* Show the window */ 00260 UpdateWindow(hWnd); /* Sends WM_PAINT message */ 00261 return (TRUE); /* Returns the value from PostQuitMessage */ 00262 00263 }

LRESULT CALLBACK MainWndProc HWND  ,
UINT  ,
WPARAM  ,
LPARAM 
 

Definition at line 282 of file aug98/test/main.c.

00287 { 00288 FARPROC lpProcAbout; /* pointer to the "About" function */ 00289 FARPROC lpProcOpen; 00290 FARPROC lpProcEnterNew; /* pointer to the "EnterNew" function */ 00291 HDC hDC; 00292 PAINTSTRUCT ps; 00293 INT nDrawX; 00294 INT nDrawY; 00295 HFONT hFont; 00296 HANDLE Handle; 00297 static BOOL NewFont; 00298 00299 switch (message) { 00300 00301 00302 case WM_CREATE: 00303 //initialize the output on the screen 00304 strcpy( FileBuf, " "); 00305 lpBufPtr = FileBuf; 00306 dwFileSize = strlen(FileBuf); 00307 crColor = 0; 00308 NewFont = FALSE; 00309 break; 00310 00311 00312 case WM_PAINT: 00313 /* Set up a display context to begin painting */ 00314 hDC = BeginPaint (hWnd, &ps); 00315 00316 /* Initialize drawing position to 1/4 inch from the top */ 00317 /* and from the left of the top, left corner of the */ 00318 /* client area of the main windows. */ 00319 nDrawX = GetDeviceCaps(hDC, LOGPIXELSX) / 4; /* 1/4 inch */ 00320 nDrawY = GetDeviceCaps(hDC, LOGPIXELSY) / 4; /* 1/4 inch */ 00321 00322 if ( NewFont == TRUE ) 00323 { 00324 hFont = CreateFontIndirect( &lf ); 00325 Handle = SelectObject( hDC, hFont ); 00326 } 00327 00328 SetTextColor( hDC, crColor ); 00329 00330 // end painting and release hDC 00331 EndPaint( hWnd, &ps ); 00332 break; 00333 00334 00335 case WM_COMMAND: /* message: command from application menu */ 00336 00337 switch( LOWORD( wParam )) 00338 { 00339 case IDM_OPENFILE: 00340 lpProcOpen = MakeProcInstance((FARPROC)OpenFiles, hInst); 00341 00342 DialogBox(hInst, /* current instance */ 00343 "OPENFILES", /* resource to use */ 00344 hWnd, /* parent handle */ 00345 (DLGPROC)lpProcOpen); /* About() instance address */ 00346 00347 FreeProcInstance(lpProcOpen); 00348 break; 00349 00350 case IDM_EXIT: 00351 PostQuitMessage(0); 00352 break; 00353 00354 case IDM_CHOOSECOLOR: 00355 if (ChooseNewColor( hWnd )) 00356 InvalidateRect( hWnd, NULL, TRUE ); 00357 break; 00358 00359 case IDM_CHOOSEFONT: 00360 if (NewFont = ChooseNewFont( hWnd )) 00361 InvalidateRect( hWnd, NULL, TRUE ); 00362 00363 break; 00364 00365 case IDM_FINDTEXT: 00366 CallFindText( hWnd ); 00367 break; 00368 00369 case IDM_REPLACETEXT: 00370 CallReplaceText( hWnd ); 00371 break; 00372 00373 case IDM_STANDARD: 00374 // enable the ChooseColor() option 00375 EnableMenuItem(GetMenu(hWnd), IDM_CHOOSECOLOR, 00376 MF_BYCOMMAND | MF_ENABLED ); 00377 // uncheck previous selection 00378 CheckMenuItem( GetMenu( hWnd ), wMode, MF_UNCHECKED | MF_BYCOMMAND); 00379 //reset mode 00380 wMode = LOWORD(wParam); 00381 //check new selection 00382 CheckMenuItem( GetMenu( hWnd ), wMode, MF_CHECKED | MF_BYCOMMAND); 00383 DrawMenuBar( hWnd); 00384 break; 00385 case IDM_HOOK: 00386 case IDM_CUSTOM: 00387 // disable the ChooseColor() option 00388 EnableMenuItem(GetMenu(hWnd), IDM_CHOOSECOLOR, 00389 MF_BYCOMMAND | MF_GRAYED ); 00390 // uncheck previous selection 00391 CheckMenuItem( GetMenu( hWnd ), wMode, MF_UNCHECKED | MF_BYCOMMAND); 00392 //reset mode 00393 wMode = LOWORD(wParam); 00394 //check new selection 00395 CheckMenuItem( GetMenu( hWnd ), wMode, MF_CHECKED | MF_BYCOMMAND); 00396 DrawMenuBar( hWnd); 00397 break; 00398 00399 case IDM_ENTERNEW: 00400 lpProcEnterNew = MakeProcInstance((FARPROC)EnterNew, hInst); 00401 00402 if (DialogBox(hInst, /* current instance */ 00403 "EnterNewBox", /* resource to use */ 00404 hWnd, /* parent handle */ 00405 (DLGPROC)lpProcEnterNew) == TRUE) 00406 00407 InvalidateRect( hWnd, NULL, TRUE ); 00408 00409 FreeProcInstance(lpProcEnterNew); 00410 break; 00411 00412 case IDM_PERCEPUAL: 00413 Intent = 0; 00414 CheckMenuItem( GetMenu( hWnd ), wIntentMode, MF_UNCHECKED | MF_BYCOMMAND); 00415 //reset mode 00416 wIntentMode = LOWORD(wParam); 00417 //check new selection 00418 CheckMenuItem( GetMenu( hWnd ), wIntentMode, MF_CHECKED | MF_BYCOMMAND); 00419 DrawMenuBar( hWnd); 00420 break; 00421 case IDM_COLOR: 00422 Intent = 1; 00423 CheckMenuItem( GetMenu( hWnd ), wIntentMode, MF_UNCHECKED | MF_BYCOMMAND); 00424 //reset mode 00425 wIntentMode = LOWORD(wParam); 00426 //check new selection 00427 CheckMenuItem( GetMenu( hWnd ), wIntentMode, MF_CHECKED | MF_BYCOMMAND); 00428 DrawMenuBar( hWnd); 00429 break; 00430 case IDM_SATURATION: 00431 Intent = 2; 00432 CheckMenuItem( GetMenu( hWnd ), wIntentMode, MF_UNCHECKED | MF_BYCOMMAND); 00433 //reset mode 00434 wIntentMode = LOWORD(wParam); 00435 //check new selection 00436 CheckMenuItem( GetMenu( hWnd ), wIntentMode, MF_CHECKED | MF_BYCOMMAND); 00437 DrawMenuBar( hWnd); 00438 break; 00439 00440 case IDM_ASCII: 00441 AllowBinary = FALSE; 00442 CheckMenuItem( GetMenu( hWnd ), wAsciiMode, MF_UNCHECKED | MF_BYCOMMAND); 00443 //reset mode 00444 wAsciiMode = LOWORD(wParam); 00445 //check new selection 00446 CheckMenuItem( GetMenu( hWnd ), wAsciiMode, MF_CHECKED | MF_BYCOMMAND); 00447 DrawMenuBar( hWnd); 00448 break; 00449 case IDM_BINARY: 00450 AllowBinary = TRUE; 00451 CheckMenuItem( GetMenu( hWnd ), wAsciiMode, MF_UNCHECKED | MF_BYCOMMAND); 00452 //reset mode 00453 wAsciiMode = LOWORD(wParam); 00454 //check new selection 00455 CheckMenuItem( GetMenu( hWnd ), wAsciiMode, MF_CHECKED | MF_BYCOMMAND); 00456 DrawMenuBar( hWnd); 00457 break; 00458 case IDM_AUTO: 00459 case IDM_ABC: 00460 case IDM_DEFG: 00461 CheckMenuItem( GetMenu( hWnd ), wCSAMode, MF_UNCHECKED | MF_BYCOMMAND); 00462 //reset mode 00463 wCSAMode = LOWORD(wParam); 00464 //check new selection 00465 CheckMenuItem( GetMenu( hWnd ), wCSAMode, MF_CHECKED | MF_BYCOMMAND); 00466 DrawMenuBar( hWnd); 00467 break; 00468 00469 case IDM_INP_AUTO: 00470 case IDM_INP_GRAY: 00471 case IDM_INP_RGB: 00472 case IDM_INP_CMYK: 00473 CheckMenuItem( GetMenu( hWnd ), wInpDrvClrSp, MF_UNCHECKED | MF_BYCOMMAND); 00474 //reset mode 00475 wInpDrvClrSp = LOWORD(wParam); 00476 //check new selection 00477 CheckMenuItem( GetMenu( hWnd ), wInpDrvClrSp, MF_CHECKED | MF_BYCOMMAND); 00478 DrawMenuBar( hWnd); 00479 break; 00480 00481 case IDM_CSA: 00482 case IDM_CRD: 00483 case IDM_PROFCRD: 00484 case IDM_INTENT: 00485 CheckMenuItem( GetMenu( hWnd ), wCSAorCRD, MF_UNCHECKED | MF_BYCOMMAND); 00486 //reset mode 00487 wCSAorCRD = LOWORD(wParam); 00488 if ((wCSAorCRD == IDM_CRD) || (wCSAorCRD == IDM_INTENT)) 00489 { 00490 EnableMenuItem(GetMenu(hWnd), IDM_INP_AUTO, MF_BYCOMMAND | MF_GRAYED ); 00491 EnableMenuItem(GetMenu(hWnd), IDM_INP_GRAY, MF_BYCOMMAND | MF_GRAYED ); 00492 EnableMenuItem(GetMenu(hWnd), IDM_INP_RGB, MF_BYCOMMAND | MF_GRAYED ); 00493 EnableMenuItem(GetMenu(hWnd), IDM_INP_CMYK, MF_BYCOMMAND | MF_GRAYED ); 00494 EnableMenuItem(GetMenu(hWnd), IDM_AUTO, MF_BYCOMMAND | MF_GRAYED ); 00495 EnableMenuItem(GetMenu(hWnd), IDM_ABC, MF_BYCOMMAND | MF_GRAYED ); 00496 EnableMenuItem(GetMenu(hWnd), IDM_DEFG, MF_BYCOMMAND | MF_GRAYED ); 00497 } 00498 else 00499 { 00500 EnableMenuItem(GetMenu(hWnd), IDM_INP_AUTO, MF_BYCOMMAND | MF_ENABLED ); 00501 EnableMenuItem(GetMenu(hWnd), IDM_INP_GRAY, MF_BYCOMMAND | MF_ENABLED ); 00502 EnableMenuItem(GetMenu(hWnd), IDM_INP_RGB, MF_BYCOMMAND | MF_ENABLED ); 00503 EnableMenuItem(GetMenu(hWnd), IDM_INP_CMYK, MF_BYCOMMAND | MF_ENABLED ); 00504 EnableMenuItem(GetMenu(hWnd), IDM_AUTO, MF_BYCOMMAND | MF_ENABLED ); 00505 EnableMenuItem(GetMenu(hWnd), IDM_ABC, MF_BYCOMMAND | MF_ENABLED ); 00506 EnableMenuItem(GetMenu(hWnd), IDM_DEFG, MF_BYCOMMAND | MF_ENABLED ); 00507 } 00508 00509 //check new selection 00510 CheckMenuItem( GetMenu( hWnd ), wCSAorCRD, MF_CHECKED | MF_BYCOMMAND); 00511 DrawMenuBar( hWnd); 00512 break; 00513 00514 case IDM_ABOUT: 00515 lpProcAbout = MakeProcInstance((FARPROC)About, hInst); 00516 00517 DialogBox(hInst, /* current instance */ 00518 "AboutBox", /* resource to use */ 00519 hWnd, /* parent handle */ 00520 (DLGPROC)lpProcAbout); /* About() instance address */ 00521 00522 FreeProcInstance(lpProcAbout); 00523 break; 00524 00525 default: 00526 return (DefWindowProc(hWnd, message, wParam, lParam)); 00527 00528 } 00529 break; 00530 00531 case WM_DESTROY: /* message: window being destroyed */ 00532 PostQuitMessage(0); 00533 break; 00534 00535 00536 default: 00537 // Handle the special findreplace message (FindReplaceMsg) which 00538 // was registered at initialization time. 00539 if ( message == FindReplaceMsg ) 00540 { 00541 if ( lpFR = (LPFINDREPLACE) lParam ) 00542 { 00543 if (lpFR->Flags & FR_DIALOGTERM ) // terminating dialog 00544 return (0); 00545 SearchFile( lpFR ); 00546 InvalidateRect( hWnd, NULL, TRUE ); 00547 } 00548 return (0); 00549 } 00550 00551 return (DefWindowProc(hWnd, message, wParam, lParam)); 00552 } 00553 return (0); 00554 }

BOOL OpenNewFile HWND   ) 
 

Definition at line 755 of file aug98/test/main.c.

00756 { 00757 strcpy( szFile, ""); 00758 strcpy( szFileTitle, ""); 00759 00760 OpenFileName.lStructSize = sizeof(OPENFILENAME); 00761 OpenFileName.hwndOwner = hWnd; 00762 OpenFileName.hInstance = (HANDLE) hInst; 00763 OpenFileName.lpstrFilter = szFilter; 00764 OpenFileName.lpstrCustomFilter = (LPSTR) NULL; 00765 OpenFileName.nMaxCustFilter = 0L; 00766 OpenFileName.nFilterIndex = 1L; 00767 OpenFileName.lpstrFile = szFile; 00768 OpenFileName.nMaxFile = sizeof(szFile); 00769 OpenFileName.lpstrFileTitle = szFileTitle; 00770 OpenFileName.nMaxFileTitle = sizeof(szFileTitle); 00771 OpenFileName.lpstrInitialDir = NULL; 00772 OpenFileName.lpstrTitle = "Open a File"; 00773 OpenFileName.nFileOffset = 0; 00774 OpenFileName.nFileExtension = 0; 00775 OpenFileName.lpstrDefExt = "*.icm"; 00776 OpenFileName.lCustData = 0; 00777 00778 switch( wMode ) 00779 { 00780 case IDM_STANDARD: 00781 OpenFileName.Flags = OFN_SHOWHELP | OFN_PATHMUSTEXIST | 00782 OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; 00783 break; 00784 00785 case IDM_HOOK: 00786 OpenFileName.Flags = OFN_SHOWHELP | OFN_PATHMUSTEXIST | 00787 OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_ENABLEHOOK; 00788 OpenFileName.lpfnHook = (LPOFNHOOKPROC)MakeProcInstance(FileOpenHookProc, NULL); 00789 break; 00790 00791 case IDM_CUSTOM: 00792 OpenFileName.Flags = OFN_SHOWHELP | OFN_ENABLEHOOK | 00793 OFN_HIDEREADONLY | OFN_ENABLETEMPLATE; 00794 OpenFileName.lpfnHook = (LPOFNHOOKPROC)MakeProcInstance(FileOpenHookProc, NULL); 00795 OpenFileName.lpTemplateName = (LPSTR)MAKEINTRESOURCE(FILEOPENORD); 00796 break; 00797 } 00798 00799 if (GetOpenFileName(&OpenFileName)) 00800 { 00801 } 00802 else 00803 { 00804 ProcessCDError(CommDlgExtendedError(), hWnd ); 00805 return FALSE; 00806 } 00807 return TRUE; 00808 }

BOOL CALLBACK PrintDlgHookProc HWND  ,
UINT  ,
WPARAM  ,
LPARAM 
 

Definition at line 1355 of file aug98/test/main.c.

01360 { 01361 01362 switch (message) 01363 { 01364 case WM_INITDIALOG: 01365 if (pd.Flags & PD_ENABLEPRINTTEMPLATE ) 01366 { 01367 ShowWindow( GetDlgItem(hDlg, chx1), SW_HIDE ); 01368 ShowWindow( GetDlgItem(hDlg, chx2), SW_HIDE ); 01369 return(TRUE); 01370 } 01371 MessageBox( hDlg, 01372 "Hook installed.", 01373 "Information", MB_OK ); 01374 return (TRUE); 01375 01376 case WM_COMMAND: 01377 if (LOWORD(wParam) == IDOK) 01378 { 01379 if (MessageBox( hDlg, "Are you sure you want to print?", 01380 "Information", MB_YESNO ) == IDYES ) 01381 break; 01382 return (TRUE); 01383 01384 } 01385 break; 01386 } 01387 return (FALSE); 01388 01389 // avoid compiler warnings at W3 01390 lParam; 01391 01392 }

void PrintFile HWND   ) 
 

Definition at line 1418 of file aug98/test/main.c.

01419 { 01420 01421 01422 // initialize PRINTDLG structure 01423 pd.lStructSize = sizeof(PRINTDLG); 01424 pd.hwndOwner = hWnd; 01425 pd.hDevMode = (HANDLE)NULL; 01426 pd.hDevNames = (HANDLE)NULL; 01427 pd.nFromPage = 0; 01428 pd.nToPage = 0; 01429 pd.nMinPage = 0; 01430 pd.nMaxPage = 0; 01431 pd.nCopies = 0; 01432 pd.hInstance = (HANDLE)hInst; 01433 01434 01435 switch( wMode ) 01436 { 01437 case IDM_STANDARD: 01438 pd.Flags = PD_RETURNDC | PD_NOPAGENUMS | PD_NOSELECTION | PD_PRINTSETUP; 01439 pd.lpfnSetupHook = (LPSETUPHOOKPROC)(FARPROC)NULL; 01440 pd.lpSetupTemplateName = (LPSTR)NULL; 01441 pd.lpfnPrintHook = (LPPRINTHOOKPROC)(FARPROC)NULL; 01442 pd.lpPrintTemplateName = (LPSTR)NULL; 01443 break; 01444 01445 case IDM_HOOK: 01446 pd.Flags = PD_RETURNDC | PD_NOPAGENUMS | PD_NOSELECTION | 01447 PD_ENABLEPRINTHOOK | PD_ENABLESETUPHOOK | PD_PRINTSETUP; 01448 pd.lpfnSetupHook = (LPSETUPHOOKPROC)MakeProcInstance(PrintSetupHookProc, NULL); 01449 pd.lpSetupTemplateName = (LPSTR)NULL; 01450 pd.lpfnPrintHook = (LPPRINTHOOKPROC)MakeProcInstance(PrintDlgHookProc, NULL); 01451 pd.lpPrintTemplateName = (LPSTR)NULL; 01452 break; 01453 01454 case IDM_CUSTOM: 01455 pd.Flags = PD_RETURNDC | PD_NOPAGENUMS | PD_NOSELECTION | 01456 PD_ENABLEPRINTHOOK | PD_ENABLEPRINTTEMPLATE | 01457 PD_ENABLESETUPHOOK | PD_ENABLESETUPTEMPLATE | PD_PRINTSETUP; 01458 pd.lpfnSetupHook = (LPSETUPHOOKPROC)MakeProcInstance(PrintSetupHookProc, NULL); 01459 pd.lpSetupTemplateName = (LPSTR)MAKEINTRESOURCE(PRNSETUPDLGORD); 01460 pd.lpfnPrintHook = (LPPRINTHOOKPROC)MakeProcInstance(PrintDlgHookProc, NULL); 01461 pd.lpPrintTemplateName = (LPSTR)MAKEINTRESOURCE(PRINTDLGORD); 01462 break; 01463 01464 } 01465 01466 //print a test page if successful 01467 if (PrintDlg(&pd) == TRUE) 01468 { 01469 Escape(pd.hDC, STARTDOC, 8, "Test-Doc", NULL); 01470 01471 //Print text 01472 TextOut(pd.hDC, 5, 5, FileBuf, strlen(FileBuf)); 01473 01474 Escape(pd.hDC, NEWFRAME, 0, NULL, NULL); 01475 Escape(pd.hDC, ENDDOC, 0, NULL, NULL ); 01476 DeleteDC(pd.hDC); 01477 if (pd.hDevMode) 01478 GlobalFree(pd.hDevMode); 01479 if (pd.hDevNames) 01480 GlobalFree(pd.hDevNames); 01481 } 01482 else 01483 ProcessCDError(CommDlgExtendedError(), hWnd ); 01484 }

BOOL CALLBACK PrintSetupHookProc HWND  ,
UINT  ,
WPARAM  ,
LPARAM 
 

Definition at line 1304 of file aug98/test/main.c.

01309 { 01310 01311 switch (message) 01312 { 01313 case WM_INITDIALOG: 01314 if (pd.Flags & PD_ENABLESETUPTEMPLATE ) 01315 { 01316 ShowWindow( GetDlgItem(hDlg, psh1), SW_HIDE ); 01317 return(TRUE); 01318 } 01319 MessageBox( hDlg, 01320 "Hook installed.", 01321 "Information", MB_OK ); 01322 return (TRUE); 01323 } 01324 return (FALSE); 01325 01326 // avoid compiler warnings at W3 01327 lParam; 01328 wParam; 01329 }

void ProcessCDError DWORD  ,
HWND 
 

Definition at line 1826 of file aug98/test/main.c.

01827 { 01828 WORD wStringID; 01829 CHAR buf[256]; 01830 01831 switch(dwErrorCode) 01832 { 01833 case CDERR_DIALOGFAILURE: wStringID=IDS_DIALOGFAILURE; break; 01834 case CDERR_STRUCTSIZE: wStringID=IDS_STRUCTSIZE; break; 01835 case CDERR_INITIALIZATION: wStringID=IDS_INITIALIZATION; break; 01836 case CDERR_NOTEMPLATE: wStringID=IDS_NOTEMPLATE; break; 01837 case CDERR_NOHINSTANCE: wStringID=IDS_NOHINSTANCE; break; 01838 case CDERR_LOADSTRFAILURE: wStringID=IDS_LOADSTRFAILURE; break; 01839 case CDERR_FINDRESFAILURE: wStringID=IDS_FINDRESFAILURE; break; 01840 case CDERR_LOADRESFAILURE: wStringID=IDS_LOADRESFAILURE; break; 01841 case CDERR_LOCKRESFAILURE: wStringID=IDS_LOCKRESFAILURE; break; 01842 case CDERR_MEMALLOCFAILURE: wStringID=IDS_MEMALLOCFAILURE; break; 01843 case CDERR_MEMLOCKFAILURE: wStringID=IDS_MEMLOCKFAILURE; break; 01844 case CDERR_NOHOOK: wStringID=IDS_NOHOOK; break; 01845 case PDERR_SETUPFAILURE: wStringID=IDS_SETUPFAILURE; break; 01846 case PDERR_PARSEFAILURE: wStringID=IDS_PARSEFAILURE; break; 01847 case PDERR_RETDEFFAILURE: wStringID=IDS_RETDEFFAILURE; break; 01848 case PDERR_LOADDRVFAILURE: wStringID=IDS_LOADDRVFAILURE; break; 01849 case PDERR_GETDEVMODEFAIL: wStringID=IDS_GETDEVMODEFAIL; break; 01850 case PDERR_INITFAILURE: wStringID=IDS_INITFAILURE; break; 01851 case PDERR_NODEVICES: wStringID=IDS_NODEVICES; break; 01852 case PDERR_NODEFAULTPRN: wStringID=IDS_NODEFAULTPRN; break; 01853 case PDERR_DNDMMISMATCH: wStringID=IDS_DNDMMISMATCH; break; 01854 case PDERR_CREATEICFAILURE: wStringID=IDS_CREATEICFAILURE; break; 01855 case PDERR_PRINTERNOTFOUND: wStringID=IDS_PRINTERNOTFOUND; break; 01856 case CFERR_NOFONTS: wStringID=IDS_NOFONTS; break; 01857 case FNERR_SUBCLASSFAILURE: wStringID=IDS_SUBCLASSFAILURE; break; 01858 case FNERR_INVALIDFILENAME: wStringID=IDS_INVALIDFILENAME; break; 01859 case FNERR_BUFFERTOOSMALL: wStringID=IDS_BUFFERTOOSMALL; break; 01860 01861 case 0: //User may have hit CANCEL or we got a *very* random error 01862 return; 01863 01864 default: 01865 wStringID=IDS_UNKNOWNERROR; 01866 } 01867 01868 LoadString(NULL, wStringID, buf, sizeof(buf)); 01869 MessageBox(hWnd, buf, NULL, MB_OK); 01870 return; 01871 }

BOOL CALLBACK ReplaceTextHookProc HWND  ,
UINT  ,
WPARAM  ,
LPARAM 
 

Definition at line 1506 of file aug98/test/main.c.

01511 { 01512 switch (message) 01513 { 01514 case WM_INITDIALOG: 01515 if (frText.Flags & FR_ENABLETEMPLATE ) 01516 { 01517 ShowWindow( GetDlgItem(hDlg, psh2), SW_HIDE ); 01518 ShowWindow( GetDlgItem(hDlg, chx1), SW_HIDE ); 01519 ShowWindow( GetDlgItem(hDlg, chx2), SW_HIDE ); 01520 } 01521 MessageBox( hDlg, 01522 "Hook installed.", 01523 "Information", MB_OK ); 01524 return (TRUE); 01525 01526 01527 default: 01528 break; 01529 } 01530 return (FALSE); 01531 01532 // avoid compiler warnings at W3 01533 lParam; 01534 wParam; 01535 }

BOOL SaveAs HWND   ) 
 

Definition at line 948 of file aug98/test/main.c.

00949 { 00950 int i; 00951 00952 // strcpy( szFile, ""); 00953 // strcpy( szFileTitle, ""); 00954 00955 for ( i = lstrlen(OpenFileName.lpstrFileTitle); i > 0; i--) 00956 { 00957 if (OpenFileName.lpstrFileTitle[i] == '.') break; 00958 } 00959 i ++; 00960 if (wCSAorCRD == IDM_CSA) 00961 { 00962 OpenFileName.lpstrFileTitle[i++] = 'C'; 00963 OpenFileName.lpstrFileTitle[i++] = 'S'; 00964 OpenFileName.lpstrFileTitle[i++] = 'A'; 00965 OpenFileName.lpstrFileTitle[i] = 0; 00966 } 00967 else if ((wCSAorCRD == IDM_CRD) || 00968 (wCSAorCRD == IDM_PROFCRD)) 00969 { 00970 OpenFileName.lpstrFileTitle[i++] = 'C'; 00971 OpenFileName.lpstrFileTitle[i++] = 'R'; 00972 OpenFileName.lpstrFileTitle[i++] = 'D'; 00973 OpenFileName.lpstrFileTitle[i] = 0; 00974 } 00975 else 00976 { 00977 OpenFileName.lpstrFileTitle[i++] = 'I'; 00978 OpenFileName.lpstrFileTitle[i++] = 'N'; 00979 OpenFileName.lpstrFileTitle[i++] = 'T'; 00980 OpenFileName.lpstrFileTitle[i] = 0; 00981 } 00982 strcpy(OpenFileName.lpstrFile, OpenFileName.lpstrFileTitle); 00983 00984 OpenFileName.lStructSize = sizeof(OPENFILENAME); 00985 OpenFileName.hwndOwner = hWnd; 00986 OpenFileName.hInstance = (HANDLE) hInst; 00987 OpenFileName.lpstrFilter = szSaveFilter; 00988 OpenFileName.lpstrCustomFilter = (LPSTR) NULL; 00989 OpenFileName.nMaxCustFilter = 0L; 00990 OpenFileName.nFilterIndex = 1L; 00991 OpenFileName.nMaxFile = sizeof(szFile); 00992 OpenFileName.nMaxFileTitle = sizeof(szFileTitle); 00993 OpenFileName.lpstrInitialDir = NULL; 00994 OpenFileName.lpstrTitle = "Save File As"; 00995 OpenFileName.nFileOffset = 0; 00996 OpenFileName.nFileExtension = 0; 00997 OpenFileName.lpstrDefExt = "*.csa"; 00998 OpenFileName.lCustData = 0; 00999 01000 switch( wMode ) 01001 { 01002 case IDM_STANDARD: 01003 OpenFileName.Flags = 0L; 01004 OpenFileName.lpfnHook = (LPOFNHOOKPROC)(FARPROC)NULL; 01005 OpenFileName.lpTemplateName = (LPSTR)NULL; 01006 break; 01007 01008 case IDM_HOOK: 01009 OpenFileName.Flags = OFN_ENABLEHOOK; 01010 OpenFileName.lpfnHook = (LPOFNHOOKPROC)MakeProcInstance(FileSaveHookProc, NULL); 01011 OpenFileName.lpTemplateName = (LPSTR)NULL; 01012 break; 01013 01014 case IDM_CUSTOM: 01015 OpenFileName.Flags = OFN_ENABLEHOOK | OFN_ENABLETEMPLATE; 01016 OpenFileName.lpfnHook = (LPOFNHOOKPROC)MakeProcInstance(FileSaveHookProc, NULL); 01017 OpenFileName.lpTemplateName = (LPSTR)MAKEINTRESOURCE(FILEOPENORD); 01018 break; 01019 } 01020 01021 if ( GetSaveFileName( &OpenFileName )) 01022 { 01023 return (TRUE); 01024 } 01025 else 01026 { 01027 ProcessCDError(CommDlgExtendedError(), hWnd ); 01028 return FALSE; 01029 } 01030 01031 return (FALSE); 01032 }

BOOL SaveToFile HWND   ) 
 

Definition at line 826 of file aug98/test/main.c.

00827 { 00828 int hFile; 00829 OFSTRUCT OfStruct; 00830 WORD wStyle; 00831 CHAR buf[256]; 00832 00833 if (OpenFileName.Flags | OFN_FILEMUSTEXIST) 00834 wStyle = OF_READWRITE; 00835 else 00836 wStyle = OF_READWRITE | OF_CREATE; 00837 00838 if ((hFile = OpenFile(OpenFileName.lpstrFile, &OfStruct, 00839 wStyle)) == -1) 00840 { 00841 sprintf( buf, "Could not create file %s", OpenFileName.lpstrFile ); 00842 MessageBox( hWnd, buf, NULL, MB_OK ); 00843 return FALSE; 00844 } 00845 // write it's contents into a file 00846 if (_lwrite( hFile, (LPSTR)&FileBuf[0], dwFileSize)==-1) 00847 { 00848 MessageBox( hWnd, "Error writing file.", NULL, MB_OK ); 00849 return FALSE; 00850 } 00851 00852 // close the file 00853 _lclose( hFile ); 00854 00855 sprintf( buf, "%s", OpenFileName.lpstrFile ); 00856 MessageBox( hWnd, buf, "File Saved", MB_OK ); 00857 return TRUE; 00858 }

void SearchFile LPFINDREPLACE   ) 
 

Definition at line 1725 of file aug98/test/main.c.

01726 { 01727 01728 CHAR Buf[FILE_LEN]; 01729 CHAR *pStr; 01730 int count, newcount; 01731 static BOOL bFoundLast = FALSE; 01732 01733 if ( lpFR->Flags & ( FR_FINDNEXT | FR_REPLACE | FR_REPLACEALL ) ) 01734 { 01735 memset(Buf, '\0', FILE_LEN -1); 01736 if ( bFoundLast ) 01737 { 01738 if ( (lpBufPtr != FileBuf) && (lpFR->Flags & FR_FINDNEXT) ) 01739 lpBufPtr++; 01740 bFoundLast = FALSE; 01741 } 01742 01743 if (!*lpBufPtr || !(pStr = strstr( lpBufPtr, lpFR->lpstrFindWhat ) ) ) 01744 { 01745 sprintf( Buf, "'%s' not found!", lpFR->lpstrFindWhat ); 01746 lpBufPtr = FileBuf; 01747 MessageBox( lpFR->hwndOwner, Buf, "No luck", MB_OK | MB_TASKMODAL); 01748 } 01749 else 01750 { 01751 if ( lpFR->Flags & FR_FINDNEXT ) 01752 { 01753 sprintf( Buf, "Found Next '%s'!\nSubstring: '%.10s'", 01754 lpFR->lpstrFindWhat, pStr ); 01755 lpBufPtr = pStr; 01756 bFoundLast = TRUE; 01757 MessageBox( lpFR->hwndOwner, Buf, "Success!", MB_OK | MB_TASKMODAL ); 01758 } 01759 else if ( lpFR->Flags & FR_REPLACE ) 01760 { 01761 // replace string specified in the replace with found string 01762 // copy up to found string into new buffer 01763 for( count=0; 01764 *pStr && lpBufPtr[count] && *pStr != lpBufPtr[count]; 01765 count++); 01766 strncpy( Buf, lpBufPtr, count ); 01767 // concatenate new string 01768 strcat( Buf, lpFR->lpstrReplaceWith ); 01769 // copy rest of string (less the found string) 01770 newcount = count + strlen(lpFR->lpstrFindWhat); 01771 strcat( Buf, lpBufPtr+newcount); 01772 strcpy( lpBufPtr, Buf ); 01773 lpBufPtr += count + strlen(lpFR->lpstrReplaceWith); 01774 dwFileSize = strlen(FileBuf); 01775 MessageBox( lpFR->hwndOwner, FileBuf, "Success!", MB_OK | MB_TASKMODAL ); 01776 } 01777 else if ( lpFR->Flags & FR_REPLACEALL) 01778 { 01779 do 01780 { 01781 // replace string specified in the replace with found string 01782 // copy up to found string into new buffer 01783 memset(Buf, '\0', FILE_LEN -1); 01784 for( count=0; 01785 *pStr && lpBufPtr[count] && *pStr != lpBufPtr[count]; 01786 count++); 01787 strncpy( Buf, lpBufPtr, count ); 01788 // concatenate new string 01789 strcat( Buf, lpFR->lpstrReplaceWith ); 01790 // copy rest of string (less the found string) 01791 newcount = count + strlen(lpFR->lpstrFindWhat); 01792 strcat( Buf, lpBufPtr + newcount); 01793 strcpy( lpBufPtr, Buf ); 01794 lpBufPtr += count + strlen(lpFR->lpstrReplaceWith); 01795 } 01796 while ( *lpBufPtr && 01797 (pStr = strstr( lpBufPtr, lpFR->lpstrFindWhat ) ) ); 01798 dwFileSize = strlen(FileBuf); 01799 lpBufPtr = FileBuf; 01800 MessageBox( lpFR->hwndOwner, FileBuf, 01801 "Success!", MB_OK | MB_TASKMODAL ); 01802 } 01803 01804 } 01805 } 01806 }


Generated on Sat May 15 19:44:35 2004 for test by doxygen 1.3.7