home *** CD-ROM | disk | FTP | other *** search
- #include "demo_dlg.h"
-
- #define IDM_ABOUT 100
- #define IDM_OPEN 101
- #define IDM_CLOSE 102
- #define IDM_RESET 103
- #define IDM_FIELDS 104
- #define IDM_INSERT 105
- #define IDM_PRINT 106
- #define IDM_OTHER 107
- #define IDM_SEARCH 108
- #define IDM_PREVIEW 109
-
- #define MAX_WINDS 10
-
- HANDLE hInst,hPrevInst; // Stores the current and previous instances
- BOOL error_flag;
-
- /*****************************************************************************
- Prototypes for the internal demo functions.
- ******************************************************************************/
- int PASCAL WinMain(HINSTANCE, HINSTANCE, LPSTR, int);
- int CALLBACK _export DemoCloseDlg(HWND,UINT,WPARAM,LPARAM);
- int CALLBACK _export DemoResetDlg(HWND,UINT,WPARAM,LPARAM);
- int CALLBACK _export DemoSelectWin(HWND,UINT,WPARAM,LPARAM);
- int OurPrintf(LPSTR,...);
- BOOL CALLBACK _export DemoOpenDlg(HWND,UINT,WPARAM,LPARAM);
- BOOL CALLBACK _export DemoControlDlg(HWND,UINT,WPARAM,LPARAM);
- BOOL CALLBACK _export DemoFields(HWND,UINT,WPARAM,LPARAM);
- BOOL CALLBACK _export DemoInsertText(HWND,UINT,WPARAM,LPARAM);
- BOOL CALLBACK _export DemoPrintDlg(HWND,UINT,WPARAM,LPARAM);
- BOOL CALLBACK _export DemoSearchDlg(HWND,UINT,WPARAM,LPARAM);
- BOOL InitApplication(HINSTANCE);
- BOOL InitInstance(HINSTANCE, int);
- BOOL AssignIntValue(HWND,int,LPINT);
- BOOL AssignLongValue(HWND,int,LPLONG);
- BOOL CurrentPrinter(LPSTR,LPSTR,LPSTR);
- BOOL EditFont(HWND);
- BOOL DemoGetTerLine(HWND);
- BOOL DemoGetFontInfo(HWND);
- BOOL InsertText(HWND);
- BOOL DemoPreview(void);
- BOOL PrintText(HWND);
- BOOL SetDemoLong(HWND,int,long);
- BOOL GetDemoLong(HWND,int,long *);
- HDC OpenCurPrinter(HWND);
- LRESULT CALLBACK _export DemoWndProc(HWND,UINT,WPARAM,LPARAM);
- void CallTer(HANDLE);
- void MakeBuffer(HWND); // used in the demo program only
- void FarMove(LPSTR,LPSTR,UINT);
- void HugeMemMove(char huge *,char huge *,UINT);
-
- /*======================= global variables =====================================
- A set of control variables are passed by the user program to the TER routine.
- The variables are passed using the structure 'arg_list'. This structure
- is defined by the TER.H file. Your application module that calls the TER
- routine must include this file.
-
- The user program passes the POINTER to this structure.
- ================================================================================*/
-
- struct arg_list arg[MAX_WINDS]; // parameter structure to call ter function
- struct StrTerField field; /* parameter structure to call GetTerFields
- and SetTerFields functions */
-
- HWND hDemoWnd; // demo window handle
-
- int CurWnd;
-
- char PrevFile[128];
- char DemoLine[241]; // temporary line space
- WORD DemoWord; // temporary demo word variable
-
- // ****These variables are used to demonstrate inserting text into an existing
- // ****TER window. The new text can be inesrted with specified fonts/color
-
- char CurTypeface[32]="Arial"; // current type face to insert new text
- int CurPointSize=12; // current point size
- UINT CurStyle=0; // current character styles
- COLORREF CurColor=0; // current text color - black
- long CurLine=0; // current line to insert text into
- int CurCol=0; // current column position to insert text
- char NewText[2*MAX_WIDTH+1]; // text to be inserted
-
- // **** The following variables are used to demonstrate printing a file or buffer
- struct StrPrint prt;
- RECT PrtRect; // printing area
- HDC hPrtDC; // printer device context
- int PrtOutput=IDC_SPEC_PRINTER; // print to a specified printer
-
- // ***** Search/replace api flags
- char search[MAX_WIDTH+1], // search string
- replace[MAX_WIDTH+1]; // replace string
-
- UINT SearchFlags; // flags
-
- long SearchCurPos, // current position
- SearchEndPos, // end position
- SearchSize; // buffer size
-
- // unit conversion macros
- int ResX; // pixels per inch in x direction
- int ResY; // pixels per inch in y direction
-
- #define PixelToMmX(x) MulDiv(x,25,ResX)
- #define PixelToMmY(x) MulDiv(x,25,ResY)
-