Commit 261b3bdf2f58b3db861eff71d8967165ded73081

Authored by xiemeng
1 parent 107a69d6

new branch optekBlueTool

Too many changes to show.

To preserve performance only 27 of 42 files are displayed.

  1 +/*-----------------------------------------------------------------------------
  2 +
  3 + This is a part of the Microsoft Source Code Samples.
  4 + Copyright (C) 1995 Microsoft Corporation.
  5 + All rights reserved.
  6 + This source code is only intended as a supplement to
  7 + Microsoft Development Tools and/or WinHelp documentation.
  8 + See these sources for detailed information regarding the
  9 + Microsoft samples programs.
  10 +
  11 + MODULE: About.c
  12 +
  13 + PURPOSE: Implement the About dialog box for the program.
  14 +
  15 + FUNCTIONS:
  16 + CmdAbout - Creates the About dialog in response to menu selection
  17 + AboutDlgProc - Processes messages for the About dialog
  18 + InitAboutDlg - Initialzes about dialog controls
  19 +
  20 +-----------------------------------------------------------------------------*/
  21 +
  22 +
  23 +#include <windows.h>
  24 +#include "mttty.h"
  25 +
  26 +/*
  27 + Prototypes for functions called only in this file
  28 +*/
  29 +BOOL CALLBACK AboutDlgProc( HWND, UINT, WPARAM, LPARAM );
  30 +UINT InitAboutDlg( HWND );
  31 +
  32 +/*-----------------------------------------------------------------------------
  33 +
  34 +FUNCTION: CmdAbout( HWND )
  35 +
  36 +PARAMETERS:
  37 + hwnd - Owner of the window
  38 +
  39 +PURPOSE: Creates the modal About dialog
  40 +
  41 +-----------------------------------------------------------------------------*/
  42 +BOOL CmdAbout(HWND hwnd)
  43 +{
  44 + DialogBox(ghInst, MAKEINTRESOURCE(IDD_ABOUT), hwnd, AboutDlgProc);
  45 + return 0;
  46 +}
  47 +
  48 +/*-----------------------------------------------------------------------------
  49 +
  50 +FUNCTION: InitAboutDlg( HWND )
  51 +
  52 +PURPOSE: Initializes the modal About dialog
  53 +
  54 +PARMATETERS:
  55 + hDlg - Dialog window handle
  56 +
  57 +COMMENTS: Sets the icon animation timer and the version info.
  58 +
  59 +HISTORY: Date: Author: Comment:
  60 + 10/27/95 AllenD Wrote it
  61 +
  62 +-----------------------------------------------------------------------------*/
  63 +UINT InitAboutDlg(HWND hDlg)
  64 +{
  65 + UINT uTimer;
  66 + char * szFormat = "Microsoft Windows %s\r\nVersion %d.%d\r\nBuild %d ";
  67 + char szVersion[256];
  68 +
  69 + /*
  70 + create timer and set initial icon id
  71 + */
  72 + uTimer = SetTimer(hDlg, 1, 100, NULL);
  73 + if (uTimer == 0)
  74 + ErrorReporter("SetTimer");
  75 + wsprintf(szVersion, szFormat,
  76 + gOSV.dwPlatformId == VER_PLATFORM_WIN32_NT ? "NT" : "95",
  77 + gOSV.dwMajorVersion,
  78 + gOSV.dwMinorVersion,
  79 + LOWORD( gOSV.dwBuildNumber ) );
  80 +
  81 + if (strlen(gOSV.szCSDVersion))
  82 + strcat(szVersion, gOSV.szCSDVersion);
  83 +
  84 + SetDlgItemText(hDlg, IDC_OSVERSIONINFO, szVersion);
  85 +
  86 + return uTimer;
  87 +}
  88 +
  89 +/*-----------------------------------------------------------------------------
  90 +
  91 +FUNCTION: AboutDlgProc(HWND, UINT, WPARAM, LPARAM)
  92 +
  93 +PURPOSE: Dialog procedure for the "About Box"
  94 +
  95 +PARAMETERS:
  96 + hdlg - dialog window handle
  97 + uMessage - window message
  98 + wparam - message parameter (depends on message value)
  99 + lparam - message prarmeter (depends on message value)
  100 +
  101 +HISTORY: Date: Author: Comment:
  102 + 10/27/95 AllenD Wrote it
  103 +
  104 +-----------------------------------------------------------------------------*/
  105 +BOOL CALLBACK AboutDlgProc(HWND hdlg, UINT uMessage, WPARAM wparam, LPARAM lparam)
  106 +{
  107 + static UINT uTimer;
  108 + static WORD wCurrentIconId;
  109 +
  110 + switch(uMessage)
  111 + {
  112 + case WM_INITDIALOG:
  113 + uTimer = InitAboutDlg(hdlg);
  114 + wCurrentIconId = IDI_APPICON;
  115 + break;
  116 +
  117 + case WM_TIMER:
  118 + /*
  119 + when timer goes off, then change to next icon
  120 + */
  121 + {
  122 + HICON hIcon;
  123 +
  124 + switch(wCurrentIconId)
  125 + {
  126 + case IDI_APPICON: wCurrentIconId = IDI_APPICON2; break;
  127 + case IDI_APPICON2: wCurrentIconId = IDI_APPICON3; break;
  128 + case IDI_APPICON3: wCurrentIconId = IDI_APPICON4; break;
  129 + case IDI_APPICON4: wCurrentIconId = IDI_APPICON; break;
  130 + }
  131 +
  132 + hIcon = LoadIcon(ghInst, MAKEINTRESOURCE(wCurrentIconId));
  133 + SendMessage(GetDlgItem(hdlg, IDC_PICTURE), STM_SETICON, (WPARAM) hIcon, 0);
  134 + }
  135 + break;
  136 +
  137 + case WM_COMMAND:
  138 + if (LOWORD(wparam) == IDOK) {
  139 + KillTimer(hdlg, uTimer);
  140 + EndDialog(hdlg, TRUE);
  141 + return TRUE;
  142 + }
  143 + break;
  144 + }
  145 +
  146 + return FALSE;
  147 +}
  148 +
... ...
  1 +MTTTY: Multi-threaded Terminal Sample (Win32)
  2 +
  3 +MTTTY illustrates overlapped serial communication
  4 +using multiple threads.
  5 +
  6 +MTTTY is a companion sample for the "Serial
  7 +Communication in Win32" technical article
  8 +in the Microsoft(R) Developer Network Library.
  9 +
  10 +MTTTY was built and tested under Microsoft Windows(TM)
  11 +95 and Microsoft Windows NT 3.51 using Microsoft
  12 +Visual C/C++ version 2.0 and the combined Win32 SDK
  13 +for Windows 95 and Windows NT.
  14 +
  15 +How it works:
  16 +
  17 +The program utilizes 3 threads. A main thread initializes the comm
  18 +port and maintains the user interface while two working threads
  19 +do all the serial communication work.
  20 +
  21 +A reader/status thread is created to handle port reading and to
  22 +monitor status events. The thread issues an overlapped read
  23 +operation and an overlapped status operation. When one of
  24 +these operation completes, it is handled and information is
  25 +imparted to the user. If a timeout occurs waiting for an operation
  26 +to complete, background work is performed.
  27 +
  28 +A writer thread is created to accept output requests and send them
  29 +out the comm port. The writer thread utilizes a work queue. Each
  30 +output request is placed on a linked list in a private heap and a
  31 +syncrhonization event is signaled to indicated new work. When the
  32 +writer thread is available to do work, it will retrieve the
  33 +output request and perform the output.
  34 +
  35 +Caution:
  36 +
  37 +This sample utilizes multiple threads only for the sake of simplicity
  38 +and performance. A more efficient method for this program might
  39 +be to have a single thread perform all i/o requests and then
  40 +wait on multiple handles for each operation to complete.
  41 +Creating multiple threads just for the sake of simplicity
  42 +in a full blown application may not be best implementation.
  43 +
  44 +I chose the model for reasons specific to file transfer. I wanted
  45 +reading and writing to be completely separate operations not dependant
  46 +on each other in any way.
  47 +
  48 +
  49 +KEYWORDS: MTTTY
... ...
1   -; CLW file contains information for the MFC ClassWizard
2   -
3   -[General Info]
4   -Version=1
5   -LastClass=CBlueFlashToolDlg
6   -LastTemplate=CDialog
7   -NewFileInclude1=#include "stdafx.h"
8   -NewFileInclude2=#include "BlueFlashTool.h"
9   -
10   -ClassCount=2
11   -Class1=CBlueFlashToolApp
12   -Class2=CBlueFlashToolDlg
13   -
14   -ResourceCount=4
15   -Resource2=IDR_MAINFRAME
16   -Resource3=IDD_BLUEFLASHTOOL_DIALOG
17   -Resource4=IDD_SYSTEM_CONFIG
18   -
19   -[CLS:CBlueFlashToolApp]
20   -Type=0
21   -HeaderFile=BlueFlashTool.h
22   -ImplementationFile=BlueFlashTool.cpp
23   -Filter=N
24   -
25   -[CLS:CBlueFlashToolDlg]
26   -Type=0
27   -HeaderFile=BlueFlashToolDlg.h
28   -ImplementationFile=BlueFlashToolDlg.cpp
29   -Filter=D
30   -BaseClass=CDialog
31   -VirtualFilter=dWC
32   -LastObject=IDC_MSCOMM0
33   -
34   -
35   -
36   -[DLG:IDD_BLUEFLASHTOOL_DIALOG]
37   -Type=1
38   -Class=CBlueFlashToolDlg
39   -ControlCount=94
40   -Control1=IDC_STATIC_GROUP01,button,1342177287
41   -Control2=IDC_CHECK_EAR01,button,1342242819
42   -Control3=IDC_CHECK_USB01,button,1342242819
43   -Control4=IDC_PROGRESS_EAR01,msctls_progress32,1350565889
44   -Control5=IDC_PROGRESS_USB01,msctls_progress32,1350565889
45   -Control6=IDC_BUTTON_START_EAR01,button,1342242816
46   -Control7=IDC_BUTTON_START_USB01,button,1342242816
47   -Control8=IDC_STATIC_GROUP2,button,1342177287
48   -Control9=IDC_CHECK_EAR2,button,1342242819
49   -Control10=IDC_CHECK_USB2,button,1342242819
50   -Control11=IDC_PROGRESS_EAR2,msctls_progress32,1350565889
51   -Control12=IDC_PROGRESS_USB2,msctls_progress32,1350565889
52   -Control13=IDC_BUTTON_START_EAR2,button,1342242816
53   -Control14=IDC_BUTTON_START_USB2,button,1342242816
54   -Control15=IDC_STATIC_GROUP3,button,1342177287
55   -Control16=IDC_CHECK_EAR3,button,1342242819
56   -Control17=IDC_CHECK_USB3,button,1342242819
57   -Control18=IDC_PROGRESS_EAR3,msctls_progress32,1350565889
58   -Control19=IDC_PROGRESS_USB3,msctls_progress32,1350565889
59   -Control20=IDC_BUTTON_START_EAR3,button,1342242816
60   -Control21=IDC_BUTTON_START_USB3,button,1342242816
61   -Control22=IDC_STATIC_GROUP4,button,1342177287
62   -Control23=IDC_CHECK_EAR4,button,1342242819
63   -Control24=IDC_CHECK_USB4,button,1342242819
64   -Control25=IDC_PROGRESS_EAR4,msctls_progress32,1350565889
65   -Control26=IDC_PROGRESS_USB4,msctls_progress32,1350565889
66   -Control27=IDC_BUTTON_START_EAR4,button,1342242816
67   -Control28=IDC_BUTTON_START_USB4,button,1342242816
68   -Control29=IDC_STATIC_GROUP5,button,1342177287
69   -Control30=IDC_CHECK_EAR5,button,1342242819
70   -Control31=IDC_CHECK_USB5,button,1342242819
71   -Control32=IDC_PROGRESS_EAR5,msctls_progress32,1350565889
72   -Control33=IDC_PROGRESS_USB5,msctls_progress32,1350565889
73   -Control34=IDC_BUTTON_START_EAR5,button,1342242816
74   -Control35=IDC_BUTTON_START_USB5,button,1342242816
75   -Control36=IDC_STATIC_GROUP6,button,1342177287
76   -Control37=IDC_CHECK_EAR6,button,1342242819
77   -Control38=IDC_CHECK_USB6,button,1342242819
78   -Control39=IDC_PROGRESS_EAR6,msctls_progress32,1350565889
79   -Control40=IDC_PROGRESS_USB6,msctls_progress32,1350565889
80   -Control41=IDC_BUTTON_START_EAR6,button,1342242816
81   -Control42=IDC_BUTTON_START_USB6,button,1342242816
82   -Control43=IDC_STATIC_GROUP7,button,1342177287
83   -Control44=IDC_CHECK_EAR7,button,1342242819
84   -Control45=IDC_CHECK_USB7,button,1342242819
85   -Control46=IDC_PROGRESS_EAR7,msctls_progress32,1350565889
86   -Control47=IDC_PROGRESS_USB7,msctls_progress32,1350565889
87   -Control48=IDC_BUTTON_START_EAR7,button,1342242816
88   -Control49=IDC_BUTTON_START_USB7,button,1342242816
89   -Control50=IDC_STATIC_GROUP8,button,1342177287
90   -Control51=IDC_CHECK_EAR8,button,1342242819
91   -Control52=IDC_CHECK_USB8,button,1342242819
92   -Control53=IDC_PROGRESS_EAR8,msctls_progress32,1350565889
93   -Control54=IDC_PROGRESS_USB8,msctls_progress32,1350565889
94   -Control55=IDC_BUTTON_START_EAR8,button,1342242816
95   -Control56=IDC_BUTTON_START_USB8,button,1342242816
96   -Control57=IDC_STATIC_GROUP9,button,1342177287
97   -Control58=IDC_CHECK_EAR9,button,1342242819
98   -Control59=IDC_CHECK_USB9,button,1342242819
99   -Control60=IDC_PROGRESS_EAR9,msctls_progress32,1350565889
100   -Control61=IDC_PROGRESS_USB9,msctls_progress32,1350565889
101   -Control62=IDC_BUTTON_START_EAR9,button,1342242816
102   -Control63=IDC_BUTTON_START_USB9,button,1342242816
103   -Control64=IDC_STATIC_GROUP10,button,1342177287
104   -Control65=IDC_CHECK_EAR10,button,1342242819
105   -Control66=IDC_CHECK_USB10,button,1342242819
106   -Control67=IDC_PROGRESS_EAR10,msctls_progress32,1350565889
107   -Control68=IDC_PROGRESS_USB10,msctls_progress32,1350565889
108   -Control69=IDC_BUTTON_START_EAR10,button,1342242816
109   -Control70=IDC_BUTTON_START_USB10,button,1342242816
110   -Control71=IDC_START_ALL,button,1342242816
111   -Control72=IDC_STOP_ALL,button,1342242816
112   -Control73=IDC_BUTTON_SETTING,button,1342242816
113   -Control74=IDC_MSCOMM0,{648A5600-2C6E-101B-82B6-000000000014},1342242816
114   -Control75=IDC_MSCOMM1,{648A5600-2C6E-101B-82B6-000000000014},1342242816
115   -Control76=IDC_MSCOMM2,{648A5600-2C6E-101B-82B6-000000000014},1342242816
116   -Control77=IDC_MSCOMM3,{648A5600-2C6E-101B-82B6-000000000014},1342242816
117   -Control78=IDC_MSCOMM4,{648A5600-2C6E-101B-82B6-000000000014},1342242816
118   -Control79=IDC_MSCOMM5,{648A5600-2C6E-101B-82B6-000000000014},1342242816
119   -Control80=IDC_MSCOMM6,{648A5600-2C6E-101B-82B6-000000000014},1342242816
120   -Control81=IDC_MSCOMM7,{648A5600-2C6E-101B-82B6-000000000014},1342242816
121   -Control82=IDC_MSCOMM8,{648A5600-2C6E-101B-82B6-000000000014},1342242816
122   -Control83=IDC_MSCOMM9,{648A5600-2C6E-101B-82B6-000000000014},1342242816
123   -Control84=IDC_MSCOMM10,{648A5600-2C6E-101B-82B6-000000000014},1342242816
124   -Control85=IDC_MSCOMM11,{648A5600-2C6E-101B-82B6-000000000014},1342242816
125   -Control86=IDC_MSCOMM12,{648A5600-2C6E-101B-82B6-000000000014},1342242816
126   -Control87=IDC_MSCOMM13,{648A5600-2C6E-101B-82B6-000000000014},1342242816
127   -Control88=IDC_MSCOMM14,{648A5600-2C6E-101B-82B6-000000000014},1342242816
128   -Control89=IDC_MSCOMM15,{648A5600-2C6E-101B-82B6-000000000014},1342242816
129   -Control90=IDC_MSCOMM16,{648A5600-2C6E-101B-82B6-000000000014},1342242816
130   -Control91=IDC_MSCOMM17,{648A5600-2C6E-101B-82B6-000000000014},1342242816
131   -Control92=IDC_MSCOMM18,{648A5600-2C6E-101B-82B6-000000000014},1342242816
132   -Control93=IDC_MSCOMM19,{648A5600-2C6E-101B-82B6-000000000014},1342242816
133   -Control94=IDC_MSCOMM20,{648A5600-2C6E-101B-82B6-000000000014},1342242816
134   -
135   -[DLG:IDD_SYSTEM_CONFIG]
136   -Type=1
137   -Class=?
138   -ControlCount=2
139   -Control1=IDOK,button,1342242817
140   -Control2=IDCANCEL,button,1342242816
141   -
1   -// BlueFlashTool.cpp : Defines the class behaviors for the application.
2   -//
3   -
4   -#include "stdafx.h"
5   -#include "BlueFlashTool.h"
6   -#include "BlueFlashToolDlg.h"
7   -
8   -#ifdef _DEBUG
9   -#define new DEBUG_NEW
10   -#undef THIS_FILE
11   -static char THIS_FILE[] = __FILE__;
12   -#endif
13   -
14   -/////////////////////////////////////////////////////////////////////////////
15   -// CBlueFlashToolApp
16   -
17   -BEGIN_MESSAGE_MAP(CBlueFlashToolApp, CWinApp)
18   - //{{AFX_MSG_MAP(CBlueFlashToolApp)
19   - // NOTE - the ClassWizard will add and remove mapping macros here.
20   - // DO NOT EDIT what you see in these blocks of generated code!
21   - //}}AFX_MSG
22   - ON_COMMAND(ID_HELP, CWinApp::OnHelp)
23   -END_MESSAGE_MAP()
24   -
25   -/////////////////////////////////////////////////////////////////////////////
26   -// CBlueFlashToolApp construction
27   -
28   -CBlueFlashToolApp::CBlueFlashToolApp()
29   -{
30   - // TODO: add construction code here,
31   - // Place all significant initialization in InitInstance
32   -}
33   -
34   -/////////////////////////////////////////////////////////////////////////////
35   -// The one and only CBlueFlashToolApp object
36   -
37   -CBlueFlashToolApp theApp;
38   -
39   -/////////////////////////////////////////////////////////////////////////////
40   -// CBlueFlashToolApp initialization
41   -
42   -BOOL CBlueFlashToolApp::InitInstance()
43   -{
44   - AfxEnableControlContainer();
45   -
46   - // Standard initialization
47   - // If you are not using these features and wish to reduce the size
48   - // of your final executable, you should remove from the following
49   - // the specific initialization routines you do not need.
50   -
51   -#ifdef _AFXDLL
52   - Enable3dControls(); // Call this when using MFC in a shared DLL
53   -#else
54   - Enable3dControlsStatic(); // Call this when linking to MFC statically
55   -#endif
56   -
57   - CBlueFlashToolDlg dlg;
58   - m_pMainWnd = &dlg;
59   - int nResponse = dlg.DoModal();
60   - if (nResponse == IDOK)
61   - {
62   - // TODO: Place code here to handle when the dialog is
63   - // dismissed with OK
64   - }
65   - else if (nResponse == IDCANCEL)
66   - {
67   - // TODO: Place code here to handle when the dialog is
68   - // dismissed with Cancel
69   - }
70   -
71   - // Since the dialog has been closed, return FALSE so that we exit the
72   - // application, rather than start the application's message pump.
73   - return FALSE;
74   -}
1   -// BlueFlashTool.h : main header file for the BLUEFLASHTOOL application
2   -//
3   -
4   -#if !defined(AFX_BLUEFLASHTOOL_H__4BF81738_BBD5_4BEA_BCA8_BB0255AFF8C2__INCLUDED_)
5   -#define AFX_BLUEFLASHTOOL_H__4BF81738_BBD5_4BEA_BCA8_BB0255AFF8C2__INCLUDED_
6   -
7   -#if _MSC_VER > 1000
8   -#pragma once
9   -#endif // _MSC_VER > 1000
10   -
11   -#ifndef __AFXWIN_H__
12   - #error include 'stdafx.h' before including this file for PCH
13   -#endif
14   -
15   -#include "resource.h" // main symbols
16   -
17   -/////////////////////////////////////////////////////////////////////////////
18   -// CBlueFlashToolApp:
19   -// See BlueFlashTool.cpp for the implementation of this class
20   -//
21   -
22   -class CBlueFlashToolApp : public CWinApp
23   -{
24   -public:
25   - CBlueFlashToolApp();
26   -
27   -// Overrides
28   - // ClassWizard generated virtual function overrides
29   - //{{AFX_VIRTUAL(CBlueFlashToolApp)
30   - public:
31   - virtual BOOL InitInstance();
32   - //}}AFX_VIRTUAL
33   -
34   -// Implementation
35   -
36   - //{{AFX_MSG(CBlueFlashToolApp)
37   - // NOTE - the ClassWizard will add and remove member functions here.
38   - // DO NOT EDIT what you see in these blocks of generated code !
39   - //}}AFX_MSG
40   - DECLARE_MESSAGE_MAP()
41   -};
42   -
43   -
44   -/////////////////////////////////////////////////////////////////////////////
45   -
46   -//{{AFX_INSERT_LOCATION}}
47   -// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
48   -
49   -#endif // !defined(AFX_BLUEFLASHTOOL_H__4BF81738_BBD5_4BEA_BCA8_BB0255AFF8C2__INCLUDED_)
No preview for this file type
1   -<html>
2   -<body>
3   -<pre>
4   -<h1>Build Log</h1>
5   -<h3>
6   ---------------------Configuration: BlueFlashTool - Win32 Debug--------------------
7   -</h3>
8   -<h3>Command Lines</h3>
9   -Creating command line "rc.exe /l 0x804 /fo"Debug/BlueFlashTool.res" /d "_DEBUG" /d "_AFXDLL" "H:\BlueFlashTool\BlueFlashTool.rc""
10   -Creating temporary file "C:\Users\ADMINI~1\AppData\Local\Temp\RSPDF66.tmp" with contents
11   -[
12   -/nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Fp"Debug/BlueFlashTool.pch" /Yu"stdafx.h" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c
13   -"H:\BlueFlashTool\BlueFlashTool.cpp"
14   -"H:\BlueFlashTool\BlueFlashToolDlg.cpp"
15   -"H:\BlueFlashTool\mscomm.cpp"
16   -]
17   -Creating command line "cl.exe @C:\Users\ADMINI~1\AppData\Local\Temp\RSPDF66.tmp"
18   -Creating temporary file "C:\Users\ADMINI~1\AppData\Local\Temp\RSPDF76.tmp" with contents
19   -[
20   -/nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Fp"Debug/BlueFlashTool.pch" /Yc"stdafx.h" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c
21   -"H:\BlueFlashTool\StdAfx.cpp"
22   -]
23   -Creating command line "cl.exe @C:\Users\ADMINI~1\AppData\Local\Temp\RSPDF76.tmp"
24   -Creating temporary file "C:\Users\ADMINI~1\AppData\Local\Temp\RSPDF77.tmp" with contents
25   -[
26   -/nologo /subsystem:windows /incremental:yes /pdb:"Debug/BlueFlashTool.pdb" /debug /machine:I386 /out:"Debug/BlueFlashTool.exe" /pdbtype:sept
27   -.\Debug\BlueFlashTool.obj
28   -.\Debug\BlueFlashToolDlg.obj
29   -.\Debug\mscomm.obj
30   -.\Debug\StdAfx.obj
31   -.\Debug\BlueFlashTool.res
32   -]
33   -Creating command line "link.exe @C:\Users\ADMINI~1\AppData\Local\Temp\RSPDF77.tmp"
34   -<h3>Output Window</h3>
35   -Compiling resources...
36   -Compiling...
37   -StdAfx.cpp
38   -Compiling...
39   -BlueFlashTool.cpp
40   -BlueFlashToolDlg.cpp
41   -mscomm.cpp
42   -Generating Code...
43   -Linking...
44   -
45   -
46   -
47   -<h3>Results</h3>
48   -BlueFlashTool.exe - 0 error(s), 0 warning(s)
49   -</pre>
50   -</body>
51   -</html>
1   -//Microsoft Developer Studio generated resource script.
2   -//
3   -#include "resource.h"
4   -
5   -#define APSTUDIO_READONLY_SYMBOLS
6   -/////////////////////////////////////////////////////////////////////////////
7   -//
8   -// Generated from the TEXTINCLUDE 2 resource.
9   -//
10   -#include "afxres.h"
11   -
12   -/////////////////////////////////////////////////////////////////////////////
13   -#undef APSTUDIO_READONLY_SYMBOLS
14   -
15   -/////////////////////////////////////////////////////////////////////////////
16   -// Chinese (P.R.C.) resources
17   -
18   -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
19   -#ifdef _WIN32
20   -LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
21   -#pragma code_page(936)
22   -#endif //_WIN32
23   -
24   -#ifdef APSTUDIO_INVOKED
25   -/////////////////////////////////////////////////////////////////////////////
26   -//
27   -// TEXTINCLUDE
28   -//
29   -
30   -1 TEXTINCLUDE DISCARDABLE
31   -BEGIN
32   - "resource.h\0"
33   -END
34   -
35   -2 TEXTINCLUDE DISCARDABLE
36   -BEGIN
37   - "#include ""afxres.h""\r\n"
38   - "\0"
39   -END
40   -
41   -3 TEXTINCLUDE DISCARDABLE
42   -BEGIN
43   - "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
44   - "#define _AFX_NO_OLE_RESOURCES\r\n"
45   - "#define _AFX_NO_TRACKER_RESOURCES\r\n"
46   - "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
47   - "\r\n"
48   - "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)\r\n"
49   - "#ifdef _WIN32\r\n"
50   - "LANGUAGE 4, 2\r\n"
51   - "#pragma code_page(936)\r\n"
52   - "#endif //_WIN32\r\n"
53   - "#include ""res\\BlueFlashTool.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
54   - "#include ""l.chs\\afxres.rc"" // Standard components\r\n"
55   - "#endif\r\n"
56   - "\0"
57   -END
58   -
59   -#endif // APSTUDIO_INVOKED
60   -
61   -
62   -/////////////////////////////////////////////////////////////////////////////
63   -//
64   -// Icon
65   -//
66   -
67   -// Icon with lowest ID value placed first to ensure application icon
68   -// remains consistent on all systems.
69   -IDR_MAINFRAME ICON DISCARDABLE "res\\BlueFlashTool.ico"
70   -
71   -/////////////////////////////////////////////////////////////////////////////
72   -//
73   -// Dialog
74   -//
75   -
76   -IDD_BLUEFLASHTOOL_DIALOG DIALOGEX 0, 0, 566, 367
77   -STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
78   -EXSTYLE WS_EX_APPWINDOW
79   -CAPTION "BlueFlashTool"
80   -FONT 9, "宋体", 0, 0, 0x1
81   -BEGIN
82   - GROUPBOX "SN:000000000000",IDC_STATIC_GROUP01,0,1,232,51
83   - CONTROL "耳机",IDC_CHECK_EAR01,"Button",BS_AUTOCHECKBOX |
84   - WS_TABSTOP,8,15,32,10
85   - CONTROL "发射器",IDC_CHECK_USB01,"Button",BS_AUTOCHECKBOX |
86   - WS_TABSTOP,8,34,40,10
87   - CONTROL "Progress1",IDC_PROGRESS_EAR01,"msctls_progress32",
88   - PBS_SMOOTH | WS_BORDER,57,15,102,14
89   - CONTROL "Progress1",IDC_PROGRESS_USB01,"msctls_progress32",
90   - PBS_SMOOTH | WS_BORDER,57,34,102,14
91   - PUSHBUTTON "开始",IDC_BUTTON_START_EAR01,169,15,50,14
92   - PUSHBUTTON "开始",IDC_BUTTON_START_USB01,169,34,50,14
93   - GROUPBOX "SN:000000000000",IDC_STATIC_GROUP2,0,60,232,51
94   - CONTROL "耳机",IDC_CHECK_EAR2,"Button",BS_AUTOCHECKBOX |
95   - WS_TABSTOP,8,74,32,10
96   - CONTROL "发射器",IDC_CHECK_USB2,"Button",BS_AUTOCHECKBOX |
97   - WS_TABSTOP,8,93,40,10
98   - CONTROL "Progress1",IDC_PROGRESS_EAR2,"msctls_progress32",
99   - PBS_SMOOTH | WS_BORDER,57,74,102,14
100   - CONTROL "Progress1",IDC_PROGRESS_USB2,"msctls_progress32",
101   - PBS_SMOOTH | WS_BORDER,57,93,102,14
102   - PUSHBUTTON "开始",IDC_BUTTON_START_EAR2,169,74,50,14
103   - PUSHBUTTON "开始",IDC_BUTTON_START_USB2,169,93,50,14
104   - GROUPBOX "SN:000000000000",IDC_STATIC_GROUP3,0,120,232,51
105   - CONTROL "耳机",IDC_CHECK_EAR3,"Button",BS_AUTOCHECKBOX |
106   - WS_TABSTOP,8,134,32,10
107   - CONTROL "发射器",IDC_CHECK_USB3,"Button",BS_AUTOCHECKBOX |
108   - WS_TABSTOP,8,153,40,10
109   - CONTROL "Progress1",IDC_PROGRESS_EAR3,"msctls_progress32",
110   - PBS_SMOOTH | WS_BORDER,57,134,102,14
111   - CONTROL "Progress1",IDC_PROGRESS_USB3,"msctls_progress32",
112   - PBS_SMOOTH | WS_BORDER,57,153,102,14
113   - PUSHBUTTON "开始",IDC_BUTTON_START_EAR3,169,134,50,14
114   - PUSHBUTTON "开始",IDC_BUTTON_START_USB3,169,153,50,14
115   - GROUPBOX "SN:000000000000",IDC_STATIC_GROUP4,0,180,232,51
116   - CONTROL "耳机",IDC_CHECK_EAR4,"Button",BS_AUTOCHECKBOX |
117   - WS_TABSTOP,8,194,32,10
118   - CONTROL "发射器",IDC_CHECK_USB4,"Button",BS_AUTOCHECKBOX |
119   - WS_TABSTOP,8,213,40,10
120   - CONTROL "Progress1",IDC_PROGRESS_EAR4,"msctls_progress32",
121   - PBS_SMOOTH | WS_BORDER,57,194,102,14
122   - CONTROL "Progress1",IDC_PROGRESS_USB4,"msctls_progress32",
123   - PBS_SMOOTH | WS_BORDER,57,213,102,14
124   - PUSHBUTTON "开始",IDC_BUTTON_START_EAR4,169,194,50,14
125   - PUSHBUTTON "开始",IDC_BUTTON_START_USB4,169,213,50,14
126   - GROUPBOX "SN:000000000000",IDC_STATIC_GROUP5,0,240,232,51
127   - CONTROL "耳机",IDC_CHECK_EAR5,"Button",BS_AUTOCHECKBOX |
128   - WS_TABSTOP,8,254,32,10
129   - CONTROL "发射器",IDC_CHECK_USB5,"Button",BS_AUTOCHECKBOX |
130   - WS_TABSTOP,8,273,40,10
131   - CONTROL "Progress1",IDC_PROGRESS_EAR5,"msctls_progress32",
132   - PBS_SMOOTH | WS_BORDER,57,254,102,14
133   - CONTROL "Progress1",IDC_PROGRESS_USB5,"msctls_progress32",
134   - PBS_SMOOTH | WS_BORDER,57,273,102,14
135   - PUSHBUTTON "开始",IDC_BUTTON_START_EAR5,169,254,50,14
136   - PUSHBUTTON "开始",IDC_BUTTON_START_USB5,169,273,50,14
137   - GROUPBOX "SN:000000000000",IDC_STATIC_GROUP6,245,0,232,51
138   - CONTROL "耳机",IDC_CHECK_EAR6,"Button",BS_AUTOCHECKBOX |
139   - WS_TABSTOP,253,14,32,10
140   - CONTROL "发射器",IDC_CHECK_USB6,"Button",BS_AUTOCHECKBOX |
141   - WS_TABSTOP,253,33,40,10
142   - CONTROL "Progress1",IDC_PROGRESS_EAR6,"msctls_progress32",
143   - PBS_SMOOTH | WS_BORDER,303,14,102,14
144   - CONTROL "Progress1",IDC_PROGRESS_USB6,"msctls_progress32",
145   - PBS_SMOOTH | WS_BORDER,303,33,102,14
146   - PUSHBUTTON "开始",IDC_BUTTON_START_EAR6,415,14,50,14
147   - PUSHBUTTON "开始",IDC_BUTTON_START_USB6,415,33,50,14
148   - GROUPBOX "SN:000000000000",IDC_STATIC_GROUP7,245,60,232,51
149   - CONTROL "耳机",IDC_CHECK_EAR7,"Button",BS_AUTOCHECKBOX |
150   - WS_TABSTOP,253,74,32,10
151   - CONTROL "发射器",IDC_CHECK_USB7,"Button",BS_AUTOCHECKBOX |
152   - WS_TABSTOP,253,93,40,10
153   - CONTROL "Progress1",IDC_PROGRESS_EAR7,"msctls_progress32",
154   - PBS_SMOOTH | WS_BORDER,303,74,102,14
155   - CONTROL "Progress1",IDC_PROGRESS_USB7,"msctls_progress32",
156   - PBS_SMOOTH | WS_BORDER,303,93,102,14
157   - PUSHBUTTON "开始",IDC_BUTTON_START_EAR7,415,74,50,14
158   - PUSHBUTTON "开始",IDC_BUTTON_START_USB7,415,93,50,14
159   - GROUPBOX "SN:000000000000",IDC_STATIC_GROUP8,245,120,232,51
160   - CONTROL "耳机",IDC_CHECK_EAR8,"Button",BS_AUTOCHECKBOX |
161   - WS_TABSTOP,253,134,32,10
162   - CONTROL "发射器",IDC_CHECK_USB8,"Button",BS_AUTOCHECKBOX |
163   - WS_TABSTOP,253,153,40,10
164   - CONTROL "Progress1",IDC_PROGRESS_EAR8,"msctls_progress32",
165   - PBS_SMOOTH | WS_BORDER,303,134,102,14
166   - CONTROL "Progress1",IDC_PROGRESS_USB8,"msctls_progress32",
167   - PBS_SMOOTH | WS_BORDER,303,153,102,14
168   - PUSHBUTTON "开始",IDC_BUTTON_START_EAR8,415,134,50,14
169   - PUSHBUTTON "开始",IDC_BUTTON_START_USB8,415,153,50,14
170   - GROUPBOX "SN:000000000000",IDC_STATIC_GROUP9,245,180,232,51
171   - CONTROL "耳机",IDC_CHECK_EAR9,"Button",BS_AUTOCHECKBOX |
172   - WS_TABSTOP,253,194,32,10
173   - CONTROL "发射器",IDC_CHECK_USB9,"Button",BS_AUTOCHECKBOX |
174   - WS_TABSTOP,253,213,40,10
175   - CONTROL "Progress1",IDC_PROGRESS_EAR9,"msctls_progress32",
176   - PBS_SMOOTH | WS_BORDER,303,194,102,14
177   - CONTROL "Progress1",IDC_PROGRESS_USB9,"msctls_progress32",
178   - PBS_SMOOTH | WS_BORDER,303,213,102,14
179   - PUSHBUTTON "开始",IDC_BUTTON_START_EAR9,415,194,50,14
180   - PUSHBUTTON "开始",IDC_BUTTON_START_USB9,415,213,50,14
181   - GROUPBOX "SN:000000000000",IDC_STATIC_GROUP10,245,240,232,51
182   - CONTROL "耳机",IDC_CHECK_EAR10,"Button",BS_AUTOCHECKBOX |
183   - WS_TABSTOP,253,254,32,10
184   - CONTROL "发射器",IDC_CHECK_USB10,"Button",BS_AUTOCHECKBOX |
185   - WS_TABSTOP,253,273,40,10
186   - CONTROL "Progress1",IDC_PROGRESS_EAR10,"msctls_progress32",
187   - PBS_SMOOTH | WS_BORDER,303,254,102,14
188   - CONTROL "Progress1",IDC_PROGRESS_USB10,"msctls_progress32",
189   - PBS_SMOOTH | WS_BORDER,303,273,102,14
190   - PUSHBUTTON "开始",IDC_BUTTON_START_EAR10,415,254,50,14
191   - PUSHBUTTON "开始",IDC_BUTTON_START_USB10,415,273,50,14
192   - PUSHBUTTON "全部开始",IDC_START_ALL,10,300,50,14
193   - PUSHBUTTON "全部停止",IDC_STOP_ALL,75,300,50,14
194   - PUSHBUTTON "参数设置",IDC_BUTTON_SETTING,425,300,50,14
195   - CONTROL "",IDC_MSCOMM0,"{648A5600-2C6E-101B-82B6-000000000014}",
196   - WS_TABSTOP,0,342,25,25
197   - CONTROL "",IDC_MSCOMM1,"{648A5600-2C6E-101B-82B6-000000000014}",
198   - WS_TABSTOP,26,342,25,25
199   - CONTROL "",IDC_MSCOMM2,"{648A5600-2C6E-101B-82B6-000000000014}",
200   - WS_TABSTOP,52,342,25,25
201   - CONTROL "",IDC_MSCOMM3,"{648A5600-2C6E-101B-82B6-000000000014}",
202   - WS_TABSTOP,78,342,25,25
203   - CONTROL "",IDC_MSCOMM4,"{648A5600-2C6E-101B-82B6-000000000014}",
204   - WS_TABSTOP,104,342,25,25
205   - CONTROL "",IDC_MSCOMM5,"{648A5600-2C6E-101B-82B6-000000000014}",
206   - WS_TABSTOP,130,342,25,25
207   - CONTROL "",IDC_MSCOMM6,"{648A5600-2C6E-101B-82B6-000000000014}",
208   - WS_TABSTOP,156,342,25,25
209   - CONTROL "",IDC_MSCOMM7,"{648A5600-2C6E-101B-82B6-000000000014}",
210   - WS_TABSTOP,182,342,25,25
211   - CONTROL "",IDC_MSCOMM8,"{648A5600-2C6E-101B-82B6-000000000014}",
212   - WS_TABSTOP,208,342,25,25
213   - CONTROL "",IDC_MSCOMM9,"{648A5600-2C6E-101B-82B6-000000000014}",
214   - WS_TABSTOP,234,342,25,25
215   - CONTROL "",IDC_MSCOMM10,"{648A5600-2C6E-101B-82B6-000000000014}",
216   - WS_TABSTOP,260,342,25,25
217   - CONTROL "",IDC_MSCOMM11,"{648A5600-2C6E-101B-82B6-000000000014}",
218   - WS_TABSTOP,286,342,25,25
219   - CONTROL "",IDC_MSCOMM12,"{648A5600-2C6E-101B-82B6-000000000014}",
220   - WS_TABSTOP,312,342,25,25
221   - CONTROL "",IDC_MSCOMM13,"{648A5600-2C6E-101B-82B6-000000000014}",
222   - WS_TABSTOP,338,342,25,25
223   - CONTROL "",IDC_MSCOMM14,"{648A5600-2C6E-101B-82B6-000000000014}",
224   - WS_TABSTOP,364,342,25,25
225   - CONTROL "",IDC_MSCOMM15,"{648A5600-2C6E-101B-82B6-000000000014}",
226   - WS_TABSTOP,390,342,25,25
227   - CONTROL "",IDC_MSCOMM16,"{648A5600-2C6E-101B-82B6-000000000014}",
228   - WS_TABSTOP,416,342,25,25
229   - CONTROL "",IDC_MSCOMM17,"{648A5600-2C6E-101B-82B6-000000000014}",
230   - WS_TABSTOP,442,342,25,25
231   - CONTROL "",IDC_MSCOMM18,"{648A5600-2C6E-101B-82B6-000000000014}",
232   - WS_TABSTOP,468,342,25,25
233   - CONTROL "",IDC_MSCOMM19,"{648A5600-2C6E-101B-82B6-000000000014}",
234   - WS_TABSTOP,494,342,25,25
235   - CONTROL "",IDC_MSCOMM20,"{648A5600-2C6E-101B-82B6-000000000014}",
236   - WS_TABSTOP,520,342,25,25
237   -END
238   -
239   -IDD_SYSTEM_CONFIG DIALOG DISCARDABLE 0, 0, 187, 96
240   -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
241   -CAPTION "Dialog"
242   -FONT 10, "System"
243   -BEGIN
244   - DEFPUSHBUTTON "OK",IDOK,130,7,50,14
245   - PUSHBUTTON "Cancel",IDCANCEL,130,24,50,14
246   -END
247   -
248   -
249   -#ifndef _MAC
250   -/////////////////////////////////////////////////////////////////////////////
251   -//
252   -// Version
253   -//
254   -
255   -VS_VERSION_INFO VERSIONINFO
256   - FILEVERSION 1,0,0,1
257   - PRODUCTVERSION 1,0,0,1
258   - FILEFLAGSMASK 0x3fL
259   -#ifdef _DEBUG
260   - FILEFLAGS 0x1L
261   -#else
262   - FILEFLAGS 0x0L
263   -#endif
264   - FILEOS 0x4L
265   - FILETYPE 0x1L
266   - FILESUBTYPE 0x0L
267   -BEGIN
268   - BLOCK "StringFileInfo"
269   - BEGIN
270   - BLOCK "080404B0"
271   - BEGIN
272   - VALUE "CompanyName", "\0"
273   - VALUE "FileDescription", "BlueFlashTool Microsoft 基础类应用程序\0"
274   - VALUE "FileVersion", "1, 0, 0, 1\0"
275   - VALUE "InternalName", "BlueFlashTool\0"
276   - VALUE "LegalCopyright", "版权所有 (C) 2021\0"
277   - VALUE "LegalTrademarks", "\0"
278   - VALUE "OriginalFilename", "BlueFlashTool.EXE\0"
279   - VALUE "ProductName", "BlueFlashTool 应用程序\0"
280   - VALUE "ProductVersion", "1, 0, 0, 1\0"
281   - END
282   - END
283   - BLOCK "VarFileInfo"
284   - BEGIN
285   - VALUE "Translation", 0x804, 1200
286   - END
287   -END
288   -
289   -#endif // !_MAC
290   -
291   -
292   -/////////////////////////////////////////////////////////////////////////////
293   -//
294   -// DESIGNINFO
295   -//
296   -
297   -#ifdef APSTUDIO_INVOKED
298   -GUIDELINES DESIGNINFO DISCARDABLE
299   -BEGIN
300   - IDD_BLUEFLASHTOOL_DIALOG, DIALOG
301   - BEGIN
302   - LEFTMARGIN, 7
303   - RIGHTMARGIN, 559
304   - TOPMARGIN, 7
305   - BOTTOMMARGIN, 360
306   - END
307   -
308   - IDD_SYSTEM_CONFIG, DIALOG
309   - BEGIN
310   - LEFTMARGIN, 7
311   - RIGHTMARGIN, 180
312   - TOPMARGIN, 7
313   - BOTTOMMARGIN, 89
314   - END
315   -END
316   -#endif // APSTUDIO_INVOKED
317   -
318   -
319   -/////////////////////////////////////////////////////////////////////////////
320   -//
321   -// Dialog Info
322   -//
323   -
324   -IDD_BLUEFLASHTOOL_DIALOG DLGINIT
325   -BEGIN
326   - IDC_MSCOMM0, 0x376, 102, 0
327   -0x0013, 0x0000, 0x0043, 0x006f, 0x0070, 0x0079, 0x0072, 0x0069, 0x0067,
328   -0x0068, 0x0074, 0x0020, 0x0028, 0x0063, 0x0029, 0x0020, 0x0031, 0x0039,
329   -0x0039, 0x0034, 0x0020, 0x4321, 0x1234, 0x0008, 0x0000, 0x03ed, 0x0000,
330   -0x03ed, 0x0000, 0x5601, 0x648a, 0x0000, 0x0006, 0x0000, 0x0001, 0x0400,
331   -0x0000, 0x0200, 0x0000, 0x2580, 0x0000, 0x0000, 0x0008, 0x0000, 0x0000,
332   -0x0000, 0x0000, 0x003f, 0x0000, 0x0001, 0x0000,
333   - IDC_MSCOMM1, 0x376, 102, 0
334   -0x0013, 0x0000, 0x0043, 0x006f, 0x0070, 0x0079, 0x0072, 0x0069, 0x0067,
335   -0x0068, 0x0074, 0x0020, 0x0028, 0x0063, 0x0029, 0x0020, 0x0031, 0x0039,
336   -0x0039, 0x0034, 0x0020, 0x4321, 0x1234, 0x0008, 0x0000, 0x03ed, 0x0000,
337   -0x03ed, 0x0000, 0x5601, 0x648a, 0x0000, 0x0006, 0x0000, 0x0001, 0x0400,
338   -0x0000, 0x0200, 0x0000, 0x2580, 0x0000, 0x0000, 0x0008, 0x0000, 0x0000,
339   -0x0000, 0x0000, 0x003f, 0x0000, 0x0001, 0x0000,
340   - IDC_MSCOMM2, 0x376, 102, 0
341   -0x0013, 0x0000, 0x0043, 0x006f, 0x0070, 0x0079, 0x0072, 0x0069, 0x0067,
342   -0x0068, 0x0074, 0x0020, 0x0028, 0x0063, 0x0029, 0x0020, 0x0031, 0x0039,
343   -0x0039, 0x0034, 0x0020, 0x4321, 0x1234, 0x0008, 0x0000, 0x03ed, 0x0000,
344   -0x03ed, 0x0000, 0x5601, 0x648a, 0x0000, 0x0006, 0x0000, 0x0001, 0x0400,
345   -0x0000, 0x0200, 0x0000, 0x2580, 0x0000, 0x0000, 0x0008, 0x0000, 0x0000,
346   -0x0000, 0x0000, 0x003f, 0x0000, 0x0001, 0x0000,
347   - IDC_MSCOMM3, 0x376, 102, 0
348   -0x0013, 0x0000, 0x0043, 0x006f, 0x0070, 0x0079, 0x0072, 0x0069, 0x0067,
349   -0x0068, 0x0074, 0x0020, 0x0028, 0x0063, 0x0029, 0x0020, 0x0031, 0x0039,
350   -0x0039, 0x0034, 0x0020, 0x4321, 0x1234, 0x0008, 0x0000, 0x03ed, 0x0000,
351   -0x03ed, 0x0000, 0x5601, 0x648a, 0x0000, 0x0006, 0x0000, 0x0001, 0x0400,
352   -0x0000, 0x0200, 0x0000, 0x2580, 0x0000, 0x0000, 0x0008, 0x0000, 0x0000,
353   -0x0000, 0x0000, 0x003f, 0x0000, 0x0001, 0x0000,
354   - IDC_MSCOMM4, 0x376, 102, 0
355   -0x0013, 0x0000, 0x0043, 0x006f, 0x0070, 0x0079, 0x0072, 0x0069, 0x0067,
356   -0x0068, 0x0074, 0x0020, 0x0028, 0x0063, 0x0029, 0x0020, 0x0031, 0x0039,
357   -0x0039, 0x0034, 0x0020, 0x4321, 0x1234, 0x0008, 0x0000, 0x03ed, 0x0000,
358   -0x03ed, 0x0000, 0x5601, 0x648a, 0x0000, 0x0006, 0x0000, 0x0001, 0x0400,
359   -0x0000, 0x0200, 0x0000, 0x2580, 0x0000, 0x0000, 0x0008, 0x0000, 0x0000,
360   -0x0000, 0x0000, 0x003f, 0x0000, 0x0001, 0x0000,
361   - IDC_MSCOMM5, 0x376, 102, 0
362   -0x0013, 0x0000, 0x0043, 0x006f, 0x0070, 0x0079, 0x0072, 0x0069, 0x0067,
363   -0x0068, 0x0074, 0x0020, 0x0028, 0x0063, 0x0029, 0x0020, 0x0031, 0x0039,
364   -0x0039, 0x0034, 0x0020, 0x4321, 0x1234, 0x0008, 0x0000, 0x03ed, 0x0000,
365   -0x03ed, 0x0000, 0x5601, 0x648a, 0x0000, 0x0006, 0x0000, 0x0001, 0x0400,
366   -0x0000, 0x0200, 0x0000, 0x2580, 0x0000, 0x0000, 0x0008, 0x0000, 0x0000,
367   -0x0000, 0x0000, 0x003f, 0x0000, 0x0001, 0x0000,
368   - IDC_MSCOMM6, 0x376, 102, 0
369   -0x0013, 0x0000, 0x0043, 0x006f, 0x0070, 0x0079, 0x0072, 0x0069, 0x0067,
370   -0x0068, 0x0074, 0x0020, 0x0028, 0x0063, 0x0029, 0x0020, 0x0031, 0x0039,
371   -0x0039, 0x0034, 0x0020, 0x4321, 0x1234, 0x0008, 0x0000, 0x03ed, 0x0000,
372   -0x03ed, 0x0000, 0x5601, 0x648a, 0x0000, 0x0006, 0x0000, 0x0001, 0x0400,
373   -0x0000, 0x0200, 0x0000, 0x2580, 0x0000, 0x0000, 0x0008, 0x0000, 0x0000,
374   -0x0000, 0x0000, 0x003f, 0x0000, 0x0001, 0x0000,
375   - IDC_MSCOMM7, 0x376, 102, 0
376   -0x0013, 0x0000, 0x0043, 0x006f, 0x0070, 0x0079, 0x0072, 0x0069, 0x0067,
377   -0x0068, 0x0074, 0x0020, 0x0028, 0x0063, 0x0029, 0x0020, 0x0031, 0x0039,
378   -0x0039, 0x0034, 0x0020, 0x4321, 0x1234, 0x0008, 0x0000, 0x03ed, 0x0000,
379   -0x03ed, 0x0000, 0x5601, 0x648a, 0x0000, 0x0006, 0x0000, 0x0001, 0x0400,
380   -0x0000, 0x0200, 0x0000, 0x2580, 0x0000, 0x0000, 0x0008, 0x0000, 0x0000,
381   -0x0000, 0x0000, 0x003f, 0x0000, 0x0001, 0x0000,
382   - IDC_MSCOMM8, 0x376, 102, 0
383   -0x0013, 0x0000, 0x0043, 0x006f, 0x0070, 0x0079, 0x0072, 0x0069, 0x0067,
384   -0x0068, 0x0074, 0x0020, 0x0028, 0x0063, 0x0029, 0x0020, 0x0031, 0x0039,
385   -0x0039, 0x0034, 0x0020, 0x4321, 0x1234, 0x0008, 0x0000, 0x03ed, 0x0000,
386   -0x03ed, 0x0000, 0x5601, 0x648a, 0x0000, 0x0006, 0x0000, 0x0001, 0x0400,
387   -0x0000, 0x0200, 0x0000, 0x2580, 0x0000, 0x0000, 0x0008, 0x0000, 0x0000,
388   -0x0000, 0x0000, 0x003f, 0x0000, 0x0001, 0x0000,
389   - IDC_MSCOMM9, 0x376, 102, 0
390   -0x0013, 0x0000, 0x0043, 0x006f, 0x0070, 0x0079, 0x0072, 0x0069, 0x0067,
391   -0x0068, 0x0074, 0x0020, 0x0028, 0x0063, 0x0029, 0x0020, 0x0031, 0x0039,
392   -0x0039, 0x0034, 0x0020, 0x4321, 0x1234, 0x0008, 0x0000, 0x03ed, 0x0000,
393   -0x03ed, 0x0000, 0x5601, 0x648a, 0x0000, 0x0006, 0x0000, 0x0001, 0x0400,
394   -0x0000, 0x0200, 0x0000, 0x2580, 0x0000, 0x0000, 0x0008, 0x0000, 0x0000,
395   -0x0000, 0x0000, 0x003f, 0x0000, 0x0001, 0x0000,
396   - IDC_MSCOMM10, 0x376, 102, 0
397   -0x0013, 0x0000, 0x0043, 0x006f, 0x0070, 0x0079, 0x0072, 0x0069, 0x0067,
398   -0x0068, 0x0074, 0x0020, 0x0028, 0x0063, 0x0029, 0x0020, 0x0031, 0x0039,
399   -0x0039, 0x0034, 0x0020, 0x4321, 0x1234, 0x0008, 0x0000, 0x03ed, 0x0000,
400   -0x03ed, 0x0000, 0x5601, 0x648a, 0x0000, 0x0006, 0x0000, 0x0001, 0x0400,
401   -0x0000, 0x0200, 0x0000, 0x2580, 0x0000, 0x0000, 0x0008, 0x0000, 0x0000,
402   -0x0000, 0x0000, 0x003f, 0x0000, 0x0001, 0x0000,
403   - IDC_MSCOMM11, 0x376, 102, 0
404   -0x0013, 0x0000, 0x0043, 0x006f, 0x0070, 0x0079, 0x0072, 0x0069, 0x0067,
405   -0x0068, 0x0074, 0x0020, 0x0028, 0x0063, 0x0029, 0x0020, 0x0031, 0x0039,
406   -0x0039, 0x0034, 0x0020, 0x4321, 0x1234, 0x0008, 0x0000, 0x03ed, 0x0000,
407   -0x03ed, 0x0000, 0x5601, 0x648a, 0x0000, 0x0006, 0x0000, 0x0001, 0x0400,
408   -0x0000, 0x0200, 0x0000, 0x2580, 0x0000, 0x0000, 0x0008, 0x0000, 0x0000,
409   -0x0000, 0x0000, 0x003f, 0x0000, 0x0001, 0x0000,
410   - IDC_MSCOMM12, 0x376, 102, 0
411   -0x0013, 0x0000, 0x0043, 0x006f, 0x0070, 0x0079, 0x0072, 0x0069, 0x0067,
412   -0x0068, 0x0074, 0x0020, 0x0028, 0x0063, 0x0029, 0x0020, 0x0031, 0x0039,
413   -0x0039, 0x0034, 0x0020, 0x4321, 0x1234, 0x0008, 0x0000, 0x03ed, 0x0000,
414   -0x03ed, 0x0000, 0x5601, 0x648a, 0x0000, 0x0006, 0x0000, 0x0001, 0x0400,
415   -0x0000, 0x0200, 0x0000, 0x2580, 0x0000, 0x0000, 0x0008, 0x0000, 0x0000,
416   -0x0000, 0x0000, 0x003f, 0x0000, 0x0001, 0x0000,
417   - IDC_MSCOMM13, 0x376, 102, 0
418   -0x0013, 0x0000, 0x0043, 0x006f, 0x0070, 0x0079, 0x0072, 0x0069, 0x0067,
419   -0x0068, 0x0074, 0x0020, 0x0028, 0x0063, 0x0029, 0x0020, 0x0031, 0x0039,
420   -0x0039, 0x0034, 0x0020, 0x4321, 0x1234, 0x0008, 0x0000, 0x03ed, 0x0000,
421   -0x03ed, 0x0000, 0x5601, 0x648a, 0x0000, 0x0006, 0x0000, 0x0001, 0x0400,
422   -0x0000, 0x0200, 0x0000, 0x2580, 0x0000, 0x0000, 0x0008, 0x0000, 0x0000,
423   -0x0000, 0x0000, 0x003f, 0x0000, 0x0001, 0x0000,
424   - IDC_MSCOMM14, 0x376, 102, 0
425   -0x0013, 0x0000, 0x0043, 0x006f, 0x0070, 0x0079, 0x0072, 0x0069, 0x0067,
426   -0x0068, 0x0074, 0x0020, 0x0028, 0x0063, 0x0029, 0x0020, 0x0031, 0x0039,
427   -0x0039, 0x0034, 0x0020, 0x4321, 0x1234, 0x0008, 0x0000, 0x03ed, 0x0000,
428   -0x03ed, 0x0000, 0x5601, 0x648a, 0x0000, 0x0006, 0x0000, 0x0001, 0x0400,
429   -0x0000, 0x0200, 0x0000, 0x2580, 0x0000, 0x0000, 0x0008, 0x0000, 0x0000,
430   -0x0000, 0x0000, 0x003f, 0x0000, 0x0001, 0x0000,
431   - IDC_MSCOMM15, 0x376, 102, 0
432   -0x0013, 0x0000, 0x0043, 0x006f, 0x0070, 0x0079, 0x0072, 0x0069, 0x0067,
433   -0x0068, 0x0074, 0x0020, 0x0028, 0x0063, 0x0029, 0x0020, 0x0031, 0x0039,
434   -0x0039, 0x0034, 0x0020, 0x4321, 0x1234, 0x0008, 0x0000, 0x03ed, 0x0000,
435   -0x03ed, 0x0000, 0x5601, 0x648a, 0x0000, 0x0006, 0x0000, 0x0001, 0x0400,
436   -0x0000, 0x0200, 0x0000, 0x2580, 0x0000, 0x0000, 0x0008, 0x0000, 0x0000,
437   -0x0000, 0x0000, 0x003f, 0x0000, 0x0001, 0x0000,
438   - IDC_MSCOMM16, 0x376, 102, 0
439   -0x0013, 0x0000, 0x0043, 0x006f, 0x0070, 0x0079, 0x0072, 0x0069, 0x0067,
440   -0x0068, 0x0074, 0x0020, 0x0028, 0x0063, 0x0029, 0x0020, 0x0031, 0x0039,
441   -0x0039, 0x0034, 0x0020, 0x4321, 0x1234, 0x0008, 0x0000, 0x03ed, 0x0000,
442   -0x03ed, 0x0000, 0x5601, 0x648a, 0x0000, 0x0006, 0x0000, 0x0001, 0x0400,
443   -0x0000, 0x0200, 0x0000, 0x2580, 0x0000, 0x0000, 0x0008, 0x0000, 0x0000,
444   -0x0000, 0x0000, 0x003f, 0x0000, 0x0001, 0x0000,
445   - IDC_MSCOMM17, 0x376, 102, 0
446   -0x0013, 0x0000, 0x0043, 0x006f, 0x0070, 0x0079, 0x0072, 0x0069, 0x0067,
447   -0x0068, 0x0074, 0x0020, 0x0028, 0x0063, 0x0029, 0x0020, 0x0031, 0x0039,
448   -0x0039, 0x0034, 0x0020, 0x4321, 0x1234, 0x0008, 0x0000, 0x03ed, 0x0000,
449   -0x03ed, 0x0000, 0x5601, 0x648a, 0x0000, 0x0006, 0x0000, 0x0001, 0x0400,
450   -0x0000, 0x0200, 0x0000, 0x2580, 0x0000, 0x0000, 0x0008, 0x0000, 0x0000,
451   -0x0000, 0x0000, 0x003f, 0x0000, 0x0001, 0x0000,
452   - IDC_MSCOMM18, 0x376, 102, 0
453   -0x0013, 0x0000, 0x0043, 0x006f, 0x0070, 0x0079, 0x0072, 0x0069, 0x0067,
454   -0x0068, 0x0074, 0x0020, 0x0028, 0x0063, 0x0029, 0x0020, 0x0031, 0x0039,
455   -0x0039, 0x0034, 0x0020, 0x4321, 0x1234, 0x0008, 0x0000, 0x03ed, 0x0000,
456   -0x03ed, 0x0000, 0x5601, 0x648a, 0x0000, 0x0006, 0x0000, 0x0001, 0x0400,
457   -0x0000, 0x0200, 0x0000, 0x2580, 0x0000, 0x0000, 0x0008, 0x0000, 0x0000,
458   -0x0000, 0x0000, 0x003f, 0x0000, 0x0001, 0x0000,
459   - IDC_MSCOMM19, 0x376, 102, 0
460   -0x0013, 0x0000, 0x0043, 0x006f, 0x0070, 0x0079, 0x0072, 0x0069, 0x0067,
461   -0x0068, 0x0074, 0x0020, 0x0028, 0x0063, 0x0029, 0x0020, 0x0031, 0x0039,
462   -0x0039, 0x0034, 0x0020, 0x4321, 0x1234, 0x0008, 0x0000, 0x03ed, 0x0000,
463   -0x03ed, 0x0000, 0x5601, 0x648a, 0x0000, 0x0006, 0x0000, 0x0001, 0x0400,
464   -0x0000, 0x0200, 0x0000, 0x2580, 0x0000, 0x0000, 0x0008, 0x0000, 0x0000,
465   -0x0000, 0x0000, 0x003f, 0x0000, 0x0001, 0x0000,
466   - IDC_MSCOMM20, 0x376, 102, 0
467   -0x0013, 0x0000, 0x0043, 0x006f, 0x0070, 0x0079, 0x0072, 0x0069, 0x0067,
468   -0x0068, 0x0074, 0x0020, 0x0028, 0x0063, 0x0029, 0x0020, 0x0031, 0x0039,
469   -0x0039, 0x0034, 0x0020, 0x4321, 0x1234, 0x0008, 0x0000, 0x03ed, 0x0000,
470   -0x03ed, 0x0000, 0x5601, 0x648a, 0x0000, 0x0006, 0x0000, 0x0001, 0x0400,
471   -0x0000, 0x0200, 0x0000, 0x2580, 0x0000, 0x0000, 0x0008, 0x0000, 0x0000,
472   -0x0000, 0x0000, 0x003f, 0x0000, 0x0001, 0x0000,
473   - 0
474   -END
475   -
476   -#endif // Chinese (P.R.C.) resources
477   -/////////////////////////////////////////////////////////////////////////////
478   -
479   -
480   -
481   -#ifndef APSTUDIO_INVOKED
482   -/////////////////////////////////////////////////////////////////////////////
483   -//
484   -// Generated from the TEXTINCLUDE 3 resource.
485   -//
486   -#define _AFX_NO_SPLITTER_RESOURCES
487   -#define _AFX_NO_OLE_RESOURCES
488   -#define _AFX_NO_TRACKER_RESOURCES
489   -#define _AFX_NO_PROPERTY_RESOURCES
490   -
491   -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
492   -#ifdef _WIN32
493   -LANGUAGE 4, 2
494   -#pragma code_page(936)
495   -#endif //_WIN32
496   -#include "res\BlueFlashTool.rc2" // non-Microsoft Visual C++ edited resources
497   -#include "l.chs\afxres.rc" // Standard components
498   -#endif
499   -
500   -/////////////////////////////////////////////////////////////////////////////
501   -#endif // not APSTUDIO_INVOKED
502   -
1   -// BlueFlashToolDlg.cpp : implementation file
2   -//
3   -
4   -#include "stdafx.h"
5   -#include "BlueFlashTool.h"
6   -#include "BlueFlashToolDlg.h"
7   -
8   -#ifdef _DEBUG
9   -#define new DEBUG_NEW
10   -#undef THIS_FILE
11   -static char THIS_FILE[] = __FILE__;
12   -#endif
13   -
14   -/////////////////////////////////////////////////////////////////////////////
15   -// CBlueFlashToolDlg dialog
16   -
17   -CBlueFlashToolDlg::CBlueFlashToolDlg(CWnd* pParent /*=NULL*/)
18   - : CDialog(CBlueFlashToolDlg::IDD, pParent)
19   -{
20   - //{{AFX_DATA_INIT(CBlueFlashToolDlg)
21   - // NOTE: the ClassWizard will add member initialization here
22   - //}}AFX_DATA_INIT
23   - // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
24   - m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
25   -}
26   -
27   -void CBlueFlashToolDlg::DoDataExchange(CDataExchange* pDX)
28   -{
29   - CDialog::DoDataExchange(pDX);
30   - //{{AFX_DATA_MAP(CBlueFlashToolDlg)
31   - DDX_Control(pDX, IDC_MSCOMM0, mycom);
32   - //}}AFX_DATA_MAP
33   -}
34   -
35   -BEGIN_MESSAGE_MAP(CBlueFlashToolDlg, CDialog)
36   - //{{AFX_MSG_MAP(CBlueFlashToolDlg)
37   - ON_WM_PAINT()
38   - ON_WM_QUERYDRAGICON()
39   - //}}AFX_MSG_MAP
40   -END_MESSAGE_MAP()
41   -
42   -/////////////////////////////////////////////////////////////////////////////
43   -// CBlueFlashToolDlg message handlers
44   -
45   -BOOL CBlueFlashToolDlg::OnInitDialog()
46   -{
47   - CDialog::OnInitDialog();
48   -
49   - // Set the icon for this dialog. The framework does this automatically
50   - // when the application's main window is not a dialog
51   - SetIcon(m_hIcon, TRUE); // Set big icon
52   - SetIcon(m_hIcon, FALSE); // Set small icon
53   -
54   - // TODO: Add extra initialization here
55   -
56   - return TRUE; // return TRUE unless you set the focus to a control
57   -}
58   -
59   -// If you add a minimize button to your dialog, you will need the code below
60   -// to draw the icon. For MFC applications using the document/view model,
61   -// this is automatically done for you by the framework.
62   -
63   -void CBlueFlashToolDlg::OnPaint()
64   -{
65   - if (IsIconic())
66   - {
67   - CPaintDC dc(this); // device context for painting
68   -
69   - SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
70   -
71   - // Center icon in client rectangle
72   - int cxIcon = GetSystemMetrics(SM_CXICON);
73   - int cyIcon = GetSystemMetrics(SM_CYICON);
74   - CRect rect;
75   - GetClientRect(&rect);
76   - int x = (rect.Width() - cxIcon + 1) / 2;
77   - int y = (rect.Height() - cyIcon + 1) / 2;
78   -
79   - // Draw the icon
80   - dc.DrawIcon(x, y, m_hIcon);
81   - }
82   - else
83   - {
84   - CDialog::OnPaint();
85   - }
86   -}
87   -
88   -// The system calls this to obtain the cursor to display while the user drags
89   -// the minimized window.
90   -HCURSOR CBlueFlashToolDlg::OnQueryDragIcon()
91   -{
92   - return (HCURSOR) m_hIcon;
93   -}
1   -// BlueFlashToolDlg.h : header file
2   -//
3   -//{{AFX_INCLUDES()
4   -#include "mscomm.h"
5   -//}}AFX_INCLUDES
6   -
7   -#if !defined(AFX_BLUEFLASHTOOLDLG_H__DE44DC07_CA43_417C_A12F_149A2C736BB5__INCLUDED_)
8   -#define AFX_BLUEFLASHTOOLDLG_H__DE44DC07_CA43_417C_A12F_149A2C736BB5__INCLUDED_
9   -
10   -#if _MSC_VER > 1000
11   -#pragma once
12   -#endif // _MSC_VER > 1000
13   -
14   -/////////////////////////////////////////////////////////////////////////////
15   -// CBlueFlashToolDlg dialog
16   -
17   -class CBlueFlashToolDlg : public CDialog
18   -{
19   -// Construction
20   -public:
21   - CBlueFlashToolDlg(CWnd* pParent = NULL); // standard constructor
22   -
23   -// Dialog Data
24   - //{{AFX_DATA(CBlueFlashToolDlg)
25   - enum { IDD = IDD_BLUEFLASHTOOL_DIALOG };
26   - CMSComm mycom;
27   - //}}AFX_DATA
28   -
29   - // ClassWizard generated virtual function overrides
30   - //{{AFX_VIRTUAL(CBlueFlashToolDlg)
31   - protected:
32   - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
33   - //}}AFX_VIRTUAL
34   -
35   -// Implementation
36   -protected:
37   - HICON m_hIcon;
38   -
39   - // Generated message map functions
40   - //{{AFX_MSG(CBlueFlashToolDlg)
41   - virtual BOOL OnInitDialog();
42   - afx_msg void OnPaint();
43   - afx_msg HCURSOR OnQueryDragIcon();
44   - //}}AFX_MSG
45   - DECLARE_MESSAGE_MAP()
46   -};
47   -
48   -//{{AFX_INSERT_LOCATION}}
49   -// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
50   -
51   -#endif // !defined(AFX_BLUEFLASHTOOLDLG_H__DE44DC07_CA43_417C_A12F_149A2C736BB5__INCLUDED_)
  1 +
  2 +/*-----------------------------------------------------------------------------
  3 +
  4 + This is a part of the Microsoft Source Code Samples.
  5 + Copyright (C) 1995 Microsoft Corporation.
  6 + All rights reserved.
  7 + This source code is only intended as a supplement to
  8 + Microsoft Development Tools and/or WinHelp documentation.
  9 + See these sources for detailed information regarding the
  10 + Microsoft samples programs.
  11 +
  12 + MODULE: Error.c
  13 +
  14 + PURPOSE: Implement error handling functions
  15 + called to report errors.
  16 +
  17 + FUNCTIONS:
  18 + ErrorExtender - Calls FormatMessage to translate error code to
  19 + error text
  20 + ErrorReporter - Reports errors to user
  21 + ErrorHandler - Reports errors, then exits the process
  22 + ErrorInComm - Reports errors, closes comm connection, then exits
  23 +
  24 +-----------------------------------------------------------------------------*/
  25 +
  26 +#include <windows.h>
  27 +#include "mttty.h"
  28 +
  29 +/*
  30 + Prototypes of functions called only in this module
  31 +*/
  32 +DWORD ErrorExtender(DWORD, char **);
  33 +
  34 +
  35 +/*-----------------------------------------------------------------------------
  36 +
  37 +FUNCTION: ErrorExtender(DWORD, char **)
  38 +
  39 +PURPOSE: Translates error codes into error strings
  40 +
  41 +PARAMETERS:
  42 + dwError - error code to be translated
  43 + szBuffer - pointer to error string buffer
  44 +
  45 +COMMENTS: If code can't be translated, then a 1 byte NULL string
  46 + created. The buffer, whether created by FormatMessage, or
  47 + directly is supposed to be freed by the caller.
  48 +
  49 +HISTORY: Date: Author: Comment:
  50 + 10/27/95 AllenD Wrote it
  51 +
  52 +-----------------------------------------------------------------------------*/
  53 +DWORD ErrorExtender(DWORD dwError, char ** szBuffer)
  54 +{
  55 + DWORD dwRes = 0;
  56 +
  57 + dwRes = FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER | 80 ,
  58 + NULL, dwError,
  59 + MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
  60 + (LPTSTR) szBuffer, 0, NULL);
  61 +
  62 + if (dwRes == 0) {
  63 + *szBuffer = LocalAlloc(LPTR, 1);
  64 + return 1;
  65 + }
  66 +
  67 + return dwRes;
  68 +}
  69 +
  70 +
  71 +/*-----------------------------------------------------------------------------
  72 +
  73 +FUNCTION: ErrorReporter(char *)
  74 +
  75 +PURPOSE: Report error to user
  76 +
  77 +PARAMETERS:
  78 + szMessage - Error message from app
  79 +
  80 +COMMENTS: Reports error string in console and in debugger
  81 +
  82 +HISTORY: Date: Author: Comment:
  83 + 10/27/95 AllenD Wrote it
  84 +
  85 +-----------------------------------------------------------------------------*/
  86 +void ErrorReporter(char * szMessage)
  87 +{
  88 + char * szFormat = "Error %d: %s.\n\r%s\r\n"; // format for wsprintf
  89 + char * szExtended; // error string translated from error code
  90 + char * szFinal; // final string to report
  91 + DWORD dwExtSize;
  92 + DWORD dwErr;
  93 +
  94 + dwErr = GetLastError();
  95 +
  96 + /*
  97 + Get error string from system
  98 + */
  99 + dwExtSize = ErrorExtender(dwErr, &szExtended);
  100 +
  101 + /*
  102 + allocate buffer for error string from system, passed in string
  103 + and extra stuff from the szFormat string
  104 + */
  105 + szFinal = LocalAlloc(LPTR, strlen(szMessage) + dwExtSize + 30);
  106 +
  107 + if (szFinal == NULL) // if no final buffer, then can't format error
  108 + MessageBox(ghwndMain, "Cannot properly report error.", "Fatal Error", MB_OK);
  109 + else {
  110 + wsprintf(szFinal, szFormat, dwErr, szMessage, szExtended);
  111 +
  112 + OutputDebugString(szFinal);
  113 +
  114 + if (DISPLAYERRORS(TTYInfo))
  115 + MessageBox(ghwndMain, szFinal, NULL, MB_OK);
  116 +
  117 + LocalFree(szFinal); // free final buffer
  118 + }
  119 +
  120 + /*
  121 + free extended string buffer
  122 + */
  123 + LocalFree(szExtended);
  124 +
  125 + return;
  126 +}
  127 +
  128 +
  129 +/*-----------------------------------------------------------------------------
  130 +
  131 +FUNCTION: ErrorHandler( char * )
  132 +
  133 +PURPOSE: Handle a fatal error (before comm port is opened)
  134 +
  135 +PARAMETERS:
  136 + szMessage - Error message from app
  137 +
  138 +HISTORY: Date: Author: Comment:
  139 + 10/27/95 AllenD Wrote it
  140 +
  141 +-----------------------------------------------------------------------------*/
  142 +void ErrorHandler(char * szMessage)
  143 +{
  144 + ErrorReporter(szMessage);
  145 + ExitProcess(0);
  146 +}
  147 +
  148 +
  149 +/*-----------------------------------------------------------------------------
  150 +
  151 +FUNCTION: ErrorInComm( char * )
  152 +
  153 +PURPOSE: Handle a fatal error after comm port is opened
  154 +
  155 +PARAMETERS:
  156 + szMessage - Error message from app
  157 +
  158 +HISTORY: Date: Author: Comment:
  159 + 10/27/95 AllenD Wrote it
  160 +
  161 +-----------------------------------------------------------------------------*/
  162 +void ErrorInComm(char * szMessage)
  163 +{
  164 + ErrorReporter(szMessage);
  165 + BreakDownCommPort();
  166 + ExitProcess(0);
  167 +}
... ...
  1 +/*-----------------------------------------------------------------------------
  2 +
  3 + This is a part of the Microsoft Source Code Samples.
  4 + Copyright (C) 1995 Microsoft Corporation.
  5 + All rights reserved.
  6 + This source code is only intended as a supplement to
  7 + Microsoft Development Tools and/or WinHelp documentation.
  8 + See these sources for detailed information regarding the
  9 + Microsoft samples programs.
  10 +
  11 + MODULE: Init.c
  12 +
  13 + PURPOSE: Intializes global data and comm port connects.
  14 + Closes comm ports and cleans up global data.
  15 +
  16 + FUNCTIONS:
  17 + GlobalInitialize - Init global variables and system objects
  18 + GlobalCleanup - cleanup global variables and system objects
  19 + ClearTTYContents - Clears the tty buffer
  20 + InitNewFont - Creates a new font for the TTY child window
  21 + CreateTTYInfo - Creates the dynamic tty info structure controlling
  22 + behavior of tty
  23 + DestroyTTYInfo - deallocates tty info structure
  24 + StartThreads - Starts worker threads when a port is opened
  25 + SetupCommPort - Opens the port for the first time
  26 + WaitForThreads - Sets the thread exit event and wait for worker
  27 + threads to exit
  28 + BreakDownCommPort - Closes a connection to the comm port
  29 + DisconnectOK - Asks user if it is ok to disconnect
  30 +
  31 +-----------------------------------------------------------------------------*/
  32 +
  33 +#include <windows.h>
  34 +#include <commctrl.h>
  35 +#include "mttty.h"
  36 +
  37 +#pragma comment(lib,"comctl32.lib")
  38 +
  39 +/*
  40 + Prototypes for functions called only within this file
  41 +*/
  42 +void StartThreads( void );
  43 +DWORD WaitForThreads( DWORD );
  44 +
  45 +/*
  46 + TimeoutsDefault
  47 + We need ReadIntervalTimeout here to cause the read operations
  48 + that we do to actually timeout and become overlapped.
  49 + Specifying 1 here causes ReadFile to return very quickly
  50 + so that our reader thread will continue execution.
  51 +*/
  52 +COMMTIMEOUTS gTimeoutsDefault = { 0x01, 0, 0, 0, 0 };
  53 +
  54 +extern char szFileName[MAX_PATH];
  55 +
  56 +void oem_init(void)
  57 +{
  58 + memset(szFileName,0,sizeof(szFileName));
  59 +}
  60 +
  61 +
  62 +/*-----------------------------------------------------------------------------
  63 +
  64 +FUNCTION: GlobalInitialize
  65 +
  66 +PURPOSE: Intializes global variables before any windows are created
  67 +
  68 +COMMENTS: Partner to GlobalCleanup
  69 +
  70 +HISTORY: Date: Author: Comment:
  71 + 10/27/95 AllenD Wrote it
  72 +
  73 +-----------------------------------------------------------------------------*/
  74 +void GlobalInitialize()
  75 +{
  76 + int cyMenuHeight, cyCaptionHeight, cyFrameHeight;
  77 +
  78 + oem_init();
  79 + //
  80 + // critical sections in status reporting & node management
  81 + //
  82 + InitializeCriticalSection(&gStatusCritical);
  83 + InitializeCriticalSection(&gcsWriterHeap);
  84 + InitializeCriticalSection(&gcsDataHeap);
  85 +
  86 + //
  87 + // status message event
  88 + //
  89 + ghStatusMessageEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
  90 + if (ghStatusMessageEvent == NULL)
  91 + ErrorReporter("CreateEvent (Status message event)");
  92 +
  93 + //
  94 + // thread exit event
  95 + //
  96 + ghThreadExitEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
  97 + if (ghThreadExitEvent == NULL)
  98 + ErrorReporter("CreateEvent (Thread exit event)");
  99 +
  100 + //
  101 + // used in file transfer status bar
  102 + //
  103 + InitCommonControls();
  104 +
  105 + //
  106 + // font for status reporting control
  107 + //
  108 + ghFontStatus = CreateStatusEditFont();
  109 +
  110 + //
  111 + // the following are used for sizing the tty window and dialog windows
  112 + //
  113 + gwBaseY = HIWORD(GetDialogBaseUnits());
  114 + cyMenuHeight = GetSystemMetrics(SM_CYMENU);
  115 + cyCaptionHeight = GetSystemMetrics(SM_CYCAPTION);
  116 + cyFrameHeight = GetSystemMetrics(SM_CYFRAME);
  117 + gcyMinimumWindowHeight = cyMenuHeight + \
  118 + 4 * cyCaptionHeight + \
  119 + 2 * cyFrameHeight +
  120 + (SETTINGSFACTOR + STATUSFACTOR) * gwBaseY ;
  121 + return ;
  122 +}
  123 +
  124 +
  125 +/*-----------------------------------------------------------------------------
  126 +
  127 +FUNCTION: GlobalCleanup
  128 +
  129 +PURPOSE: Cleans up any global variables
  130 +
  131 +COMMENTS: Partner to GlobalInitialize
  132 +
  133 +HISTORY: Date: Author: Comment:
  134 + 10/27/95 AllenD Wrote it
  135 +
  136 +-----------------------------------------------------------------------------*/
  137 +void GlobalCleanup()
  138 +{
  139 + DeleteCriticalSection(&gStatusCritical);
  140 + DeleteCriticalSection(&gcsWriterHeap);
  141 + DeleteCriticalSection(&gcsDataHeap);
  142 + DeleteObject(ghFontStatus);
  143 + CloseHandle(ghStatusMessageEvent);
  144 + CloseHandle(ghThreadExitEvent);
  145 + HeapDestroy(ghStatusMessageHeap);
  146 + return;
  147 +}
  148 +
  149 +
  150 +/*-----------------------------------------------------------------------------
  151 +
  152 +FUNCTION: ClearTTYContents
  153 +
  154 +PURPOSE: Clears the tty buffer
  155 +
  156 +RETURN: always TRUE
  157 +
  158 +HISTORY: Date: Author: Comment:
  159 + 10/27/95 AllenD Wrote it
  160 +
  161 +-----------------------------------------------------------------------------*/
  162 +BOOL ClearTTYContents()
  163 +{
  164 + FillMemory(SCREEN(TTYInfo), MAXCOLS*MAXROWS, ' ');
  165 + return TRUE;
  166 +}
  167 +
  168 +
  169 +/*-----------------------------------------------------------------------------
  170 +
  171 +FUNCTION: InitNewFont(LOGFONT, COLORREF)
  172 +
  173 +PURPOSE: Prepares a font for use in the TTY screen
  174 +
  175 +PARAMETERS:
  176 + LogFont - New logical font for tty screen
  177 + rgbColor - New color for TTY painting
  178 +
  179 +COMMENTS: Called when a new connection is made, or the TTY font
  180 + is changed by the user.
  181 +
  182 +HISTORY: Date: Author: Comment:
  183 + 10/27/95 AllenD Wrote it
  184 +
  185 +-----------------------------------------------------------------------------*/
  186 +void InitNewFont(LOGFONT LogFont, COLORREF rgbColor)
  187 +{
  188 + TEXTMETRIC tm;
  189 + HDC hDC;
  190 +
  191 + //
  192 + // if old one exists, then I should delete it
  193 + //
  194 + if (HTTYFONT(TTYInfo))
  195 + DeleteObject(HTTYFONT(TTYInfo));
  196 +
  197 + LFTTYFONT(TTYInfo) = LogFont;
  198 + HTTYFONT(TTYInfo) = CreateFontIndirect(&(LFTTYFONT(TTYInfo)));
  199 + FGCOLOR(TTYInfo) = rgbColor;
  200 +
  201 + hDC = GetDC( ghwndMain ) ;
  202 + SelectObject( hDC, HTTYFONT( TTYInfo ) ) ;
  203 + GetTextMetrics( hDC, &tm ) ;
  204 + ReleaseDC( ghwndMain, hDC ) ;
  205 +
  206 + //
  207 + // character width and height
  208 + //
  209 + XCHAR( TTYInfo ) = tm.tmAveCharWidth ;
  210 + YCHAR( TTYInfo ) = tm.tmHeight + tm.tmExternalLeading ;
  211 +
  212 + XOFFSET( TTYInfo ) = 0 ;
  213 + YOFFSET( TTYInfo ) = YCHAR(TTYInfo) * ROW(TTYInfo);
  214 +}
  215 +
  216 +extern DWORD BaudTable[];
  217 +/*-----------------------------------------------------------------------------
  218 +
  219 +FUNCTION: InitTTYInfo
  220 +
  221 +PURPOSE: Initializes TTY structure
  222 +
  223 +COMMENTS: This structure is a collection of TTY attributes
  224 + used by all parts of this program
  225 +
  226 +HISTORY: Date: Author: Comment:
  227 + 10/27/95 AllenD Wrote it
  228 + 2/14/96 AllenD Removed npTTYInfo
  229 +
  230 +-----------------------------------------------------------------------------*/
  231 +BOOL InitTTYInfo()
  232 +{
  233 + //
  234 + // initialize generial TTY info
  235 + //
  236 + COMDEV( TTYInfo ) = NULL ;
  237 + CONNECTED( TTYInfo ) = FALSE ;
  238 + LOCALECHO( TTYInfo ) = FALSE ;
  239 + CURSORSTATE( TTYInfo ) = CS_HIDE ;
  240 + PORT( TTYInfo ) = 1 ;
  241 + BAUDRATE( TTYInfo ) = BaudTable[2] ;
  242 + BYTESIZE( TTYInfo ) = 8 ;
  243 + PARITY( TTYInfo ) = NOPARITY ;
  244 + STOPBITS( TTYInfo ) = ONESTOPBIT ;
  245 + AUTOWRAP( TTYInfo ) = TRUE;
  246 + NEWLINE( TTYInfo ) = FALSE;
  247 + XSIZE( TTYInfo ) = 0 ;
  248 + YSIZE( TTYInfo ) = 0 ;
  249 + XSCROLL( TTYInfo ) = 0 ;
  250 + YSCROLL( TTYInfo ) = 0 ;
  251 + COLUMN( TTYInfo ) = 0 ;
  252 + ROW( TTYInfo ) = MAXROWS - 1 ;
  253 + DISPLAYERRORS( TTYInfo ) = TRUE ;
  254 +
  255 + //
  256 + // timeouts
  257 + //
  258 + TIMEOUTSNEW( TTYInfo ) = gTimeoutsDefault;
  259 +
  260 + //
  261 + // read state and status events
  262 + //
  263 + gdwReceiveState = RECEIVE_TTY;
  264 + EVENTFLAGS( TTYInfo ) = EVENTFLAGS_DEFAULT;
  265 + FLAGCHAR( TTYInfo ) = FLAGCHAR_DEFAULT;
  266 +
  267 + //
  268 + // Flow Control Settings
  269 + //
  270 + DTRCONTROL( TTYInfo ) = DTR_CONTROL_ENABLE;
  271 + RTSCONTROL( TTYInfo ) = RTS_CONTROL_ENABLE;
  272 + XONCHAR( TTYInfo ) = ASCII_XON;
  273 + XOFFCHAR( TTYInfo ) = ASCII_XOFF;
  274 + XONLIMIT( TTYInfo ) = 0;
  275 + XOFFLIMIT( TTYInfo ) = 0;
  276 + CTSOUTFLOW( TTYInfo ) = FALSE;
  277 + DSROUTFLOW( TTYInfo ) = FALSE;
  278 + DSRINFLOW( TTYInfo ) = FALSE;
  279 + XONXOFFOUTFLOW(TTYInfo) = FALSE;
  280 + XONXOFFINFLOW(TTYInfo) = FALSE;
  281 + TXAFTERXOFFSENT(TTYInfo) = FALSE;
  282 +
  283 + NOREADING(TTYInfo) = FALSE;
  284 + NOWRITING(TTYInfo) = FALSE;
  285 + NOEVENTS(TTYInfo) = FALSE;
  286 + NOSTATUS(TTYInfo) = FALSE;
  287 + SHOWTIMEOUTS(TTYInfo) = FALSE;
  288 +
  289 + //
  290 + // setup default font information
  291 + //
  292 + LFTTYFONT( TTYInfo ).lfHeight = 20 ;
  293 + LFTTYFONT( TTYInfo ).lfWidth = 0 ;
  294 + LFTTYFONT( TTYInfo ).lfEscapement = 0 ;
  295 + LFTTYFONT( TTYInfo ).lfOrientation = 0 ;
  296 + LFTTYFONT( TTYInfo ).lfWeight = 0 ;
  297 + LFTTYFONT( TTYInfo ).lfItalic = 0 ;
  298 + LFTTYFONT( TTYInfo ).lfUnderline = 0 ;
  299 + LFTTYFONT( TTYInfo ).lfStrikeOut = 0 ;
  300 + LFTTYFONT( TTYInfo ).lfCharSet = ANSI_CHARSET;//OEM_CHARSET ;
  301 + LFTTYFONT( TTYInfo ).lfOutPrecision = OUT_DEFAULT_PRECIS ;
  302 + LFTTYFONT( TTYInfo ).lfClipPrecision = CLIP_DEFAULT_PRECIS ;
  303 + LFTTYFONT( TTYInfo ).lfQuality = DEFAULT_QUALITY ;
  304 + LFTTYFONT( TTYInfo ).lfPitchAndFamily = FIXED_PITCH | FF_MODERN ;
  305 + strcpy( LFTTYFONT( TTYInfo ).lfFaceName, "FixedSys" ) ;
  306 +// strcpy( LFTTYFONT( TTYInfo ).lfFaceName, "Courier New" ) ;
  307 +
  308 + InitNewFont( LFTTYFONT(TTYInfo), RGB(0,0,0));
  309 +
  310 + ClearTTYContents();
  311 +
  312 + return ( TRUE ) ;
  313 +}
  314 +
  315 +/*-----------------------------------------------------------------------------
  316 +
  317 +FUNCTION: DestroyTTYInfo
  318 +
  319 +PURPOSE: Frees objects associated with the TTYInfo structure
  320 +
  321 +HISTORY: Date: Author: Comment:
  322 + 10/27/95 AllenD Wrote it
  323 + 2/14/96 AllenD Removed npTTYInfo
  324 +
  325 +-----------------------------------------------------------------------------*/
  326 +void DestroyTTYInfo()
  327 +{
  328 + DeleteObject(HTTYFONT(TTYInfo));
  329 +}
  330 +
  331 +/*-----------------------------------------------------------------------------
  332 +
  333 +FUNCTION: StartThreads
  334 +
  335 +PURPOSE: Creates the Reader/Status and Writer threads
  336 +
  337 +HISTORY: Date: Author: Comment:
  338 + 10/27/95 AllenD Wrote it
  339 +
  340 +-----------------------------------------------------------------------------*/
  341 +void StartThreads(void)
  342 +{
  343 + DWORD dwReadStatId;
  344 + DWORD dwWriterId;
  345 +
  346 + READSTATTHREAD(TTYInfo) =
  347 + CreateThread( NULL,
  348 + 0,
  349 + (LPTHREAD_START_ROUTINE) ReaderAndStatusProc,
  350 + (LPVOID) ghWndTTY,
  351 + 0,
  352 + &dwReadStatId);
  353 +
  354 + if (READSTATTHREAD(TTYInfo) == NULL)
  355 + ErrorInComm("CreateThread(Reader/Status)");
  356 +
  357 + WRITERTHREAD(TTYInfo) =
  358 + CreateThread( NULL,
  359 + 0,
  360 + (LPTHREAD_START_ROUTINE) WriterProc,
  361 + (LPVOID) NULL,
  362 + 0,
  363 + &dwWriterId );
  364 +
  365 + if (WRITERTHREAD(TTYInfo) == NULL)
  366 + ErrorInComm("CreateThread (Writer)");
  367 +
  368 + return;
  369 +}
  370 +
  371 +/*-----------------------------------------------------------------------------
  372 +
  373 +FUNCTION: SetupCommPort( void )
  374 +
  375 +PURPOSE: Setup Communication Port with our settings
  376 +
  377 +RETURN:
  378 + Handle of comm port is successful
  379 + NULL is error occurs
  380 +
  381 +HISTORY: Date: Author: Comment:
  382 + 10/27/95 AllenD Wrote it
  383 +
  384 +-----------------------------------------------------------------------------*/
  385 +HANDLE SetupCommPort()
  386 +{
  387 + //
  388 + // get tty settings from settings dialog
  389 + //
  390 + UpdateTTYInfo();
  391 +
  392 + //
  393 + // open communication port handle
  394 + //
  395 + COMDEV( TTYInfo ) = CreateFile( gszPort,
  396 + GENERIC_READ | GENERIC_WRITE,
  397 + 0,
  398 + 0,
  399 + OPEN_EXISTING,
  400 + FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED,
  401 + 0);
  402 +
  403 + if (COMDEV(TTYInfo) == INVALID_HANDLE_VALUE) {
  404 + ErrorReporter("CreateFile");
  405 + return NULL;
  406 + }
  407 +
  408 + //
  409 + // Save original comm timeouts and set new ones
  410 + //
  411 + if (!GetCommTimeouts( COMDEV(TTYInfo), &(TIMEOUTSORIG(TTYInfo))))
  412 + ErrorReporter("GetCommTimeouts");
  413 +
  414 + //
  415 + // Set port state
  416 + //
  417 + UpdateConnection();
  418 +
  419 + //
  420 + // set comm buffer sizes
  421 + //
  422 + SetupComm(COMDEV(TTYInfo), MAX_READ_BUFFER, MAX_WRITE_BUFFER);
  423 +
  424 + //
  425 + // raise DTR
  426 + //
  427 + if (!EscapeCommFunction(COMDEV(TTYInfo), SETDTR))
  428 + ErrorReporter("EscapeCommFunction (SETDTR)");
  429 +
  430 + //
  431 + // start threads and set initial thread state to not done
  432 + //
  433 + StartThreads();
  434 +
  435 + //
  436 + // set overall connect flag
  437 + //
  438 + CONNECTED( TTYInfo ) = TRUE ;
  439 +
  440 + return COMDEV(TTYInfo);
  441 +}
  442 +
  443 +/*-----------------------------------------------------------------------------
  444 +
  445 +FUNCTION: WaitForThreads(DWORD)
  446 +
  447 +PURPOSE: Waits a specified time for the worker threads to exit
  448 +
  449 +PARAMETERS:
  450 + dwTimeout - milliseconds to wait until timeout
  451 +
  452 +RETURN:
  453 + WAIT_OBJECT_0 - successful wait, threads are not running
  454 + WAIT_TIMEOUT - at least one thread is still running
  455 + WAIT_FAILED - failure in WaitForMultipleObjects
  456 +
  457 +HISTORY: Date: Author: Comment:
  458 + 10/27/95 AllenD Wrote it
  459 +
  460 +----------------------------------------------------------------------------*/
  461 +DWORD WaitForThreads(DWORD dwTimeout)
  462 +{
  463 + HANDLE hThreads[2];
  464 + DWORD dwRes;
  465 +
  466 + hThreads[0] = READSTATTHREAD(TTYInfo);
  467 + hThreads[1] = WRITERTHREAD(TTYInfo);
  468 +
  469 + //
  470 + // set thread exit event here
  471 + //
  472 + SetEvent(ghThreadExitEvent);
  473 +
  474 + dwRes = WaitForMultipleObjects(2, hThreads, TRUE, dwTimeout);
  475 + switch(dwRes)
  476 + {
  477 + case WAIT_OBJECT_0:
  478 + case WAIT_OBJECT_0 + 1:
  479 + dwRes = WAIT_OBJECT_0;
  480 + break;
  481 +
  482 + case WAIT_TIMEOUT:
  483 +
  484 + if (WaitForSingleObject(READSTATTHREAD(TTYInfo), 0) == WAIT_TIMEOUT)
  485 + OutputDebugString("Reader/Status Thread didn't exit.\n\r");
  486 +
  487 + if (WaitForSingleObject(WRITERTHREAD(TTYInfo), 0) == WAIT_TIMEOUT)
  488 + OutputDebugString("Writer Thread didn't exit.\n\r");
  489 +
  490 + break;
  491 +
  492 + default:
  493 + ErrorReporter("WaitForMultipleObjects");
  494 + break;
  495 + }
  496 +
  497 + //
  498 + // reset thread exit event here
  499 + //
  500 + ResetEvent(ghThreadExitEvent);
  501 +
  502 + return dwRes;
  503 +}
  504 +
  505 +/*-----------------------------------------------------------------------------
  506 +
  507 +FUNCTION: BreakDownCommPort
  508 +
  509 +PURPOSE: Closes a connection to a comm port
  510 +
  511 +RETURN:
  512 + TRUE - successful breakdown of port
  513 + FALSE - port isn't connected
  514 +
  515 +COMMENTS: Waits for threads to exit,
  516 + clears DTR, restores comm port timeouts, purges any i/o
  517 + and closes all pertinent handles
  518 +
  519 +HISTORY: Date: Author: Comment:
  520 + 10/27/95 AllenD Wrote it
  521 +
  522 +-----------------------------------------------------------------------------*/
  523 +BOOL BreakDownCommPort()
  524 +{
  525 + if (!CONNECTED(TTYInfo))
  526 + return FALSE;
  527 +
  528 + CONNECTED( TTYInfo ) = FALSE;
  529 +
  530 + //
  531 + // wait for the threads for a small period
  532 + //
  533 + if (WaitForThreads(20000) != WAIT_OBJECT_0)
  534 + /*
  535 + if threads haven't exited, then they will
  536 + interfere with a new connection. I must abort
  537 + the entire program.
  538 + */
  539 + ErrorHandler("Error closing port.");
  540 +
  541 + //
  542 + // lower DTR
  543 + //
  544 + if (!EscapeCommFunction(COMDEV(TTYInfo), CLRDTR))
  545 + ErrorReporter("EscapeCommFunction(CLRDTR)");
  546 +
  547 + //
  548 + // restore original comm timeouts
  549 + //
  550 + if (!SetCommTimeouts(COMDEV(TTYInfo), &(TIMEOUTSORIG(TTYInfo))))
  551 + ErrorReporter("SetCommTimeouts (Restoration to original)");
  552 +
  553 + //
  554 + // Purge reads/writes, input buffer and output buffer
  555 + //
  556 + if (!PurgeComm(COMDEV(TTYInfo), PURGE_FLAGS))
  557 + ErrorReporter("PurgeComm");
  558 +
  559 + CloseHandle(COMDEV(TTYInfo));
  560 + CloseHandle(READSTATTHREAD(TTYInfo));
  561 + CloseHandle(WRITERTHREAD(TTYInfo));
  562 +
  563 + return TRUE;
  564 +}
  565 +
  566 +/*-----------------------------------------------------------------------------
  567 +
  568 +FUNCTION: DisconnectOK
  569 +
  570 +PURPOSE: Asks user if it is OK to disconnect
  571 +
  572 +RETURN:
  573 + TRUE - OK to disconnect
  574 + FALSE - Disconnect not OK
  575 +
  576 +HISTORY: Date: Author: Comment:
  577 + 10/27/95 AllenD Wrote it
  578 +
  579 +-----------------------------------------------------------------------------*/
  580 +BOOL DisconnectOK()
  581 +{
  582 + char gszPort_Temp[20] = { 0 };
  583 + if (!CONNECTED(TTYInfo))
  584 + return TRUE;
  585 +
  586 +
  587 + GetDlgItemText(ghWndToolbarDlg, IDC_PORTCOMBO, gszPort, sizeof(gszPort));
  588 +
  589 + if (gszPort[3] - '0' > 0 && gszPort[4] - '0' > 0)
  590 + {
  591 + wsprintf(gszPort_Temp, "%s%d", "COM", (gszPort[3] - '0') * 10 + (gszPort[4] - '0'));
  592 + memset(gszPort, 20, sizeof(char));
  593 + strcpy(gszPort, gszPort_Temp);
  594 + }
  595 +
  596 + return ((MessageBox(ghwndMain, "OK to Disconnect?", gszPort, MB_YESNO)) == IDYES);
  597 +}
... ...
  1 +# THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  2 +# ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  3 +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  4 +# PARTICULAR PURPOSE.
  5 +#
  6 +# Copyright (C) 1993 - 1996 Microsoft Corporation. All Rights Reserved.
  7 +#
  8 +#
  9 +# Processor independent makefile
  10 +
  11 +# Nmake macros for building Windows 32-Bit apps
  12 +!include <win32.mak>
  13 +
  14 +PROJ = MTTTY
  15 +
  16 +all: $(PROJ).exe
  17 +
  18 +# Define project specific macros
  19 +PROJ_OBJS = about.obj error.obj \
  20 + init.obj mttty.obj \
  21 + reader.obj readstat.obj \
  22 + settings.obj status.obj \
  23 + transfer.obj writer.obj
  24 +STD_LIBS = libcmt.lib kernel32.lib \
  25 + user32.lib gdi32.lib \
  26 + comdlg32.lib
  27 +EXTRA_LIBS = winmm.lib comctl32.lib
  28 +GLOBAL_DEP = mttty.h ttyinfo.h
  29 +RC_DEP = resource.h mttty.ico \
  30 + mttty2.ico mttty3.ico \
  31 + mttty4.ico
  32 +
  33 +# Inference rule for updating the object files
  34 +.c.obj:
  35 + $(cc) $(cdebug) /MT $(cflags) $(cvars) $*.c
  36 +
  37 +# Build rule for resource file
  38 +$(PROJ).res: $(PROJ).rc $(RC_DEP)
  39 + $(rc) $(rcflags) $(rcvars) /fo $(PROJ).res $(PROJ).rc
  40 +
  41 +# Build rule for EXE
  42 +$(PROJ).EXE: $(PROJ_OBJS) $(PROJ).res
  43 + $(link) $(linkdebug) $(guilflags) \
  44 + $(PROJ_OBJS) $(PROJ).res $(STD_LIBS) $(EXTRA_LIBS) \
  45 + -out:$(PROJ).exe
  46 +
  47 +
  48 +# Rules for cleaning out those old files
  49 +clean:
  50 + del *.bak
  51 + del *.pdb
  52 + del *.obj
  53 + del *.res
  54 + del *.exp
  55 + del *.map
  56 + del *.sbr
  57 + del *.bsc
  58 +
... ...
  1 +/*-----------------------------------------------------------------------------
  2 + This is a part of the Microsoft Source Code Samples.
  3 + Copyright (C) 1995 Microsoft Corporation.
  4 + All rights reserved.
  5 + This source code is only intended as a supplement to
  6 + Microsoft Development Tools and/or WinHelp documentation.
  7 + See these sources for detailed information regarding the
  8 + Microsoft samples programs.
  9 +
  10 + MODULE: mttty.c
  11 +
  12 + PURPOSE: Program entry point and window management
  13 +
  14 + FUNCTIONS:
  15 + WinMain - Program entry point
  16 + VersionCheck - Checks OS version to make sure we can run
  17 + InitializeApp - Global program initialization and window class
  18 + creation
  19 + MTTTYWndProc - main window procedure
  20 + CmdDispatch - Carries out menu commands
  21 + OpenTTYChildWindow - Creates the tty child window
  22 + ScrollTTYVert - Scroll TTY window vertically
  23 + ScrollTTYHorz - Scrolls TTY window horizontally
  24 + PaintTTY - Paints the TTY window
  25 + MoveTTYCursor - moves the tty cursor
  26 + SetTTYFocus - responds to tty window getting focus
  27 + KillTTYFocus - responds to tty window losing focus
  28 + SizeTTY - responds to tty window size changes
  29 + TTYChildProc - window procedure for TTY child window
  30 +
  31 +-----------------------------------------------------------------------------*/
  32 +
  33 +#include <windows.h>
  34 +#include "mttty.h"
  35 +
  36 +/*
  37 + Prototypes for functions called only within this file
  38 +*/
  39 +BOOL InitializeApp( HINSTANCE, int);
  40 +int WINAPI MTTTYWndProc( HWND, UINT, WPARAM, LPARAM );
  41 +int WINAPI TTYChildProc( HWND, UINT, WPARAM, LPARAM );
  42 +void CmdDispatch( int, HWND, LPARAM );
  43 +void OpenTTYChildWindow( HWND );
  44 +BOOL ScrollTTYVert( HWND, WORD, WORD );
  45 +BOOL ScrollTTYHorz( HWND, WORD, WORD );
  46 +BOOL VersionCheck();
  47 +BOOL PaintTTY( HWND );
  48 +
  49 +char szFileName[MAX_PATH];
  50 +
  51 +/*-----------------------------------------------------------------------------
  52 +
  53 +FUNCTION: WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
  54 +
  55 +PURPOSE: Start application and process all window messages
  56 +
  57 +PARAMETERS:
  58 + hInstance - this apps hinstance
  59 + hPrevInstance - previous instance of this app - always NULL
  60 + lpCmdLine - command line parameters
  61 + nCmdShow - code for showing window
  62 +
  63 +RETURN:
  64 + 1 for success
  65 + 0 for failure to start app
  66 +
  67 +HISTORY: Date: Author: Comment:
  68 + 10/27/95 AllenD Wrote it
  69 +
  70 +/*-----------------------------------------------------------------------------*/
  71 +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
  72 +{
  73 + MSG msg;
  74 +
  75 + if (!VersionCheck()) {
  76 + MessageBox(NULL, "MTTTY can't run on this version of Windows.", NULL, MB_OK);
  77 + return 0;
  78 + }
  79 +
  80 + if (!InitializeApp(hInstance, nShowCmd)) {
  81 + MessageBox(NULL, "MTTTY couldn't start!", NULL, MB_OK);
  82 + return 0;
  83 + }
  84 +
  85 + while (GetMessage(&msg, NULL, 0, 0)) {
  86 + if (!TranslateAccelerator( ghwndMain, ghAccel, &msg )) {
  87 + TranslateMessage( &msg ) ;
  88 + DispatchMessage( &msg ) ;
  89 + }
  90 + }
  91 +
  92 + return 1;
  93 +}
  94 +
  95 +
  96 +/*-----------------------------------------------------------------------------
  97 +
  98 +FUNCTION: VersionCheck(void)
  99 +
  100 +PURPOSE: Verifies that the correct version of Windows is running
  101 +
  102 +RETURN:
  103 + TRUE - success version for running this app
  104 + FALSE - correct version not verified
  105 +
  106 +HISTORY: Date: Author: Comment:
  107 + 11/20/95 AllenD Wrote it
  108 +
  109 +-----------------------------------------------------------------------------*/
  110 +BOOL VersionCheck()
  111 +{
  112 + gOSV.dwOSVersionInfoSize = sizeof(gOSV);
  113 + if (!GetVersionEx(&gOSV))
  114 + return FALSE;
  115 +
  116 + if (gOSV.dwPlatformId == VER_PLATFORM_WIN32s)
  117 + return FALSE;
  118 +
  119 + return TRUE ;
  120 +}
  121 +
  122 +
  123 +/*-----------------------------------------------------------------------------
  124 +
  125 +FUNCTION: InitializeApp(HINSTANCE, int)
  126 +
  127 +PURPOSE: GlobalInitialize, Register window classes
  128 + and create main window
  129 +
  130 +PARAMETERS:
  131 + hInst - HINSTANCE of this app
  132 + nShowCmd - code for showing this window
  133 +
  134 +RETURN:
  135 + TRUE - successful inititialization of this app
  136 + FALSE - failure to init app
  137 +
  138 +HISTORY: Date: Author: Comment:
  139 + 10/27/95 AllenD Wrote it
  140 +
  141 +-----------------------------------------------------------------------------*/
  142 +BOOL InitializeApp(HINSTANCE hInst, int nShowCmd)
  143 +{
  144 + WNDCLASS wc = {0};
  145 +
  146 + GlobalInitialize(); // get all global variables initialized to defaults
  147 +
  148 + //
  149 + // setup program's main window class
  150 + //
  151 + wc.lpfnWndProc = (WNDPROC) MTTTYWndProc;
  152 + wc.hInstance = hInst;
  153 + wc.hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_TITLE));
  154 + wc.hCursor = LoadCursor(NULL, IDC_ARROW);
  155 + wc.lpszMenuName = MAKEINTRESOURCE(IDR_MTTTYMENU);
  156 + wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1) ;
  157 + wc.lpszClassName = "MTTTYClass";
  158 +
  159 + if (!RegisterClass(&wc)) {
  160 + GlobalCleanup();
  161 + return FALSE;
  162 + }
  163 +
  164 + //
  165 + // setup program's tty child window class
  166 + //
  167 + wc.lpfnWndProc = (WNDPROC) TTYChildProc;
  168 + wc.hInstance = hInst;
  169 + wc.hCursor = LoadCursor(NULL, IDC_IBEAM);
  170 + wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);
  171 + wc.lpszClassName = "MTTTYChildClass";
  172 + wc.lpszMenuName = NULL;
  173 + wc.hIcon = NULL;
  174 +
  175 + if (!RegisterClass(&wc)) {
  176 + GlobalCleanup();
  177 + return FALSE;
  178 + }
  179 +
  180 + //
  181 + // create main window
  182 + //
  183 + ghwndMain = CreateWindow("MTTTYClass", "OPTEK",
  184 + WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
  185 + STARTXWINDOW, STARTYWINDOW,
  186 + MAXXWINDOW, MAXYWINDOW,
  187 + NULL, NULL, hInst, NULL);
  188 +
  189 + if (ghwndMain == NULL) {
  190 + GlobalCleanup();
  191 + return FALSE;
  192 + }
  193 +
  194 + ShowWindow( ghwndMain, nShowCmd ) ;
  195 + UpdateWindow( ghwndMain ) ;
  196 +
  197 + ghInst = hInst;
  198 + ghAccel = LoadAccelerators( hInst, MAKEINTRESOURCE( IDR_MTTTYACCELERATOR) ) ;
  199 +
  200 + return TRUE;
  201 +}
  202 +
  203 +
  204 +/*-----------------------------------------------------------------------------
  205 +
  206 +FUNCTION: MTTTYWndProc(HWND, UINT, WPARAM, LPARAM)
  207 +
  208 +PURPOSE: Window Procedure for main window
  209 +
  210 +PARAMETERS:
  211 + hwnd - window handle
  212 + message - window message
  213 + wParam - window message parameter (depends on message)
  214 + lParam - window message parameter (depends on message)
  215 +
  216 +RETURN:
  217 + If message is process, return value is 0
  218 + If message is not processed, then it is passed to DefWindowProc
  219 + and the return value from that function is returned
  220 +
  221 +HISTORY: Date: Author: Comment:
  222 + 10/27/95 AllenD Wrote it
  223 +
  224 +-----------------------------------------------------------------------------*/
  225 +int WINAPI MTTTYWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
  226 +{
  227 + switch (message)
  228 + {
  229 + case WM_CREATE:
  230 + //
  231 + // since main window is created, I can now open all other windows
  232 + //
  233 + InitTTYInfo();
  234 + OpenTTYChildWindow(hwnd);
  235 + OpenSettingsToolbar(hwnd);
  236 + OpenStatusToolbar(hwnd);
  237 + ChangeConnection(hwnd, CONNECTED(TTYInfo));
  238 + break;
  239 +
  240 + case WM_DESTROY:
  241 + //
  242 + // since main windows is being destroyed, so same to other windows
  243 + //
  244 + DestroyTTYInfo();
  245 + DestroyWindow(ghWndToolbarDlg);
  246 + DestroyWindow(ghWndStatusDlg);
  247 + DestroyWindow(ghWndTTY);
  248 +
  249 + GlobalCleanup();
  250 + PostQuitMessage(0);
  251 + break;
  252 +
  253 + case WM_GETMINMAXINFO:
  254 + {
  255 + //
  256 + // make sure that main window doesn't get smaller than
  257 + // the minimum child windows.
  258 + //
  259 + LPMINMAXINFO lpTemp;
  260 + POINT ptTemp;
  261 +
  262 + lpTemp = (LPMINMAXINFO) lParam;
  263 +
  264 + ptTemp.x = (long) lpTemp->ptMinTrackSize.x;
  265 + ptTemp.y = (long) gcyMinimumWindowHeight;
  266 +
  267 + lpTemp->ptMinTrackSize = ptTemp;
  268 + }
  269 +
  270 + break;
  271 +
  272 + case WM_SIZE:
  273 + {
  274 + //
  275 + // main window size has changed,
  276 + // so I need to change the positions of child windows
  277 + //
  278 + WORD wTop;
  279 + WORD wHeight;
  280 + WORD wWidth = LOWORD(lParam);
  281 +
  282 + //
  283 + // put Settings window at top
  284 + //
  285 + wHeight = SETTINGSFACTOR*gwBaseY;
  286 + wTop = 0;
  287 + MoveWindow(ghWndToolbarDlg, 0,wTop, wWidth, wHeight, TRUE);
  288 +
  289 + //
  290 + // put Status window at bottom
  291 + //
  292 + wHeight = STATUSFACTOR*gwBaseY;
  293 + wTop = HIWORD(lParam) - wHeight;
  294 + MoveWindow(ghWndStatusDlg, 0, wTop, wWidth, wHeight, TRUE);
  295 +
  296 + //
  297 + // put TTTY window right in the middle
  298 + // height = whole window - height of two previous windows
  299 + //
  300 + wHeight = HIWORD(lParam) - ((STATUSFACTOR + SETTINGSFACTOR)*gwBaseY);
  301 + wTop = SETTINGSFACTOR*gwBaseY;
  302 + MoveWindow(ghWndTTY, 0, wTop, wWidth, wHeight, TRUE);
  303 + }
  304 +
  305 + break;
  306 +
  307 + case WM_COMMAND:
  308 + CmdDispatch(LOWORD(wParam), hwnd, lParam);
  309 + break;
  310 +
  311 + case WM_CHAR:
  312 + SetFocus(ghWndTTY);
  313 + SendMessage(ghWndTTY, WM_CHAR, wParam, lParam);
  314 + break;
  315 +
  316 + case WM_CLOSE:
  317 + /* if (DisconnectOK()) {
  318 + if (CONNECTED(TTYInfo)) {
  319 + if (TRANSFERRING(TTYInfo))
  320 + TransferFileTextEnd();
  321 + BreakDownCommPort();
  322 + }
  323 + DestroyWindow(hwnd);
  324 + }*/
  325 + if (CONNECTED(TTYInfo)) {
  326 + if (TRANSFERRING(TTYInfo))
  327 + TransferFileTextEnd();
  328 + BreakDownCommPort();
  329 + }
  330 + DestroyWindow(hwnd);
  331 + break;
  332 +
  333 + default:
  334 + return DefWindowProc(hwnd, message, wParam, lParam);
  335 + }
  336 +
  337 + return 0L;
  338 +}
  339 +
  340 +
  341 +/*-----------------------------------------------------------------------------
  342 +
  343 +FUNCTION: CmdDispatch(int, HWND)
  344 +
  345 +PURPOSE: Responds to menu selections
  346 +
  347 +PARAMETERS:
  348 + iMenuChoice - ID of menu choice (from resource file)
  349 + hwnd - window handle of menu owner
  350 +
  351 +HISTORY: Date: Author: Comment:
  352 + 10/27/95 AllenD Wrote it
  353 +
  354 +-----------------------------------------------------------------------------*/
  355 +void CmdDispatch(int iMenuChoice, HWND hwnd, LPARAM lParam)
  356 +{
  357 +
  358 + switch (iMenuChoice)
  359 + {
  360 + case ID_HELP_ABOUTMTTTY:
  361 + CmdAbout(hwnd);
  362 + break;
  363 +
  364 + case ID_TRANSFER_SENDFILETEXT:
  365 + {
  366 + char * szFilter = "bin Files\0*.bin\0";
  367 + OPENFILENAME ofn = {0};
  368 +
  369 + ofn.lStructSize = sizeof(OPENFILENAME);
  370 + ofn.hwndOwner = hwnd;
  371 + ofn.lpstrFilter = szFilter;
  372 + ofn.lpstrFile = szFileName;
  373 + ofn.nMaxFile = MAX_PATH;
  374 + ofn.lpstrTitle = "Select file";
  375 + ofn.Flags = OFN_FILEMUSTEXIST;
  376 +
  377 + if (!GetOpenFileName(&ofn))
  378 + break;
  379 +
  380 + UpdateStatus(szFileName);
  381 + //if (TRUE)
  382 + // TransferFileTextStart(szFileName);
  383 + }
  384 + break;
  385 +
  386 + case ID_TRANSFER_RECEIVEFILETEXT:
  387 + {
  388 + char * szFilter = "Text Files\0*.TXT\0";
  389 + OPENFILENAME ofn = {0};
  390 +
  391 + ofn.lStructSize = sizeof(OPENFILENAME);
  392 + ofn.hwndOwner = hwnd;
  393 + ofn.lpstrFilter = szFilter;
  394 + ofn.lpstrFile = szFileName;
  395 + ofn.nMaxFile = MAX_PATH;
  396 + ofn.lpstrTitle = "Receive File";
  397 + ofn.Flags = OFN_OVERWRITEPROMPT;
  398 +
  399 + if (!GetSaveFileName(&ofn))
  400 + break;
  401 +
  402 + ReceiveFileText(szFileName);
  403 + }
  404 + break;
  405 +
  406 + case ID_TRANSFER_ABORTSENDING:
  407 + // was abort sent from the abort button?
  408 + if (LOWORD(lParam) == IDC_ABORTBTN) {
  409 + // am I in a transfer repeat?
  410 + if (REPEATING(TTYInfo))
  411 + TransferRepeatDestroy();
  412 + // am I in a normal recieve state, then stop sending
  413 + else if (gdwReceiveState == RECEIVE_TTY)
  414 + TransferFileTextEnd();
  415 + // if I am not in a normal receive state, then stop capturing
  416 + else
  417 + gfAbortTransfer = TRUE;
  418 + }
  419 + else
  420 + // transfer abort was sent by transfer thread
  421 + TransferFileTextEnd();
  422 + break;
  423 +
  424 + case ID_TRANSFER_SENDREPEATEDLY:
  425 + {
  426 + DWORD dwFreq;
  427 + char * szFilter = "Text Files\0*.TXT\0";
  428 + OPENFILENAME ofn = {0};
  429 +
  430 + ofn.lStructSize = sizeof(OPENFILENAME);
  431 + ofn.hwndOwner = hwnd;
  432 + ofn.lpstrFilter = szFilter;
  433 + ofn.lpstrFile = szFileName;
  434 + ofn.nMaxFile = MAX_PATH;
  435 + ofn.lpstrTitle = "Send File Repeatedly";
  436 + ofn.Flags = OFN_FILEMUSTEXIST;
  437 +
  438 + if (!GetOpenFileName(&ofn))
  439 + break;
  440 +
  441 + dwFreq = GetAFrequency();
  442 +
  443 + TransferRepeatCreate(szFileName, dwFreq);
  444 + }
  445 + break;
  446 +
  447 + case ID_TRANSFER_ABORTREPEATEDSENDING:
  448 + TransferRepeatDestroy();
  449 + break;
  450 +
  451 + case ID_TTY_CLEAR:
  452 + ClearTTYContents();
  453 + InvalidateRect(ghWndTTY, NULL, TRUE);
  454 + break;
  455 +
  456 + // The following correspond to menu choices and buttons in the settings dlog
  457 + case IDC_FONTBTN:
  458 + case IDC_SENDBTN:
  459 + case IDC_COMMEVENTSBTN:
  460 + case IDC_FLOWCONTROLBTN:
  461 + case IDC_TIMEOUTSBTN:
  462 + SendMessage(ghWndToolbarDlg, WM_COMMAND, (WPARAM) iMenuChoice, (LPARAM) GetDlgItem(ghWndToolbarDlg, iMenuChoice));
  463 + break;
  464 +
  465 + case ID_FILE_CONNECT:
  466 + if (SetupCommPort() != NULL)
  467 + ChangeConnection(hwnd, CONNECTED(TTYInfo));
  468 + break;
  469 +
  470 + case ID_FILE_DISCONNECT:
  471 + if (BreakDownCommPort())
  472 + ChangeConnection(hwnd, CONNECTED(TTYInfo));
  473 + break;
  474 +
  475 + case ID_FILE_EXIT:
  476 + PostMessage(hwnd, WM_CLOSE, 0, 0);
  477 + break;
  478 + }
  479 + return;
  480 +}
  481 +
  482 +
  483 +/*-----------------------------------------------------------------------------
  484 +
  485 +FUNCTION: OpenTTYChildWindow(HWND)
  486 +
  487 +PURPOSE: Creates the TTY Child Window
  488 +
  489 +PARAMETERS:
  490 + hWnd - parent window handle of TTY child window
  491 +
  492 +COMMENTS: This window is actually the TTY Screen
  493 +
  494 +HISTORY: Date: Author: Comment:
  495 + 10/27/95 AllenD Wrote it
  496 +
  497 +/*-----------------------------------------------------------------------------*/
  498 +void OpenTTYChildWindow(HWND hWnd)
  499 +{
  500 + ghWndTTY = CreateWindow( "MTTTYChildClass", "TTY Window",
  501 + WS_CHILD | WS_VISIBLE | WS_VSCROLL,
  502 + 0,0,
  503 + 0,0,
  504 + hWnd, (HMENU)ID_TTYWINDOW, ghInst, NULL);
  505 + if (ghWndTTY == NULL)
  506 + ErrorReporter("Can't Create TTY Child Window");
  507 +
  508 + return;
  509 +}
  510 +
  511 +
  512 +//---------------------------------------------------------------------------
  513 +// BOOL NEAR ScrollTTYVert( HWND hWnd, WORD wScrollCmd, WORD wScrollPos )
  514 +//
  515 +// Description:
  516 +// Scrolls TTY window vertically.
  517 +//
  518 +// Parameters:
  519 +// HWND hWnd
  520 +// handle to TTY window
  521 +//
  522 +// WORD wScrollCmd
  523 +// type of scrolling we're doing
  524 +//
  525 +// WORD wScrollPos
  526 +// scroll position
  527 +//
  528 +// History: Date Author Comment
  529 +// 5/ 8/91 BryanW Wrote it.
  530 +// 10/27/95 AllenD Included it for MTTTY Sample.
  531 +//
  532 +//---------------------------------------------------------------------------
  533 +BOOL NEAR ScrollTTYVert( HWND hWnd, WORD wScrollCmd, WORD wScrollPos )
  534 +{
  535 + int nScrollAmt ;
  536 +
  537 + switch (wScrollCmd)
  538 + {
  539 + case SB_TOP:
  540 + nScrollAmt = -YOFFSET( TTYInfo ) ;
  541 + break ;
  542 +
  543 + case SB_BOTTOM:
  544 + nScrollAmt = YSCROLL( TTYInfo ) - YOFFSET( TTYInfo ) ;
  545 + break ;
  546 +
  547 + case SB_PAGEUP:
  548 + nScrollAmt = -YSIZE( TTYInfo ) ;
  549 + break ;
  550 +
  551 + case SB_PAGEDOWN:
  552 + nScrollAmt = YSIZE( TTYInfo ) ;
  553 + break ;
  554 +
  555 + case SB_LINEUP:
  556 + nScrollAmt = -YCHAR( TTYInfo ) ;
  557 + break ;
  558 +
  559 + case SB_LINEDOWN:
  560 + nScrollAmt = YCHAR( TTYInfo ) ;
  561 + break ;
  562 +
  563 + case SB_THUMBPOSITION:
  564 + nScrollAmt = wScrollPos - YOFFSET( TTYInfo ) ;
  565 + break ;
  566 +
  567 + default:
  568 + return ( FALSE ) ;
  569 + }
  570 +
  571 + if ((YOFFSET( TTYInfo ) + nScrollAmt) > YSCROLL( TTYInfo ))
  572 + nScrollAmt = YSCROLL( TTYInfo ) - YOFFSET( TTYInfo ) ;
  573 +
  574 + if ((YOFFSET( TTYInfo ) + nScrollAmt) < 0)
  575 + nScrollAmt = -YOFFSET( TTYInfo ) ;
  576 +
  577 +
  578 +
  579 + if (nScrollAmt != 0)
  580 + {
  581 + YOFFSET( TTYInfo ) = YOFFSET( TTYInfo ) + nScrollAmt ;
  582 +
  583 + SetScrollPos( hWnd, SB_VERT, YOFFSET( TTYInfo ), TRUE ) ;
  584 +
  585 + ScrollWindowEx( hWnd, 0, -nScrollAmt, NULL, NULL, NULL, NULL, SW_INVALIDATE | SW_ERASE) ;
  586 + }
  587 +
  588 +
  589 + return ( TRUE ) ;
  590 +
  591 +} // end of ScrollTTYVert()
  592 +
  593 +//---------------------------------------------------------------------------
  594 +// BOOL NEAR ScrollTTYHorz( HWND hWnd, WORD wScrollCmd, WORD wScrollPos )
  595 +//
  596 +// Description:
  597 +// Scrolls TTY window horizontally.
  598 +//
  599 +// Parameters:
  600 +// HWND hWnd
  601 +// handle to TTY window
  602 +//
  603 +// WORD wScrollCmd
  604 +// type of scrolling we're doing
  605 +//
  606 +// WORD wScrollPos
  607 +// scroll position
  608 +//
  609 +// History: Date Author Comment
  610 +// 5/ 8/91 BryanW Wrote it.
  611 +// 10/27/95 AllenD Included it for MTTTY Sample.
  612 +//
  613 +//---------------------------------------------------------------------------
  614 +BOOL NEAR ScrollTTYHorz( HWND hWnd, WORD wScrollCmd, WORD wScrollPos )
  615 +{
  616 + int nScrollAmt ;
  617 +
  618 + switch (wScrollCmd)
  619 + {
  620 + case SB_TOP:
  621 + nScrollAmt = -XOFFSET( TTYInfo ) ;
  622 + break ;
  623 +
  624 + case SB_BOTTOM:
  625 + nScrollAmt = XSCROLL( TTYInfo ) - XOFFSET( TTYInfo ) ;
  626 + break ;
  627 +
  628 + case SB_PAGEUP:
  629 + nScrollAmt = -XSIZE( TTYInfo ) ;
  630 + break ;
  631 +
  632 + case SB_PAGEDOWN:
  633 + nScrollAmt = XSIZE( TTYInfo ) ;
  634 + break ;
  635 +
  636 + case SB_LINEUP:
  637 + nScrollAmt = -XCHAR( TTYInfo ) ;
  638 + break ;
  639 +
  640 + case SB_LINEDOWN:
  641 + nScrollAmt = XCHAR( TTYInfo ) ;
  642 + break ;
  643 +
  644 + case SB_THUMBPOSITION:
  645 + nScrollAmt = wScrollPos - XOFFSET( TTYInfo ) ;
  646 + break ;
  647 +
  648 + default:
  649 + return ( FALSE ) ;
  650 + }
  651 + if ((XOFFSET( TTYInfo ) + nScrollAmt) > XSCROLL( TTYInfo ))
  652 + nScrollAmt = XSCROLL( TTYInfo ) - XOFFSET( TTYInfo ) ;
  653 + if ((XOFFSET( TTYInfo ) + nScrollAmt) < 0)
  654 + nScrollAmt = -XOFFSET( TTYInfo ) ;
  655 + ScrollWindowEx( hWnd, -nScrollAmt, 0, NULL, NULL, NULL, NULL, SW_INVALIDATE | SW_ERASE) ;
  656 + XOFFSET( TTYInfo ) = XOFFSET( TTYInfo ) + nScrollAmt ;
  657 + SetScrollPos( hWnd, SB_HORZ, XOFFSET( TTYInfo ), TRUE ) ;
  658 +
  659 + return ( TRUE ) ;
  660 +
  661 +} // end of ScrollTTYHorz()
  662 +
  663 +//---------------------------------------------------------------------------
  664 +// BOOL NEAR PaintTTY( HWND hWnd )
  665 +//
  666 +// Description:
  667 +// Paints the rectangle determined by the paint struct of
  668 +// the DC.
  669 +//
  670 +// Parameters:
  671 +// HWND hWnd
  672 +// handle to TTY window (as always)
  673 +//
  674 +// History: Date Author Comment
  675 +// 5/ 9/91 BryanW Wrote it.
  676 +// 10/22/91 BryanW Problem with background color
  677 +// and "off by one" fixed.
  678 +//
  679 +// 2/25/92 BryanW Off-by-one not quite fixed...
  680 +// also resolved min/max problem
  681 +// for windows extended beyond
  682 +// the "TTY display".
  683 +//
  684 +// 10/27/95 AllenD Included it for MTTTY Sample.
  685 +//
  686 +//---------------------------------------------------------------------------
  687 +BOOL NEAR PaintTTY( HWND hWnd )
  688 +{
  689 + PAINTSTRUCT ps ;
  690 + HFONT hOldFont ;
  691 + RECT rect ;
  692 + HDC hDC ;
  693 + int nRow, nCol, nEndRow, nEndCol;
  694 + int nCount, nHorzPos, nVertPos ;
  695 +
  696 + hDC = BeginPaint( hWnd, &ps ) ;
  697 + hOldFont = SelectObject( hDC, HTTYFONT( TTYInfo ) ) ;
  698 + SetTextColor( hDC, FGCOLOR( TTYInfo ) ) ;
  699 + SetBkColor( hDC, GetSysColor( COLOR_WINDOW ) ) ;
  700 + rect = ps.rcPaint ;
  701 + nRow =
  702 + min( MAXROWS - 1,
  703 + max( 0, (rect.top + YOFFSET( TTYInfo )) / YCHAR( TTYInfo ) ) ) ;
  704 + nEndRow =
  705 + min( MAXROWS - 1,
  706 + ((rect.bottom + YOFFSET( TTYInfo ) - 1) / YCHAR( TTYInfo ) ) ) ;
  707 + nCol =
  708 + min( MAXCOLS - 1,
  709 + max( 0, (rect.left + XOFFSET( TTYInfo )) / XCHAR( TTYInfo ) ) ) ;
  710 + nEndCol =
  711 + min( MAXCOLS - 1,
  712 + ((rect.right + XOFFSET( TTYInfo ) - 1) / XCHAR( TTYInfo ) ) ) ;
  713 + nCount = nEndCol - nCol + 1 ;
  714 + for (; nRow <= nEndRow; nRow++)
  715 + {
  716 + nVertPos = (nRow * YCHAR( TTYInfo )) - YOFFSET( TTYInfo ) ;
  717 + nHorzPos = (nCol * XCHAR( TTYInfo )) - XOFFSET( TTYInfo ) ;
  718 + rect.top = nVertPos ;
  719 + rect.bottom = nVertPos + YCHAR( TTYInfo ) ;
  720 + rect.left = nHorzPos ;
  721 + rect.right = nHorzPos + XCHAR( TTYInfo ) * nCount ;
  722 + SetBkMode( hDC, OPAQUE ) ;
  723 + ExtTextOut( hDC, nHorzPos, nVertPos, ETO_OPAQUE | ETO_CLIPPED, &rect,
  724 + (LPSTR)( SCREEN( TTYInfo ) + nRow * MAXCOLS + nCol ),
  725 + nCount, NULL ) ;
  726 + }
  727 + SelectObject( hDC, hOldFont ) ;
  728 + EndPaint( hWnd, &ps ) ;
  729 + MoveTTYCursor( hWnd ) ;
  730 + return ( TRUE ) ;
  731 +
  732 +} // end of PaintTTY()
  733 +
  734 +//---------------------------------------------------------------------------
  735 +// BOOL NEAR MoveTTYCursor( HWND hWnd )
  736 +//
  737 +// Description:
  738 +// Moves caret to current position.
  739 +//
  740 +// Parameters:
  741 +// HWND hWnd
  742 +// handle to TTY window
  743 +//
  744 +// History: Date Author Comment
  745 +// 5/ 9/91 BryanW Wrote it.
  746 +// 10/27/95 AllenD Included it for MTTTY Sample.
  747 +//
  748 +//---------------------------------------------------------------------------
  749 +BOOL NEAR MoveTTYCursor( HWND hWnd )
  750 +{
  751 + if (CONNECTED( TTYInfo ) && (CURSORSTATE( TTYInfo ) & CS_SHOW))
  752 + SetCaretPos( (COLUMN( TTYInfo ) * XCHAR( TTYInfo )) -
  753 + XOFFSET( TTYInfo ),
  754 + (ROW( TTYInfo ) * YCHAR( TTYInfo )) -
  755 + YOFFSET( TTYInfo ) ) ;
  756 +
  757 + return ( TRUE ) ;
  758 +
  759 +} // end of MoveTTYCursor()
  760 +
  761 +//---------------------------------------------------------------------------
  762 +// BOOL NEAR SetTTYFocus( HWND hWnd )
  763 +//
  764 +// Description:
  765 +// Sets the focus to the TTY window also creates caret.
  766 +//
  767 +// Parameters:
  768 +// HWND hWnd
  769 +// handle to TTY window
  770 +//
  771 +// History: Date Author Comment
  772 +// 5/ 9/91 BryanW Wrote it.
  773 +// 10/27/95 AllenD Included it for MTTTY Sample.
  774 +//
  775 +//---------------------------------------------------------------------------
  776 +BOOL NEAR SetTTYFocus( HWND hWnd )
  777 +{
  778 + if (CONNECTED(TTYInfo) && (CURSORSTATE( TTYInfo ) != CS_SHOW) )
  779 + {
  780 + CreateCaret( hWnd, NULL, XCHAR( TTYInfo ), YCHAR( TTYInfo ) ) ;
  781 + ShowCaret( hWnd ) ;
  782 + CURSORSTATE( TTYInfo ) = CS_SHOW ;
  783 + }
  784 +
  785 + MoveTTYCursor( hWnd ) ;
  786 + return ( TRUE ) ;
  787 +
  788 +} // end of SetTTYFocus()
  789 +
  790 +//---------------------------------------------------------------------------
  791 +// BOOL NEAR KillTTYFocus( HWND hWnd )
  792 +//
  793 +// Description:
  794 +// Kills TTY focus and destroys the caret.
  795 +//
  796 +// Parameters:
  797 +// HWND hWnd
  798 +// handle to TTY window
  799 +//
  800 +// History: Date Author Comment
  801 +// 5/ 9/91 BryanW Wrote it.
  802 +// 10/27/95 AllenD Included it for MTTTY Sample.
  803 +//
  804 +//---------------------------------------------------------------------------
  805 +BOOL NEAR KillTTYFocus( HWND hWnd )
  806 +{
  807 + if (CURSORSTATE( TTYInfo ) != CS_HIDE)
  808 + {
  809 + HideCaret( hWnd ) ;
  810 + DestroyCaret() ;
  811 + CURSORSTATE( TTYInfo ) = CS_HIDE ;
  812 + }
  813 + return ( TRUE ) ;
  814 +
  815 +} // end of KillTTYFocus()
  816 +
  817 +
  818 +//---------------------------------------------------------------------------
  819 +// BOOL NEAR SizeTTY( HWND hWnd, WORD wVertSize, WORD wHorzSize )
  820 +//
  821 +// Description:
  822 +// Sizes TTY and sets up scrolling regions.
  823 +//
  824 +// Parameters:
  825 +// HWND hWnd
  826 +// handle to TTY window
  827 +//
  828 +// WORD wVertSize
  829 +// new vertical size
  830 +//
  831 +// WORD wHorzSize
  832 +// new horizontal size
  833 +//
  834 +// History: Date Author Comment
  835 +// 5/ 8/ 91 BryanW Wrote it
  836 +// 10/27/95 AllenD Included it for MTTTY Sample.
  837 +//
  838 +//---------------------------------------------------------------------------
  839 +BOOL NEAR SizeTTY( HWND hWnd, WORD wWidth, WORD wHeight )
  840 +{
  841 + int nScrollAmt ;
  842 +
  843 + //
  844 + // adjust vert settings
  845 + //
  846 + YSIZE( TTYInfo ) = (int) wHeight ;
  847 + YSCROLL( TTYInfo ) = max( 0, (MAXROWS * YCHAR( TTYInfo )) -
  848 + YSIZE( TTYInfo ) ) ;
  849 + nScrollAmt = min( YSCROLL( TTYInfo ), YOFFSET( TTYInfo ) ) -
  850 + YOFFSET( TTYInfo ) ;
  851 + ScrollWindow( hWnd, 0, -nScrollAmt, NULL, NULL ) ;
  852 +
  853 + YOFFSET( TTYInfo ) = YOFFSET( TTYInfo ) + nScrollAmt ;
  854 + SetScrollPos( hWnd, SB_VERT, YOFFSET( TTYInfo ), FALSE ) ;
  855 + SetScrollRange( hWnd, SB_VERT, 0, YSCROLL( TTYInfo ), TRUE ) ;
  856 +
  857 + //
  858 + // adjust horz settings
  859 + //
  860 + XSIZE( TTYInfo ) = (int) wHeight ;
  861 + XSCROLL( TTYInfo ) = max( 0, (MAXCOLS * XCHAR( TTYInfo )) -
  862 + XSIZE( TTYInfo ) ) ;
  863 + nScrollAmt = min( XSCROLL( TTYInfo ), XOFFSET( TTYInfo )) -
  864 + XOFFSET( TTYInfo ) ;
  865 + ScrollWindow( hWnd, nScrollAmt, 0, NULL, NULL );
  866 + XOFFSET( TTYInfo ) = XOFFSET( TTYInfo ) + nScrollAmt ;
  867 + SetScrollRange( hWnd, SB_HORZ, 0, XSCROLL( TTYInfo ), FALSE ) ;
  868 + SetScrollPos( hWnd, SB_HORZ, XOFFSET( TTYInfo ), TRUE ) ;
  869 +
  870 + InvalidateRect( hWnd, NULL, FALSE ) ; // redraw entire window
  871 +
  872 + return ( TRUE ) ;
  873 +
  874 +} // end of SizeTTY()
  875 +
  876 +/*-----------------------------------------------------------------------------
  877 +
  878 +FUNCTION: TTYChildProc(HWND, UINT, WPARAM, LPARAM)
  879 +
  880 +PURPOSE: Window Procedure to process message for the TTY Child Window
  881 +
  882 +PARAMETERS:
  883 + hwnd - window handle
  884 + message - window message
  885 + wParam - window message parameter (depends on message)
  886 + lParam - window message parameter (depends on message)
  887 +
  888 +HISTORY: Date: Author: Comment:
  889 + 10/27/95 AllenD Wrote it
  890 +
  891 +-----------------------------------------------------------------------------*/
  892 +int WINAPI TTYChildProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
  893 +{
  894 + switch(uMessage)
  895 + {
  896 + case WM_VSCROLL:
  897 + ScrollTTYVert( hWnd, LOWORD( wParam ), HIWORD( wParam ) ) ;
  898 + break ;
  899 +
  900 + case WM_HSCROLL:
  901 + ScrollTTYHorz( hWnd, LOWORD( wParam ), HIWORD( wParam ) ) ;
  902 + break ;
  903 +
  904 + case WM_SIZE:
  905 + SizeTTY(hWnd, LOWORD(lParam), HIWORD(lParam));
  906 + break;
  907 +
  908 + case WM_PAINT:
  909 + PaintTTY(hWnd);
  910 + break;
  911 +
  912 + case WM_CHAR:
  913 + {
  914 + //
  915 + // keyboard activity in TTY Window
  916 + //
  917 + if (CONNECTED(TTYInfo)) {
  918 +
  919 + if (!WriterAddNewNode(WRITE_CHAR, 0, (char) wParam, NULL, NULL, NULL))
  920 + return FALSE;
  921 +
  922 + if (LOCALECHO(TTYInfo))
  923 + OutputABufferToWindow(ghWndTTY, (CHAR *) &wParam, 1);
  924 + }
  925 + }
  926 + break;
  927 +
  928 + case WM_SETFOCUS:
  929 + SetTTYFocus( ghWndTTY ) ;
  930 + break ;
  931 +
  932 + case WM_KILLFOCUS:
  933 + KillTTYFocus( ghWndTTY ) ;
  934 + break ;
  935 +
  936 + case WM_MOUSEACTIVATE:
  937 + /*
  938 + If mouse is clicked in me (the tty child window)
  939 + then I need to get the focus.
  940 + */
  941 + SetFocus(hWnd);
  942 + return MA_ACTIVATE;
  943 + break;
  944 +
  945 + default:
  946 + return DefWindowProc(hWnd, uMessage, wParam, lParam);
  947 + }
  948 + return 0L;
  949 +}
... ...
  1 +
  2 +/*-----------------------------------------------------------------------------
  3 + This is a part of the Microsoft Source Code Samples.
  4 + Copyright (C) 1995 Microsoft Corporation.
  5 + All rights reserved.
  6 + This source code is only intended as a supplement to
  7 + Microsoft Development Tools and/or WinHelp documentation.
  8 + See these sources for detailed information regarding the
  9 + Microsoft samples programs.
  10 +
  11 + MODULE: MTTTY.h
  12 +
  13 + PURPOSE: Contains global definitions and variables
  14 +
  15 +-----------------------------------------------------------------------------*/
  16 +
  17 +//
  18 +// File: MTTTY.h
  19 +//
  20 +
  21 +#include "resource.h"
  22 +#include "ttyinfo.h"
  23 +
  24 +//
  25 +// GLOBAL DEFINES
  26 +//
  27 +#define TTY_BUFFER_SIZE MAXROWS * MAXCOLS
  28 +#define MAX_STATUS_BUFFER 20000
  29 +#define MAX_WRITE_BUFFER 1024
  30 +#define MAX_READ_BUFFER 2048
  31 +#define READ_TIMEOUT 500
  32 +#define STATUS_CHECK_TIMEOUT 500
  33 +#define WRITE_CHECK_TIMEOUT 500
  34 +#define PURGE_FLAGS PURGE_TXABORT | PURGE_TXCLEAR | PURGE_RXABORT | PURGE_RXCLEAR
  35 +#define EVENTFLAGS_DEFAULT EV_BREAK | EV_CTS | EV_DSR | EV_ERR | EV_RING | EV_RLSD
  36 +#define FLAGCHAR_DEFAULT '\n'
  37 +
  38 +//
  39 +// Write request types
  40 +//
  41 +#define WRITE_CHAR 0x01
  42 +#define WRITE_FILE 0x02
  43 +#define WRITE_FILESTART 0x03
  44 +#define WRITE_FILEEND 0x04
  45 +#define WRITE_ABORT 0x05
  46 +#define WRITE_BLOCK 0x06
  47 +
  48 +//
  49 +// Read states
  50 +//
  51 +#define RECEIVE_TTY 0x01
  52 +#define RECEIVE_CAPTURED 0x02
  53 +
  54 +//
  55 +// window coords
  56 +//
  57 +#define MAXXWINDOW 750
  58 +#define MAXYWINDOW 530
  59 +#define STARTXWINDOW 80
  60 +#define STARTYWINDOW 70
  61 +
  62 +#define SETTINGSFACTOR 5
  63 +#define STATUSFACTOR 5
  64 +
  65 +//
  66 +// window timer ids
  67 +//
  68 +#define TIMERID 1
  69 +
  70 +//
  71 +// GLOBAL VARIABLES
  72 +//
  73 +OSVERSIONINFO gOSV;
  74 +HINSTANCE ghInst;
  75 +HACCEL ghAccel;
  76 +HWND ghwndMain;
  77 +HWND ghWndToolbarDlg;
  78 +HWND ghWndStatusDlg;
  79 +HWND ghWndTTY;
  80 +HWND ghWndHidden;
  81 +
  82 +//
  83 +// COMMTIMEOUTS is init'd in Init.c
  84 +//
  85 +extern COMMTIMEOUTS gTimeoutsDefault;
  86 +
  87 +//
  88 +// Window placement variables
  89 +//
  90 +WORD gwBaseY;
  91 +LONG gcyMinimumWindowHeight;
  92 +
  93 +//
  94 +// Flags controlling thread actions
  95 +//
  96 +HANDLE ghThreadExitEvent;
  97 +BOOL gfAbortTransfer;
  98 +
  99 +//
  100 +// File transfer variables
  101 +//
  102 +DWORD gdwFileTransferLeft;
  103 +DWORD gdwReceiveState;
  104 +HANDLE ghFileCapture;
  105 +
  106 +//
  107 +// Status updating
  108 +//
  109 +CRITICAL_SECTION gStatusCritical;
  110 +HANDLE ghStatusMessageEvent;
  111 +HANDLE ghStatusMessageHeap;
  112 +HFONT ghFontStatus;
  113 +int gnStatusIndex;
  114 +
  115 +typedef struct STATUS_MESSAGE;
  116 +
  117 +struct STATUS_MESSAGE * glpStatusMessageHead;
  118 +struct STATUS_MESSAGE * glpStatusMessageTail;
  119 +
  120 +typedef struct STATUS_MESSAGE
  121 +{
  122 + struct STATUS_MESSAGE * lpNext; // pointer to next node
  123 + char chMessageStart; // variable length string start here
  124 +} STATUS_MESSAGE;
  125 +
  126 +
  127 +//
  128 +// Port name
  129 +//
  130 +char gszPort[20];
  131 +
  132 +//
  133 +// Writer heap variables
  134 +//
  135 +CRITICAL_SECTION gcsWriterHeap;
  136 +CRITICAL_SECTION gcsDataHeap;
  137 +HANDLE ghWriterHeap;
  138 +HANDLE ghWriterEvent;
  139 +HANDLE ghTransferCompleteEvent;
  140 +
  141 +//
  142 +// Write request data structure; look in Writer.c for more info
  143 +//
  144 +typedef struct WRITEREQUEST;
  145 +
  146 +struct WRITEREQUEST *gpWriterHead;
  147 +struct WRITEREQUEST *gpWriterTail;
  148 +
  149 +typedef struct WRITEREQUEST
  150 +{
  151 + DWORD dwWriteType; // char, file start, file abort, file packet
  152 + DWORD dwSize; // size of buffer
  153 + char ch; // ch to send
  154 + char * lpBuf; // address of buffer to send
  155 + HANDLE hHeap; // heap containing buffer
  156 + HWND hWndProgress; // status bar window handle
  157 + struct WRITEREQUEST *pNext; // next node in the list
  158 + struct WRITEREQUEST *pPrev; // prev node in the list
  159 +} WRITEREQUEST, *PWRITEREQUEST;
  160 +
  161 +
  162 +//
  163 +// Prototypes of functions called between source files
  164 +//
  165 +
  166 +//
  167 +// Error functions
  168 +//
  169 +void ErrorReporter( char * szMessage );
  170 +void ErrorHandler( char * szMessage );
  171 +void ErrorInComm( char * szMessage );
  172 +
  173 +//
  174 +// Initialization/deinitialization/settings functions
  175 +//
  176 +HANDLE SetupCommPort( void );
  177 +void ChangeConnection( HWND, BOOL );
  178 +BOOL BreakDownCommPort( void );
  179 +BOOL UpdateConnection( void );
  180 +void GlobalInitialize( void );
  181 +void DestroyTTYInfo( void );
  182 +void GlobalCleanup( void );
  183 +void UpdateTTYInfo( void );
  184 +BOOL DisconnectOK( void );
  185 +BOOL InitTTYInfo( void );
  186 +void InitNewFont( LOGFONT, COLORREF );
  187 +
  188 +//
  189 +// TTY functions
  190 +//
  191 +void OpenSettingsToolbar( HWND );
  192 +void OpenStatusToolbar( HWND );
  193 +BOOL CmdAbout( HWND );
  194 +
  195 +//
  196 +// TTY functions
  197 +//
  198 +BOOL MoveTTYCursor( HWND );
  199 +BOOL KillTTYFocus( HWND );
  200 +BOOL SetTTYFocus( HWND );
  201 +BOOL SizeTTY( HWND, WORD, WORD );
  202 +
  203 +//
  204 +// Thread procedures
  205 +//
  206 +DWORD WINAPI ReaderAndStatusProc( LPVOID );
  207 +DWORD WINAPI WriterProc( LPVOID );
  208 +
  209 +//
  210 +// File transfer functions
  211 +//
  212 +void CALLBACK TransferRepeatDo( UINT, UINT, DWORD, DWORD, DWORD );
  213 +void TransferRepeatCreate( LPCSTR, DWORD );
  214 +void TransferRepeatDestroy( void );
  215 +void TransferFileTextStart( LPCSTR );
  216 +void TransferFileTextEnd( void );
  217 +// void TransferFileText( LPCTSTR );
  218 +void ReceiveFileText( LPCTSTR );
  219 +DWORD GetAFrequency( void );
  220 +
  221 +//
  222 +// Buffer manipulation functions
  223 +//
  224 +void OutputABufferToWindow( HWND, char *, DWORD );
  225 +void OutputABuffer( HWND, char *, DWORD );
  226 +BOOL ClearTTYContents( void );
  227 +
  228 +//
  229 +// Status functions
  230 +//
  231 +HFONT CreateStatusEditFont( void );
  232 +void ReportStatusEvent( DWORD );
  233 +void CheckModemStatus( BOOL );
  234 +void ReportCommError( void );
  235 +void ReportComStat( COMSTAT );
  236 +void StatusMessage( void );
  237 +void UpdateStatus( char * );
  238 +void CheckComStat( BOOL );
  239 +
  240 +//
  241 +// Writer heap functions
  242 +//
  243 +BOOL WriterAddNewNode( DWORD, DWORD, char, char *, HANDLE, HWND );
  244 +BOOL WriterAddExistingNode( PWRITEREQUEST, DWORD, DWORD, char, char *, HANDLE, HWND );
  245 +BOOL WriterAddNewNodeTimeout( DWORD, DWORD, char, char *, HANDLE, HWND, DWORD );
  246 +BOOL WriterAddFirstNodeTimeout( DWORD, DWORD, char, char *, HANDLE, HWND, DWORD );
  247 +
... ...
No preview for this file type
  1 +# Microsoft Visual C++ Generated NMAKE File, Format Version 2.00
  2 +# ** DO NOT EDIT **
  3 +
  4 +# TARGTYPE "Win32 (x86) Application" 0x0101
  5 +
  6 +!IF "$(CFG)" == ""
  7 +CFG=Win32 Debug
  8 +!MESSAGE No configuration specified. Defaulting to Win32 Debug.
  9 +!ENDIF
  10 +
  11 +!IF "$(CFG)" != "Win32 Release" && "$(CFG)" != "Win32 Debug"
  12 +!MESSAGE Invalid configuration "$(CFG)" specified.
  13 +!MESSAGE You can specify a configuration when running NMAKE on this makefile
  14 +!MESSAGE by defining the macro CFG on the command line. For example:
  15 +!MESSAGE
  16 +!MESSAGE NMAKE /f "MTTTY.mak" CFG="Win32 Debug"
  17 +!MESSAGE
  18 +!MESSAGE Possible choices for configuration are:
  19 +!MESSAGE
  20 +!MESSAGE "Win32 Release" (based on "Win32 (x86) Application")
  21 +!MESSAGE "Win32 Debug" (based on "Win32 (x86) Application")
  22 +!MESSAGE
  23 +!ERROR An invalid configuration is specified.
  24 +!ENDIF
  25 +
  26 +################################################################################
  27 +# Begin Project
  28 +# PROP Target_Last_Scanned "Win32 Debug"
  29 +MTL=MkTypLib.exe
  30 +CPP=cl.exe
  31 +RSC=rc.exe
  32 +
  33 +!IF "$(CFG)" == "Win32 Release"
  34 +
  35 +# PROP BASE Use_MFC 0
  36 +# PROP BASE Use_Debug_Libraries 0
  37 +# PROP BASE Output_Dir "WinRel"
  38 +# PROP BASE Intermediate_Dir "WinRel"
  39 +# PROP Use_MFC 0
  40 +# PROP Use_Debug_Libraries 0
  41 +# PROP Output_Dir "WinRel"
  42 +# PROP Intermediate_Dir "WinRel"
  43 +OUTDIR=.\WinRel
  44 +INTDIR=.\WinRel
  45 +
  46 +ALL : $(OUTDIR)/MTTTY.exe $(OUTDIR)/MTTTY.bsc
  47 +
  48 +$(OUTDIR) :
  49 + if not exist $(OUTDIR)/nul mkdir $(OUTDIR)
  50 +
  51 +# ADD BASE MTL /nologo /D "NDEBUG" /win32
  52 +# ADD MTL /nologo /D "NDEBUG" /win32
  53 +MTL_PROJ=/nologo /D "NDEBUG" /win32
  54 +# ADD BASE CPP /nologo /W3 /GX /YX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR /c
  55 +# ADD CPP /nologo /MD /W3 /GX /YX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR /c
  56 +CPP_PROJ=/nologo /MD /W3 /GX /YX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
  57 + /FR$(INTDIR)/ /Fp$(OUTDIR)/"MTTTY.pch" /Fo$(INTDIR)/ /c
  58 +CPP_OBJS=.\WinRel/
  59 +# ADD BASE RSC /l 0x409 /d "NDEBUG"
  60 +# ADD RSC /l 0x409 /d "NDEBUG"
  61 +RSC_PROJ=/l 0x409 /fo$(INTDIR)/"MTTTY.res" /d "NDEBUG"
  62 +BSC32=bscmake.exe
  63 +# ADD BASE BSC32 /nologo
  64 +# ADD BSC32 /nologo
  65 +BSC32_FLAGS=/nologo /o$(OUTDIR)/"MTTTY.bsc"
  66 +BSC32_SBRS= \
  67 + $(INTDIR)/MTTTY.sbr \
  68 + $(INTDIR)/Status.sbr \
  69 + $(INTDIR)/Reader.sbr \
  70 + $(INTDIR)/Error.sbr \
  71 + $(INTDIR)/About.sbr \
  72 + $(INTDIR)/Settings.sbr \
  73 + $(INTDIR)/Init.sbr \
  74 + $(INTDIR)/Writer.sbr \
  75 + $(INTDIR)/Transfer.sbr \
  76 + $(INTDIR)/ReadStat.sbr
  77 +
  78 +$(OUTDIR)/MTTTY.bsc : $(OUTDIR) $(BSC32_SBRS)
  79 + $(BSC32) @<<
  80 + $(BSC32_FLAGS) $(BSC32_SBRS)
  81 +<<
  82 +
  83 +LINK32=link.exe
  84 +# ADD BASE LINK32 winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /NOLOGO /SUBSYSTEM:windows /MACHINE:I386
  85 +# ADD LINK32 winmm.lib comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /NOLOGO /SUBSYSTEM:windows /MACHINE:I386
  86 +LINK32_FLAGS=winmm.lib comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib\
  87 + comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib\
  88 + odbc32.lib odbccp32.lib /NOLOGO /SUBSYSTEM:windows /INCREMENTAL:no\
  89 + /PDB:$(OUTDIR)/"MTTTY.pdb" /MACHINE:I386 /OUT:$(OUTDIR)/"MTTTY.exe"
  90 +DEF_FILE=
  91 +LINK32_OBJS= \
  92 + $(INTDIR)/MTTTY.obj \
  93 + $(INTDIR)/Status.obj \
  94 + $(INTDIR)/Reader.obj \
  95 + $(INTDIR)/Error.obj \
  96 + $(INTDIR)/About.obj \
  97 + $(INTDIR)/MTTTY.res \
  98 + $(INTDIR)/Settings.obj \
  99 + $(INTDIR)/Init.obj \
  100 + $(INTDIR)/Writer.obj \
  101 + $(INTDIR)/Transfer.obj \
  102 + $(INTDIR)/ReadStat.obj
  103 +
  104 +$(OUTDIR)/MTTTY.exe : $(OUTDIR) $(DEF_FILE) $(LINK32_OBJS)
  105 + $(LINK32) @<<
  106 + $(LINK32_FLAGS) $(LINK32_OBJS)
  107 +<<
  108 +
  109 +!ELSEIF "$(CFG)" == "Win32 Debug"
  110 +
  111 +# PROP BASE Use_MFC 0
  112 +# PROP BASE Use_Debug_Libraries 1
  113 +# PROP BASE Output_Dir "WinDebug"
  114 +# PROP BASE Intermediate_Dir "WinDebug"
  115 +# PROP Use_MFC 0
  116 +# PROP Use_Debug_Libraries 1
  117 +# PROP Output_Dir "WinDebug"
  118 +# PROP Intermediate_Dir "WinDebug"
  119 +OUTDIR=.\WinDebug
  120 +INTDIR=.\WinDebug
  121 +
  122 +ALL : $(OUTDIR)/MTTTY.exe $(OUTDIR)/MTTTY.bsc
  123 +
  124 +$(OUTDIR) :
  125 + if not exist $(OUTDIR)/nul mkdir $(OUTDIR)
  126 +
  127 +# ADD BASE MTL /nologo /D "_DEBUG" /win32
  128 +# ADD MTL /nologo /D "_DEBUG" /win32
  129 +MTL_PROJ=/nologo /D "_DEBUG" /win32
  130 +# ADD BASE CPP /nologo /W3 /GX /Zi /YX /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /c
  131 +# ADD CPP /nologo /MD /W3 /GX /Zi /YX /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /c
  132 +CPP_PROJ=/nologo /MD /W3 /GX /Zi /YX /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\
  133 + /FR$(INTDIR)/ /Fp$(OUTDIR)/"MTTTY.pch" /Fo$(INTDIR)/ /Fd$(OUTDIR)/"MTTTY.pdb"\
  134 + /c
  135 +CPP_OBJS=.\WinDebug/
  136 +# ADD BASE RSC /l 0x409 /d "_DEBUG"
  137 +# ADD RSC /l 0x409 /d "_DEBUG"
  138 +RSC_PROJ=/l 0x409 /fo$(INTDIR)/"MTTTY.res" /d "_DEBUG"
  139 +BSC32=bscmake.exe
  140 +# ADD BASE BSC32 /nologo
  141 +# ADD BSC32 /nologo
  142 +BSC32_FLAGS=/nologo /o$(OUTDIR)/"MTTTY.bsc"
  143 +BSC32_SBRS= \
  144 + $(INTDIR)/MTTTY.sbr \
  145 + $(INTDIR)/Status.sbr \
  146 + $(INTDIR)/Reader.sbr \
  147 + $(INTDIR)/Error.sbr \
  148 + $(INTDIR)/About.sbr \
  149 + $(INTDIR)/Settings.sbr \
  150 + $(INTDIR)/Init.sbr \
  151 + $(INTDIR)/Writer.sbr \
  152 + $(INTDIR)/Transfer.sbr \
  153 + $(INTDIR)/ReadStat.sbr
  154 +
  155 +$(OUTDIR)/MTTTY.bsc : $(OUTDIR) $(BSC32_SBRS)
  156 + $(BSC32) @<<
  157 + $(BSC32_FLAGS) $(BSC32_SBRS)
  158 +<<
  159 +
  160 +LINK32=link.exe
  161 +# ADD BASE LINK32 winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /NOLOGO /SUBSYSTEM:windows /DEBUG /MACHINE:I386
  162 +# ADD LINK32 winmm.lib comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /NOLOGO /SUBSYSTEM:windows /DEBUG /MACHINE:I386
  163 +LINK32_FLAGS=winmm.lib comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib\
  164 + comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib\
  165 + odbc32.lib odbccp32.lib /NOLOGO /SUBSYSTEM:windows /INCREMENTAL:yes\
  166 + /PDB:$(OUTDIR)/"MTTTY.pdb" /DEBUG /MACHINE:I386 /OUT:$(OUTDIR)/"MTTTY.exe"
  167 +DEF_FILE=
  168 +LINK32_OBJS= \
  169 + $(INTDIR)/MTTTY.obj \
  170 + $(INTDIR)/Status.obj \
  171 + $(INTDIR)/Reader.obj \
  172 + $(INTDIR)/Error.obj \
  173 + $(INTDIR)/About.obj \
  174 + $(INTDIR)/MTTTY.res \
  175 + $(INTDIR)/Settings.obj \
  176 + $(INTDIR)/Init.obj \
  177 + $(INTDIR)/Writer.obj \
  178 + $(INTDIR)/Transfer.obj \
  179 + $(INTDIR)/ReadStat.obj
  180 +
  181 +$(OUTDIR)/MTTTY.exe : $(OUTDIR) $(DEF_FILE) $(LINK32_OBJS)
  182 + $(LINK32) @<<
  183 + $(LINK32_FLAGS) $(LINK32_OBJS)
  184 +<<
  185 +
  186 +!ENDIF
  187 +
  188 +.c{$(CPP_OBJS)}.obj:
  189 + $(CPP) $(CPP_PROJ) $<
  190 +
  191 +.cpp{$(CPP_OBJS)}.obj:
  192 + $(CPP) $(CPP_PROJ) $<
  193 +
  194 +.cxx{$(CPP_OBJS)}.obj:
  195 + $(CPP) $(CPP_PROJ) $<
  196 +
  197 +################################################################################
  198 +# Begin Group "Source Files"
  199 +
  200 +################################################################################
  201 +# Begin Source File
  202 +
  203 +SOURCE=.\MTTTY.c
  204 +DEP_MTTTY=\
  205 + .\MTTTY.h\
  206 + .\TTYInfo.h
  207 +
  208 +$(INTDIR)/MTTTY.obj : $(SOURCE) $(DEP_MTTTY) $(INTDIR)
  209 +
  210 +# End Source File
  211 +################################################################################
  212 +# Begin Source File
  213 +
  214 +SOURCE=.\Status.c
  215 +DEP_STATU=\
  216 + .\MTTTY.h\
  217 + .\TTYInfo.h
  218 +
  219 +$(INTDIR)/Status.obj : $(SOURCE) $(DEP_STATU) $(INTDIR)
  220 +
  221 +# End Source File
  222 +################################################################################
  223 +# Begin Source File
  224 +
  225 +SOURCE=.\Reader.c
  226 +DEP_READE=\
  227 + .\MTTTY.h\
  228 + .\TTYInfo.h
  229 +
  230 +$(INTDIR)/Reader.obj : $(SOURCE) $(DEP_READE) $(INTDIR)
  231 +
  232 +# End Source File
  233 +################################################################################
  234 +# Begin Source File
  235 +
  236 +SOURCE=.\Error.c
  237 +DEP_ERROR=\
  238 + .\MTTTY.h\
  239 + .\TTYInfo.h
  240 +
  241 +$(INTDIR)/Error.obj : $(SOURCE) $(DEP_ERROR) $(INTDIR)
  242 +
  243 +# End Source File
  244 +################################################################################
  245 +# Begin Source File
  246 +
  247 +SOURCE=.\About.c
  248 +DEP_ABOUT=\
  249 + .\MTTTY.h\
  250 + .\TTYInfo.h
  251 +
  252 +$(INTDIR)/About.obj : $(SOURCE) $(DEP_ABOUT) $(INTDIR)
  253 +
  254 +# End Source File
  255 +################################################################################
  256 +# Begin Source File
  257 +
  258 +SOURCE=.\MTTTY.RC
  259 +DEP_MTTTY_=\
  260 + .\MTTTY.ICO\
  261 + .\MTTTY2.ICO\
  262 + .\MTTTY3.ICO\
  263 + .\MTTTY4.ICO
  264 +
  265 +$(INTDIR)/MTTTY.res : $(SOURCE) $(DEP_MTTTY_) $(INTDIR)
  266 + $(RSC) $(RSC_PROJ) $(SOURCE)
  267 +
  268 +# End Source File
  269 +################################################################################
  270 +# Begin Source File
  271 +
  272 +SOURCE=.\Settings.c
  273 +DEP_SETTI=\
  274 + .\MTTTY.h\
  275 + .\TTYInfo.h
  276 +
  277 +$(INTDIR)/Settings.obj : $(SOURCE) $(DEP_SETTI) $(INTDIR)
  278 +
  279 +# End Source File
  280 +################################################################################
  281 +# Begin Source File
  282 +
  283 +SOURCE=.\Init.c
  284 +DEP_INIT_=\
  285 + .\MTTTY.h\
  286 + .\TTYInfo.h
  287 +
  288 +$(INTDIR)/Init.obj : $(SOURCE) $(DEP_INIT_) $(INTDIR)
  289 +
  290 +# End Source File
  291 +################################################################################
  292 +# Begin Source File
  293 +
  294 +SOURCE=.\Writer.c
  295 +DEP_WRITE=\
  296 + .\MTTTY.h\
  297 + .\TTYInfo.h
  298 +
  299 +$(INTDIR)/Writer.obj : $(SOURCE) $(DEP_WRITE) $(INTDIR)
  300 +
  301 +# End Source File
  302 +################################################################################
  303 +# Begin Source File
  304 +
  305 +SOURCE=.\Transfer.c
  306 +DEP_TRANS=\
  307 + .\MTTTY.h\
  308 + .\TTYInfo.h
  309 +
  310 +$(INTDIR)/Transfer.obj : $(SOURCE) $(DEP_TRANS) $(INTDIR)
  311 +
  312 +# End Source File
  313 +################################################################################
  314 +# Begin Source File
  315 +
  316 +SOURCE=.\ReadStat.c
  317 +DEP_READS=\
  318 + .\MTTTY.h\
  319 + .\TTYInfo.h
  320 +
  321 +$(INTDIR)/ReadStat.obj : $(SOURCE) $(DEP_READS) $(INTDIR)
  322 +
  323 +# End Source File
  324 +# End Group
  325 +# End Project
  326 +################################################################################
... ...
  1 +// Microsoft Visual C++ generated resource script.
  2 +//
  3 +#include "resource.h"
  4 +
  5 +#define APSTUDIO_READONLY_SYMBOLS
  6 +/////////////////////////////////////////////////////////////////////////////
  7 +//
  8 +// Generated from the TEXTINCLUDE 2 resource.
  9 +//
  10 +#include <Windows.h>
  11 +/////////////////////////////////////////////////////////////////////////////
  12 +#undef APSTUDIO_READONLY_SYMBOLS
  13 +
  14 +/////////////////////////////////////////////////////////////////////////////
  15 +// Ó¢Óï(ÃÀ¹ú) resources
  16 +
  17 +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
  18 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
  19 +#pragma code_page(1252)
  20 +
  21 +/////////////////////////////////////////////////////////////////////////////
  22 +//
  23 +// Accelerator
  24 +//
  25 +
  26 +IDR_MTTTYACCELERATOR ACCELERATORS
  27 +BEGIN
  28 + VK_F5, ID_TRANSFER_SENDFILETEXT, VIRTKEY, NOINVERT
  29 + VK_F5, ID_TRANSFER_ABORTREPEATEDSENDING, VIRTKEY, ALT, NOINVERT
  30 + VK_F5, ID_TRANSFER_ABORTSENDING, VIRTKEY, SHIFT, NOINVERT
  31 + VK_F3, ID_FILE_EXIT, VIRTKEY, NOINVERT ///ASCII, ALT, NOINVERT
  32 + VK_F4, ID_FILE_CONNECT, VIRTKEY, NOINVERT
  33 +END
  34 +
  35 +
  36 +/////////////////////////////////////////////////////////////////////////////
  37 +//
  38 +// Dialog
  39 +//
  40 +
  41 +IDD_ABOUT DIALOG 0, 0, 149, 159
  42 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
  43 +CAPTION "About MTTTY"
  44 +FONT 8, "MS Sans Serif"
  45 +BEGIN
  46 + DEFPUSHBUTTON "Close",IDOK,49,137,50,14
  47 + ICON IDI_APPICON,IDC_PICTURE,9,12,18,20
  48 + LTEXT "Microsoft Corporation",IDC_STATIC,36,15,86,12
  49 + LTEXT "Multi-threaded TTY Sample",IDC_STATIC,36,31,91,12
  50 + LTEXT "Version 4.00",IDC_STATIC,36,47,51,12
  51 + LTEXT "Copyright (c) 1995",IDC_STATIC,36,63,72,12
  52 + EDITTEXT IDC_OSVERSIONINFO,36,81,104,46,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY
  53 +END
  54 +
  55 +IDD_TOOLBARSETTINGS DIALOGEX 0, 0, 414, 132
  56 +STYLE DS_ABSALIGN | DS_SETFONT | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_BORDER
  57 +FONT 14, "Arial Narrow", 400, 0, 0x0
  58 +BEGIN
  59 + COMBOBOX IDC_PORTCOMBO,2,13,48,51,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP
  60 + LTEXT "Baud",IDC_STATIC,54,2,17,8
  61 + COMBOBOX IDC_BAUDCOMBO,67,12,48,64,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
  62 + COMBOBOX IDC_PARITYCOMBO,3,87,48,56,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
  63 + COMBOBOX IDC_DATABITSCOMBO,57,87,48,48,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
  64 + COMBOBOX IDC_STOPBITSCOMBO,110,87,48,39,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
  65 + LTEXT "Port",IDC_STATIC,2,2,17,8
  66 + LTEXT "Parity",IDC_STATIC,5,71,20,8
  67 + LTEXT "Data Bits",IDC_STATIC,59,71,31,9
  68 + LTEXT "Stop Bits",IDC_STATIC,112,71,43,10
  69 + CONTROL "Local Echo",IDC_LOCALECHOCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,275,79,49,10
  70 + CONTROL "Display Errors",IDC_DISPLAYERRORSCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,275,89,57,10
  71 + PUSHBUTTON "Font...",IDC_FONTBTN,3,107,33,14
  72 + PUSHBUTTON "Comm Events...",IDC_COMMEVENTSBTN,41,107,61,14
  73 + CONTROL "CR => CR/LF",IDC_LFBTN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,275,99,56,10
  74 + CONTROL "Autowrap",IDC_AUTOWRAPCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,275,109,43,10
  75 + PUSHBUTTON "Flow Control...",IDC_FLOWCONTROLBTN,105,107,59,14
  76 + PUSHBUTTON "Timeouts...",IDC_TIMEOUTSBTN,169,107,49,14
  77 + CONTROL "No Reading",IDC_NOREADINGCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,341,79,53,10
  78 + CONTROL "No Writing",IDC_NOWRITINGCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,341,89,58,10
  79 + CONTROL "No Status",IDC_NOSTATUSCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,341,109,54,10
  80 + CONTROL "No Events",IDC_NOEVENTSCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,341,99,68,10
  81 + PUSHBUTTON "Send",IDC_SENDBTN,137,11,50,14
  82 +END
  83 +
  84 +IDD_STATUSDIALOG DIALOGEX 0, 0, 459, 156
  85 +STYLE DS_ABSALIGN | DS_SETFONT | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_BORDER
  86 +FONT 8, "MS Sans Serif", 0, 0, 0x0
  87 +BEGIN
  88 + PUSHBUTTON "",IDC_ABORTBTN,4,13,44,27,NOT WS_VISIBLE
  89 + CONTROL "Generic1",IDC_TRANSFERPROGRESS,"msctls_progress32",PBS_SMOOTH | NOT WS_VISIBLE | WS_BORDER,56,12,192,29
  90 + GROUPBOX "Modem Status",IDC_MODEMSTATUSGRP,4,70,153,25
  91 + CONTROL "CTS",IDC_STATCTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,79,26,10
  92 + CONTROL "DSR",IDC_STATDSR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,79,29,10
  93 + CONTROL "RING",IDC_STATRING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,79,30,10
  94 + CONTROL "RLSD (CD)",IDC_STATRLSD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,105,79,48,10
  95 + GROUPBOX "Comm Status",IDC_STATIC,157,76,162,80
  96 + CONTROL "CTS Hold",IDC_CTSHOLDCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,162,95,50,10
  97 + CONTROL "DSR Hold",IDC_DSRHOLDCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,162,107,50,10
  98 + CONTROL "RLSD Hold",IDC_RLSDHOLDCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,146,50,10
  99 + CONTROL "XOFF Hold",IDC_XOFFHOLDCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,214,95,48,10
  100 + CONTROL "XOFF Sent",IDC_XOFFSENTCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,214,107,48,10
  101 + CONTROL "EOF Sent",IDC_EOFSENTCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,211,146,47,10
  102 + CONTROL "TX Char",IDC_TXIMCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,265,95,42,10
  103 + LTEXT "TX Chars:",IDC_STATIC,265,108,34,8
  104 + EDITTEXT IDC_TXCHAREDIT,302,105,19,12,ES_AUTOHSCROLL | ES_READONLY
  105 + LTEXT "RX Chars:",IDC_STATIC,262,146,34,8
  106 + EDITTEXT IDC_RXCHAREDIT,298,144,19,12,ES_AUTOHSCROLL | ES_READONLY
  107 + EDITTEXT IDC_STATUSEDIT,260,3,193,44,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL
  108 +END
  109 +
  110 +IDD_COMMEVENTSDLG DIALOG 0, 0, 226, 113
  111 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
  112 +CAPTION "Select Comm Events"
  113 +FONT 8, "MS Sans Serif"
  114 +BEGIN
  115 + DEFPUSHBUTTON "OK",IDOK,164,8,50,14
  116 + PUSHBUTTON "Cancel",IDCANCEL,164,26,50,14
  117 + PUSHBUTTON "&Defaults",IDC_DEFAULTSBTN,164,44,50,14
  118 + CONTROL "Errors",IDC_EVERRBTN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,10,40,10
  119 + CONTROL "Break",IDC_EVBREAKBTN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,74,10,40,10
  120 + CONTROL "CTS Changes",IDC_EVCTSBTN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,22,60,10
  121 + CONTROL "Ring Indicator",IDC_EVRINGBTN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,74,22,65,10
  122 + CONTROL "DSR Changes",IDC_EVDSRBTN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,34,60,10
  123 + CONTROL "RLSD (CD) Changes",IDC_EVRLSDBTN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,74,34,80,10
  124 + CONTROL "Transmit Buffer Empty",IDC_EVTXEMPTYBTN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,46,89,10
  125 + CONTROL "Character Reception",IDC_EVRXCHARBTN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,58,85,10
  126 + CONTROL "Flag Character Reception",IDC_EVRXFLAGBTN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,70,99,10
  127 + EDITTEXT IDC_FLAGEDIT,19,95,25,12,ES_UPPERCASE | ES_AUTOHSCROLL
  128 + EDITTEXT IDC_FLAGCHAR,49,95,14,12,ES_AUTOHSCROLL | ES_READONLY
  129 + LTEXT "Flag Char Value:",IDC_STATIC,10,85,65,8
  130 + LTEXT "0x",IDC_STATIC,10,99,9,8
  131 +END
  132 +
  133 +IDD_FLOWCONTROLDLG DIALOG 0, 0, 210, 208
  134 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
  135 +CAPTION "Flow Control Settings"
  136 +FONT 8, "MS Sans Serif"
  137 +BEGIN
  138 + DEFPUSHBUTTON "OK",IDOK,153,8,50,14
  139 + PUSHBUTTON "Cancel",IDCANCEL,153,26,50,14
  140 + PUSHBUTTON "&Rts/Cts",IDC_RTSCTSBTN,153,44,50,14
  141 + PUSHBUTTON "&Xoff/Xon",IDC_XOFFXONBTN,153,80,50,14
  142 + PUSHBUTTON "&None",IDC_NONEBTN,153,98,50,14
  143 + CONTROL "CTS Output Control",IDC_CTSOUTCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,20,84,10
  144 + CONTROL "DSR Output Control",IDC_DSROUTCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,32,84,10
  145 + CONTROL "DSR Sensitivity (Input Control)",IDC_DSRINCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,44,113,10
  146 + LTEXT "DTR Control:",IDC_STATIC,16,60,45,9
  147 + LTEXT "RTS Control:",IDC_STATIC,76,60,45,9
  148 + COMBOBOX IDC_DTRCONTROLCOMBO,16,68,52,48,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
  149 + COMBOBOX IDC_RTSCONTROLCOMBO,76,68,52,49,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
  150 + CONTROL "XON/XOFF Output Control",IDC_XONXOFFOUTCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,111,102,10
  151 + CONTROL "XON/XOFF Input Control",IDC_XONXOFFINCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,123,102,10
  152 + EDITTEXT IDC_XONLIMITEDIT,15,158,40,12,ES_AUTOHSCROLL
  153 + EDITTEXT IDC_XOFFLIMITEDIT,79,158,40,12,ES_AUTOHSCROLL
  154 + EDITTEXT IDC_XONCHAREDIT,27,182,24,12,ES_AUTOHSCROLL
  155 + EDITTEXT IDC_XOFFCHAREDIT,91,182,24,12,ES_AUTOHSCROLL
  156 + LTEXT "XON Limit:",IDC_STATIC,15,150,39,8
  157 + LTEXT "XOFF Limit:",IDC_STATIC,79,150,39,8
  158 + LTEXT "Ox",IDC_STATIC,15,185,9,8
  159 + LTEXT "Ox",IDC_STATIC,79,185,9,8
  160 + LTEXT "XON Char:",IDC_STATIC,15,174,39,8
  161 + LTEXT "XOFF Char:",IDC_STATIC,79,174,39,8
  162 + GROUPBOX "Hardware Control Settings",IDC_STATIC,8,8,128,80
  163 + GROUPBOX "Software Control Settings",IDC_STATIC,8,96,136,105
  164 + EDITTEXT IDC_XONCHARDISP,55,182,15,12,ES_AUTOHSCROLL | WS_DISABLED
  165 + EDITTEXT IDC_XOFFCHARDISP,119,182,15,12,ES_AUTOHSCROLL | WS_DISABLED
  166 + CONTROL "Continue sending after XOFF sent",IDC_TXAFTERXOFFSENTCHK,
  167 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,135,122,10
  168 + PUSHBUTTON "&Dtr/Dsr",IDC_DTRDSRBTN,153,62,50,14
  169 +END
  170 +
  171 +IDD_TIMEOUTSDLG DIALOG 0, 0, 231, 158
  172 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
  173 +CAPTION "Timeouts"
  174 +FONT 8, "MS Sans Serif"
  175 +BEGIN
  176 + DEFPUSHBUTTON "OK",IDOK,172,6,50,14
  177 + PUSHBUTTON "Cancel",IDCANCEL,172,24,50,14
  178 + PUSHBUTTON "&Defaults",IDC_DEFAULTSBTN,171,42,50,14
  179 + EDITTEXT IDC_READINTERVALEDIT,114,19,40,14,ES_AUTOHSCROLL
  180 + EDITTEXT IDC_READMULTIPLIEREDIT,114,37,40,14,ES_AUTOHSCROLL
  181 + EDITTEXT IDC_READCONSTANTEDIT,113,55,40,14,ES_AUTOHSCROLL
  182 + EDITTEXT IDC_WRITEMULTIPLIEREDIT,113,95,40,14,ES_AUTOHSCROLL
  183 + EDITTEXT IDC_WRITECONSTANTEDIT,113,113,40,14,ES_AUTOHSCROLL
  184 + LTEXT "Read Interval Timeout:",IDC_STATIC,14,22,76,8
  185 + LTEXT "Read Total Timeout Multipler:",IDC_STATIC,14,40,98,8
  186 + LTEXT "Read Total Timeout Constant:",IDC_STATIC,13,58,99,8
  187 + LTEXT "Write Total Timeout Multiplier:",IDC_STATIC,13,99,99,8
  188 + LTEXT "Write Total Timeout Constant:",IDC_STATIC,13,115,99,8
  189 + GROUPBOX "Read Timeouts",IDC_STATIC,7,7,155,69
  190 + GROUPBOX "Write Timeouts",IDC_STATIC,7,84,155,50
  191 + CONTROL "Display Timeout Status Messages",IDC_DISPLAYTIMEOUTS,
  192 + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,20,140,122,10
  193 +END
  194 +
  195 +IDD_GETADWORD DIALOG 0, 0, 183, 68
  196 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
  197 +CAPTION "Please Enter A Number"
  198 +FONT 8, "MS Sans Serif"
  199 +BEGIN
  200 + EDITTEXT IDC_DWORDEDIT,25,45,52,14,ES_AUTOHSCROLL
  201 + DEFPUSHBUTTON "OK",IDOK,125,10,50,14
  202 + PUSHBUTTON "Cancel",IDCANCEL,125,30,50,14
  203 + LTEXT "Please enter a frequency in milliseconds for the repeated transfer:",IDC_DWORDSTATIC,10,10,94,25
  204 +END
  205 +
  206 +
  207 +/////////////////////////////////////////////////////////////////////////////
  208 +//
  209 +// Icon
  210 +//
  211 +
  212 +// Icon with lowest ID value placed first to ensure application icon
  213 +// remains consistent on all systems.
  214 +IDI_APPICON ICON "MTTTY.ICO"
  215 +
  216 +IDI_APPICON2 ICON "MTTTY2.ICO"
  217 +
  218 +IDI_APPICON3 ICON "MTTTY3.ICO"
  219 +
  220 +IDI_APPICON4 ICON "MTTTY4.ICO"
  221 +
  222 +IDI_TITLE ICON "Optek_Logo_ICO_32 X 32.ico"
  223 +/////////////////////////////////////////////////////////////////////////////
  224 +//
  225 +// Menu
  226 +//
  227 +
  228 +IDR_MTTTYMENU MENU
  229 +BEGIN
  230 + POPUP "&File"
  231 + BEGIN
  232 + MENUITEM "Connect", ID_FILE_CONNECT
  233 + MENUITEM "Disconnect", ID_FILE_DISCONNECT
  234 + MENUITEM SEPARATOR
  235 + MENUITEM "E&xit\tF3", ID_FILE_EXIT
  236 + END
  237 + POPUP "&TTY"
  238 + BEGIN
  239 + MENUITEM "&Clear", ID_TTY_CLEAR
  240 + MENUITEM "&Set Font...", IDC_FONTBTN
  241 + MENUITEM "Comm &Events...", IDC_COMMEVENTSBTN
  242 + MENUITEM "&Flow Control...", IDC_FLOWCONTROLBTN
  243 + MENUITEM "&Timeouts...", IDC_TIMEOUTSBTN
  244 + END
  245 + POPUP "T&ransfer"
  246 + BEGIN
  247 + MENUITEM "&Select file\tF5", ID_TRANSFER_SENDFILETEXT
  248 + MENUITEM "&Receive File (Text)...", ID_TRANSFER_RECEIVEFILETEXT
  249 + MENUITEM "&Abort Sending\tShift+F5", ID_TRANSFER_ABORTSENDING, GRAYED
  250 + MENUITEM SEPARATOR
  251 + MENUITEM "S&end Repeatedly...", ID_TRANSFER_SENDREPEATEDLY
  252 + MENUITEM "A&bort Repeated Sending\tAlt+F5", ID_TRANSFER_ABORTREPEATEDSENDING
  253 + END
  254 + POPUP "&Help"
  255 + BEGIN
  256 + MENUITEM "&About MTTTY", ID_HELP_ABOUTMTTTY
  257 + END
  258 +END
  259 +
  260 +
  261 +#ifdef APSTUDIO_INVOKED
  262 +/////////////////////////////////////////////////////////////////////////////
  263 +//
  264 +// TEXTINCLUDE
  265 +//
  266 +
  267 +1 TEXTINCLUDE
  268 +BEGIN
  269 + "resource.h\0"
  270 +END
  271 +
  272 +2 TEXTINCLUDE
  273 +BEGIN
  274 + "#include <Windows.h>\0"
  275 +END
  276 +
  277 +3 TEXTINCLUDE
  278 +BEGIN
  279 + "\r\n"
  280 + "\0"
  281 +END
  282 +
  283 +#endif // APSTUDIO_INVOKED
  284 +
  285 +
  286 +/////////////////////////////////////////////////////////////////////////////
  287 +//
  288 +// Version
  289 +//
  290 +
  291 +VS_VERSION_INFO VERSIONINFO
  292 + FILEVERSION 4,0,0,0
  293 + PRODUCTVERSION 4,0,0,0
  294 + FILEFLAGSMASK 0x3fL
  295 +#ifdef _DEBUG
  296 + FILEFLAGS 0x1L
  297 +#else
  298 + FILEFLAGS 0x0L
  299 +#endif
  300 + FILEOS 0x4L
  301 + FILETYPE 0x1L
  302 + FILESUBTYPE 0x0L
  303 +BEGIN
  304 + BLOCK "StringFileInfo"
  305 + BEGIN
  306 + BLOCK "040904b0"
  307 + BEGIN
  308 + VALUE "Comments", "Multi-threaded TTY Sample for the Win32 SDK.\r\nDemonstrates serial communiction using multiple threads."
  309 + VALUE "CompanyName", "Microsoft Corporation"
  310 + VALUE "FileDescription", "Multi-threaded TTY Sample for Win32"
  311 + VALUE "FileVersion", "4, 0, 0, 0"
  312 + VALUE "InternalName", "MTTTY"
  313 + VALUE "LegalCopyright", "Copyright ?1995"
  314 + VALUE "OriginalFilename", "MTTTY.exe"
  315 + VALUE "ProductName", "Microsoft MTTTY Sample"
  316 + VALUE "ProductVersion", "4, 0, 0, 0"
  317 + END
  318 + END
  319 + BLOCK "VarFileInfo"
  320 + BEGIN
  321 + VALUE "Translation", 0x409, 1200
  322 + END
  323 +END
  324 +
  325 +
  326 +/////////////////////////////////////////////////////////////////////////////
  327 +//
  328 +// DESIGNINFO
  329 +//
  330 +
  331 +#ifdef APSTUDIO_INVOKED
  332 +GUIDELINES DESIGNINFO
  333 +BEGIN
  334 + IDD_ABOUT, DIALOG
  335 + BEGIN
  336 + END
  337 +
  338 + IDD_TOOLBARSETTINGS, DIALOG
  339 + BEGIN
  340 + BOTTOMMARGIN, 48
  341 + END
  342 +
  343 + IDD_STATUSDIALOG, DIALOG
  344 + BEGIN
  345 + TOPMARGIN, 1
  346 + END
  347 +
  348 + IDD_COMMEVENTSDLG, DIALOG
  349 + BEGIN
  350 + END
  351 +
  352 + IDD_FLOWCONTROLDLG, DIALOG
  353 + BEGIN
  354 + END
  355 +
  356 + IDD_TIMEOUTSDLG, DIALOG
  357 + BEGIN
  358 + END
  359 +
  360 + IDD_GETADWORD, DIALOG
  361 + BEGIN
  362 + LEFTMARGIN, 7
  363 + RIGHTMARGIN, 176
  364 + TOPMARGIN, 7
  365 + BOTTOMMARGIN, 61
  366 + END
  367 +END
  368 +#endif // APSTUDIO_INVOKED
  369 +
  370 +
  371 +/////////////////////////////////////////////////////////////////////////////
  372 +//
  373 +// AFX_DIALOG_LAYOUT
  374 +//
  375 +
  376 +IDD_STATUSDIALOG AFX_DIALOG_LAYOUT
  377 +BEGIN
  378 + 0,
  379 + 0, 0, 0, 0,
  380 + 0, 0, 0, 0,
  381 + 0, 0, 0, 0,
  382 + 0, 0, 0, 0,
  383 + 0, 0, 0, 0,
  384 + 0, 0, 0, 0,
  385 + 0, 0, 0, 0,
  386 + 0, 0, 0, 0,
  387 + 0, 0, 0, 0,
  388 + 0, 0, 0, 0,
  389 + 0, 0, 0, 0,
  390 + 0, 0, 0, 0,
  391 + 0, 0, 0, 0,
  392 + 0, 0, 0, 0,
  393 + 0, 0, 0, 0,
  394 + 0, 0, 0, 0,
  395 + 0, 0, 0, 0,
  396 + 0, 0, 0, 0,
  397 + 0, 0, 0, 0,
  398 + 0, 0, 100, 100
  399 +END
  400 +
  401 +IDD_TOOLBARSETTINGS AFX_DIALOG_LAYOUT
  402 +BEGIN
  403 + 0
  404 +END
  405 +
  406 +#endif // Ó¢Óï(ÃÀ¹ú) resources
  407 +/////////////////////////////////////////////////////////////////////////////
  408 +
  409 +
  410 +
  411 +#ifndef APSTUDIO_INVOKED
  412 +/////////////////////////////////////////////////////////////////////////////
  413 +//
  414 +// Generated from the TEXTINCLUDE 3 resource.
  415 +//
  416 +
  417 +
  418 +/////////////////////////////////////////////////////////////////////////////
  419 +#endif // not APSTUDIO_INVOKED
  420 +
... ...
No preview for this file type
No preview for this file type
No preview for this file type
1   -# Microsoft Developer Studio Project File - Name="BlueFlashTool" - Package Owner=<4>
  1 +# Microsoft Developer Studio Project File - Name="MyMTTTY" - Package Owner=<4>
2 2 # Microsoft Developer Studio Generated Build File, Format Version 6.00
3 3 # ** DO NOT EDIT **
4 4
5 5 # TARGTYPE "Win32 (x86) Application" 0x0101
6 6
7   -CFG=BlueFlashTool - Win32 Debug
  7 +CFG=MyMTTTY - Win32 Debug
8 8 !MESSAGE This is not a valid makefile. To build this project using NMAKE,
9 9 !MESSAGE use the Export Makefile command and run
10 10 !MESSAGE
11   -!MESSAGE NMAKE /f "BlueFlashTool.mak".
  11 +!MESSAGE NMAKE /f "MyMTTTY.mak".
12 12 !MESSAGE
13 13 !MESSAGE You can specify a configuration when running NMAKE
14 14 !MESSAGE by defining the macro CFG on the command line. For example:
15 15 !MESSAGE
16   -!MESSAGE NMAKE /f "BlueFlashTool.mak" CFG="BlueFlashTool - Win32 Debug"
  16 +!MESSAGE NMAKE /f "MyMTTTY.mak" CFG="MyMTTTY - Win32 Debug"
17 17 !MESSAGE
18 18 !MESSAGE Possible choices for configuration are:
19 19 !MESSAGE
20   -!MESSAGE "BlueFlashTool - Win32 Release" (based on "Win32 (x86) Application")
21   -!MESSAGE "BlueFlashTool - Win32 Debug" (based on "Win32 (x86) Application")
  20 +!MESSAGE "MyMTTTY - Win32 Release" (based on "Win32 (x86) Application")
  21 +!MESSAGE "MyMTTTY - Win32 Debug" (based on "Win32 (x86) Application")
22 22 !MESSAGE
23 23
24 24 # Begin Project
... ... @@ -29,109 +29,124 @@ CPP=cl.exe
29 29 MTL=midl.exe
30 30 RSC=rc.exe
31 31
32   -!IF "$(CFG)" == "BlueFlashTool - Win32 Release"
  32 +!IF "$(CFG)" == "MyMTTTY - Win32 Release"
33 33
34   -# PROP BASE Use_MFC 6
  34 +# PROP BASE Use_MFC 0
35 35 # PROP BASE Use_Debug_Libraries 0
36 36 # PROP BASE Output_Dir "Release"
37 37 # PROP BASE Intermediate_Dir "Release"
38 38 # PROP BASE Target_Dir ""
39   -# PROP Use_MFC 6
  39 +# PROP Use_MFC 0
40 40 # PROP Use_Debug_Libraries 0
41 41 # PROP Output_Dir "Release"
42 42 # PROP Intermediate_Dir "Release"
43 43 # PROP Target_Dir ""
44   -# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
45   -# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /c
  44 +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
  45 +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
46 46 # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
47 47 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
48   -# ADD BASE RSC /l 0x804 /d "NDEBUG" /d "_AFXDLL"
49   -# ADD RSC /l 0x804 /d "NDEBUG" /d "_AFXDLL"
  48 +# ADD BASE RSC /l 0x804 /d "NDEBUG"
  49 +# ADD RSC /l 0x804 /d "NDEBUG"
50 50 BSC32=bscmake.exe
51 51 # ADD BASE BSC32 /nologo
52 52 # ADD BSC32 /nologo
53 53 LINK32=link.exe
54   -# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
55   -# ADD LINK32 /nologo /subsystem:windows /machine:I386
  54 +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
  55 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
56 56
57   -!ELSEIF "$(CFG)" == "BlueFlashTool - Win32 Debug"
  57 +!ELSEIF "$(CFG)" == "MyMTTTY - Win32 Debug"
58 58
59   -# PROP BASE Use_MFC 6
  59 +# PROP BASE Use_MFC 0
60 60 # PROP BASE Use_Debug_Libraries 1
61 61 # PROP BASE Output_Dir "Debug"
62 62 # PROP BASE Intermediate_Dir "Debug"
63 63 # PROP BASE Target_Dir ""
64   -# PROP Use_MFC 6
  64 +# PROP Use_MFC 0
65 65 # PROP Use_Debug_Libraries 1
66 66 # PROP Output_Dir "Debug"
67 67 # PROP Intermediate_Dir "Debug"
68 68 # PROP Target_Dir ""
69   -# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c
70   -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
  69 +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
  70 +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
71 71 # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
72 72 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
73   -# ADD BASE RSC /l 0x804 /d "_DEBUG" /d "_AFXDLL"
74   -# ADD RSC /l 0x804 /d "_DEBUG" /d "_AFXDLL"
  73 +# ADD BASE RSC /l 0x804 /d "_DEBUG"
  74 +# ADD RSC /l 0x804 /d "_DEBUG"
75 75 BSC32=bscmake.exe
76 76 # ADD BASE BSC32 /nologo
77 77 # ADD BSC32 /nologo
78 78 LINK32=link.exe
79   -# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
80   -# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
  79 +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
  80 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
81 81
82 82 !ENDIF
83 83
84 84 # Begin Target
85 85
86   -# Name "BlueFlashTool - Win32 Release"
87   -# Name "BlueFlashTool - Win32 Debug"
  86 +# Name "MyMTTTY - Win32 Release"
  87 +# Name "MyMTTTY - Win32 Debug"
88 88 # Begin Group "Source Files"
89 89
90 90 # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
91 91 # Begin Source File
92 92
93   -SOURCE=.\BlueFlashTool.cpp
  93 +SOURCE=.\ABOUT.C
94 94 # End Source File
95 95 # Begin Source File
96 96
97   -SOURCE=.\BlueFlashTool.rc
  97 +SOURCE=.\ERROR.C
98 98 # End Source File
99 99 # Begin Source File
100 100
101   -SOURCE=.\BlueFlashToolDlg.cpp
  101 +SOURCE=.\INIT.C
102 102 # End Source File
103 103 # Begin Source File
104 104
105   -SOURCE=.\mscomm.cpp
  105 +SOURCE=.\MTTTY.C
106 106 # End Source File
107 107 # Begin Source File
108 108
109   -SOURCE=.\StdAfx.cpp
110   -# ADD CPP /Yc"stdafx.h"
  109 +SOURCE=.\MTTTY.RC
111 110 # End Source File
112   -# End Group
113   -# Begin Group "Header Files"
  111 +# Begin Source File
114 112
115   -# PROP Default_Filter "h;hpp;hxx;hm;inl"
  113 +SOURCE=.\READER.C
  114 +# End Source File
116 115 # Begin Source File
117 116
118   -SOURCE=.\BlueFlashTool.h
  117 +SOURCE=.\READSTAT.C
119 118 # End Source File
120 119 # Begin Source File
121 120
122   -SOURCE=.\BlueFlashToolDlg.h
  121 +SOURCE=.\SETTINGS.C
123 122 # End Source File
124 123 # Begin Source File
125 124
126   -SOURCE=.\mscomm.h
  125 +SOURCE=.\STATUS.C
127 126 # End Source File
128 127 # Begin Source File
129 128
130   -SOURCE=.\Resource.h
  129 +SOURCE=.\TRANSFER.C
131 130 # End Source File
132 131 # Begin Source File
133 132
134   -SOURCE=.\StdAfx.h
  133 +SOURCE=.\WRITER.C
  134 +# End Source File
  135 +# End Group
  136 +# Begin Group "Header Files"
  137 +
  138 +# PROP Default_Filter "h;hpp;hxx;hm;inl"
  139 +# Begin Source File
  140 +
  141 +SOURCE=.\MTTTY.H
  142 +# End Source File
  143 +# Begin Source File
  144 +
  145 +SOURCE=.\RESOURCE.H
  146 +# End Source File
  147 +# Begin Source File
  148 +
  149 +SOURCE=.\TTYINFO.H
135 150 # End Source File
136 151 # End Group
137 152 # Begin Group "Resource Files"
... ... @@ -139,25 +154,20 @@ SOURCE=.\StdAfx.h
139 154 # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
140 155 # Begin Source File
141 156
142   -SOURCE=.\res\BlueFlashTool.ico
  157 +SOURCE=.\MTTTY.ICO
143 158 # End Source File
144 159 # Begin Source File
145 160
146   -SOURCE=.\res\BlueFlashTool.rc2
  161 +SOURCE=.\MTTTY2.ICO
147 162 # End Source File
148   -# End Group
149 163 # Begin Source File
150 164
151   -SOURCE=.\ReadMe.txt
  165 +SOURCE=.\MTTTY3.ICO
152 166 # End Source File
  167 +# Begin Source File
  168 +
  169 +SOURCE=.\MTTTY4.ICO
  170 +# End Source File
  171 +# End Group
153 172 # End Target
154 173 # End Project
155   -# Section BlueFlashTool : {648A5600-2C6E-101B-82B6-000000000014}
156   -# 2:21:DefaultSinkHeaderFile:mscomm.h
157   -# 2:16:DefaultSinkClass:CMSComm
158   -# End Section
159   -# Section BlueFlashTool : {E6E17E90-DF38-11CF-8E74-00A0C90F26F8}
160   -# 2:5:Class:CMSComm
161   -# 2:10:HeaderFile:mscomm.h
162   -# 2:8:ImplFile:mscomm.cpp
163   -# End Section
... ...
... ... @@ -3,7 +3,7 @@ Microsoft Developer Studio Workspace File, Format Version 6.00
3 3
4 4 ###############################################################################
5 5
6   -Project: "BlueFlashTool"=.\BlueFlashTool.dsp - Package Owner=<4>
  6 +Project: "MyMTTTY"=.\MyMTTTY.dsp - Package Owner=<4>
7 7
8 8 Package=<5>
9 9 {{{
... ... @@ -23,7 +23,6 @@ Package=<5>
23 23
24 24 Package=<3>
25 25 {{{
26   - {648A5600-2C6E-101B-82B6-000000000014}
27 26 }}}
28 27
29 28 ###############################################################################
... ...
  1 +
  2 +Microsoft Visual Studio Solution File, Format Version 10.00
  3 +# Visual Studio 2008
  4 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MyMTTTY", "MyMTTTY.vcproj", "{DB698040-BB0E-4432-BEF5-5101ED44C10B}"
  5 +EndProject
  6 +Global
  7 + GlobalSection(SolutionConfigurationPlatforms) = preSolution
  8 + Debug|Win32 = Debug|Win32
  9 + Release|Win32 = Release|Win32
  10 + EndGlobalSection
  11 + GlobalSection(ProjectConfigurationPlatforms) = postSolution
  12 + {DB698040-BB0E-4432-BEF5-5101ED44C10B}.Debug|Win32.ActiveCfg = Debug|Win32
  13 + {DB698040-BB0E-4432-BEF5-5101ED44C10B}.Debug|Win32.Build.0 = Debug|Win32
  14 + {DB698040-BB0E-4432-BEF5-5101ED44C10B}.Release|Win32.ActiveCfg = Release|Win32
  15 + {DB698040-BB0E-4432-BEF5-5101ED44C10B}.Release|Win32.Build.0 = Release|Win32
  16 + EndGlobalSection
  17 + GlobalSection(SolutionProperties) = preSolution
  18 + HideSolutionNode = FALSE
  19 + EndGlobalSection
  20 +EndGlobal
... ...
  1 +<?xml version="1.0" encoding="gb2312"?>
  2 +<VisualStudioProject
  3 + ProjectType="Visual C++"
  4 + Version="9.00"
  5 + Name="MyMTTTY"
  6 + ProjectGUID="{DB698040-BB0E-4432-BEF5-5101ED44C10B}"
  7 + TargetFrameworkVersion="0"
  8 + >
  9 + <Platforms>
  10 + <Platform
  11 + Name="Win32"
  12 + />
  13 + </Platforms>
  14 + <ToolFiles>
  15 + </ToolFiles>
  16 + <Configurations>
  17 + <Configuration
  18 + Name="Release|Win32"
  19 + OutputDirectory=".\Release"
  20 + IntermediateDirectory=".\Release"
  21 + ConfigurationType="1"
  22 + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
  23 + UseOfMFC="0"
  24 + ATLMinimizesCRunTimeLibraryUsage="false"
  25 + CharacterSet="2"
  26 + >
  27 + <Tool
  28 + Name="VCPreBuildEventTool"
  29 + />
  30 + <Tool
  31 + Name="VCCustomBuildTool"
  32 + />
  33 + <Tool
  34 + Name="VCXMLDataGeneratorTool"
  35 + />
  36 + <Tool
  37 + Name="VCWebServiceProxyGeneratorTool"
  38 + />
  39 + <Tool
  40 + Name="VCMIDLTool"
  41 + PreprocessorDefinitions="NDEBUG"
  42 + MkTypLibCompatible="true"
  43 + SuppressStartupBanner="true"
  44 + TargetEnvironment="1"
  45 + TypeLibraryName=".\Release/MyMTTTY.tlb"
  46 + HeaderFileName=""
  47 + />
  48 + <Tool
  49 + Name="VCCLCompilerTool"
  50 + Optimization="2"
  51 + InlineFunctionExpansion="1"
  52 + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
  53 + StringPooling="true"
  54 + RuntimeLibrary="0"
  55 + EnableFunctionLevelLinking="true"
  56 + PrecompiledHeaderFile=".\Release/MyMTTTY.pch"
  57 + AssemblerListingLocation=".\Release/"
  58 + ObjectFile=".\Release/"
  59 + ProgramDataBaseFileName=".\Release/"
  60 + WarningLevel="3"
  61 + SuppressStartupBanner="true"
  62 + />
  63 + <Tool
  64 + Name="VCManagedResourceCompilerTool"
  65 + />
  66 + <Tool
  67 + Name="VCResourceCompilerTool"
  68 + PreprocessorDefinitions="NDEBUG"
  69 + Culture="2052"
  70 + />
  71 + <Tool
  72 + Name="VCPreLinkEventTool"
  73 + />
  74 + <Tool
  75 + Name="VCLinkerTool"
  76 + OutputFile=".\Release/MyMTTTY.exe"
  77 + LinkIncremental="1"
  78 + SuppressStartupBanner="true"
  79 + ProgramDatabaseFile=".\Release/MyMTTTY.pdb"
  80 + SubSystem="2"
  81 + RandomizedBaseAddress="1"
  82 + DataExecutionPrevention="0"
  83 + TargetMachine="1"
  84 + />
  85 + <Tool
  86 + Name="VCALinkTool"
  87 + />
  88 + <Tool
  89 + Name="VCManifestTool"
  90 + />
  91 + <Tool
  92 + Name="VCXDCMakeTool"
  93 + />
  94 + <Tool
  95 + Name="VCBscMakeTool"
  96 + SuppressStartupBanner="true"
  97 + OutputFile=".\Release/MyMTTTY.bsc"
  98 + />
  99 + <Tool
  100 + Name="VCFxCopTool"
  101 + />
  102 + <Tool
  103 + Name="VCAppVerifierTool"
  104 + />
  105 + <Tool
  106 + Name="VCPostBuildEventTool"
  107 + />
  108 + </Configuration>
  109 + <Configuration
  110 + Name="Debug|Win32"
  111 + OutputDirectory=".\Debug"
  112 + IntermediateDirectory=".\Debug"
  113 + ConfigurationType="1"
  114 + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
  115 + UseOfMFC="0"
  116 + ATLMinimizesCRunTimeLibraryUsage="false"
  117 + CharacterSet="2"
  118 + >
  119 + <Tool
  120 + Name="VCPreBuildEventTool"
  121 + />
  122 + <Tool
  123 + Name="VCCustomBuildTool"
  124 + />
  125 + <Tool
  126 + Name="VCXMLDataGeneratorTool"
  127 + />
  128 + <Tool
  129 + Name="VCWebServiceProxyGeneratorTool"
  130 + />
  131 + <Tool
  132 + Name="VCMIDLTool"
  133 + PreprocessorDefinitions="_DEBUG"
  134 + MkTypLibCompatible="true"
  135 + SuppressStartupBanner="true"
  136 + TargetEnvironment="1"
  137 + TypeLibraryName=".\Debug/MyMTTTY.tlb"
  138 + HeaderFileName=""
  139 + />
  140 + <Tool
  141 + Name="VCCLCompilerTool"
  142 + Optimization="0"
  143 + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
  144 + MinimalRebuild="true"
  145 + BasicRuntimeChecks="3"
  146 + RuntimeLibrary="1"
  147 + PrecompiledHeaderFile=".\Debug/MyMTTTY.pch"
  148 + AssemblerListingLocation=".\Debug/"
  149 + ObjectFile=".\Debug/"
  150 + ProgramDataBaseFileName=".\Debug/"
  151 + WarningLevel="3"
  152 + SuppressStartupBanner="true"
  153 + DebugInformationFormat="4"
  154 + />
  155 + <Tool
  156 + Name="VCManagedResourceCompilerTool"
  157 + />
  158 + <Tool
  159 + Name="VCResourceCompilerTool"
  160 + PreprocessorDefinitions="_DEBUG"
  161 + Culture="2052"
  162 + />
  163 + <Tool
  164 + Name="VCPreLinkEventTool"
  165 + />
  166 + <Tool
  167 + Name="VCLinkerTool"
  168 + OutputFile=".\Debug/MyMTTTY.exe"
  169 + LinkIncremental="2"
  170 + SuppressStartupBanner="true"
  171 + GenerateDebugInformation="true"
  172 + ProgramDatabaseFile=".\Debug/MyMTTTY.pdb"
  173 + SubSystem="2"
  174 + RandomizedBaseAddress="1"
  175 + DataExecutionPrevention="0"
  176 + TargetMachine="1"
  177 + />
  178 + <Tool
  179 + Name="VCALinkTool"
  180 + />
  181 + <Tool
  182 + Name="VCManifestTool"
  183 + />
  184 + <Tool
  185 + Name="VCXDCMakeTool"
  186 + />
  187 + <Tool
  188 + Name="VCBscMakeTool"
  189 + SuppressStartupBanner="true"
  190 + OutputFile=".\Debug/MyMTTTY.bsc"
  191 + />
  192 + <Tool
  193 + Name="VCFxCopTool"
  194 + />
  195 + <Tool
  196 + Name="VCAppVerifierTool"
  197 + />
  198 + <Tool
  199 + Name="VCPostBuildEventTool"
  200 + />
  201 + </Configuration>
  202 + </Configurations>
  203 + <References>
  204 + </References>
  205 + <Files>
  206 + <Filter
  207 + Name="Source Files"
  208 + Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
  209 + >
  210 + <File
  211 + RelativePath="ABOUT.C"
  212 + >
  213 + <FileConfiguration
  214 + Name="Release|Win32"
  215 + >
  216 + <Tool
  217 + Name="VCCLCompilerTool"
  218 + PreprocessorDefinitions=""
  219 + />
  220 + </FileConfiguration>
  221 + <FileConfiguration
  222 + Name="Debug|Win32"
  223 + >
  224 + <Tool
  225 + Name="VCCLCompilerTool"
  226 + PreprocessorDefinitions=""
  227 + />
  228 + </FileConfiguration>
  229 + </File>
  230 + <File
  231 + RelativePath="ERROR.C"
  232 + >
  233 + <FileConfiguration
  234 + Name="Release|Win32"
  235 + >
  236 + <Tool
  237 + Name="VCCLCompilerTool"
  238 + PreprocessorDefinitions=""
  239 + />
  240 + </FileConfiguration>
  241 + <FileConfiguration
  242 + Name="Debug|Win32"
  243 + >
  244 + <Tool
  245 + Name="VCCLCompilerTool"
  246 + PreprocessorDefinitions=""
  247 + />
  248 + </FileConfiguration>
  249 + </File>
  250 + <File
  251 + RelativePath="INIT.C"
  252 + >
  253 + <FileConfiguration
  254 + Name="Release|Win32"
  255 + >
  256 + <Tool
  257 + Name="VCCLCompilerTool"
  258 + PreprocessorDefinitions=""
  259 + />
  260 + </FileConfiguration>
  261 + <FileConfiguration
  262 + Name="Debug|Win32"
  263 + >
  264 + <Tool
  265 + Name="VCCLCompilerTool"
  266 + PreprocessorDefinitions=""
  267 + />
  268 + </FileConfiguration>
  269 + </File>
  270 + <File
  271 + RelativePath="MTTTY.C"
  272 + >
  273 + <FileConfiguration
  274 + Name="Release|Win32"
  275 + >
  276 + <Tool
  277 + Name="VCCLCompilerTool"
  278 + PreprocessorDefinitions=""
  279 + />
  280 + </FileConfiguration>
  281 + <FileConfiguration
  282 + Name="Debug|Win32"
  283 + >
  284 + <Tool
  285 + Name="VCCLCompilerTool"
  286 + PreprocessorDefinitions=""
  287 + />
  288 + </FileConfiguration>
  289 + </File>
  290 + <File
  291 + RelativePath="MTTTY.RC"
  292 + >
  293 + <FileConfiguration
  294 + Name="Release|Win32"
  295 + >
  296 + <Tool
  297 + Name="VCResourceCompilerTool"
  298 + PreprocessorDefinitions=""
  299 + />
  300 + </FileConfiguration>
  301 + <FileConfiguration
  302 + Name="Debug|Win32"
  303 + >
  304 + <Tool
  305 + Name="VCResourceCompilerTool"
  306 + PreprocessorDefinitions=""
  307 + />
  308 + </FileConfiguration>
  309 + </File>
  310 + <File
  311 + RelativePath="READER.C"
  312 + >
  313 + <FileConfiguration
  314 + Name="Release|Win32"
  315 + >
  316 + <Tool
  317 + Name="VCCLCompilerTool"
  318 + PreprocessorDefinitions=""
  319 + />
  320 + </FileConfiguration>
  321 + <FileConfiguration
  322 + Name="Debug|Win32"
  323 + >
  324 + <Tool
  325 + Name="VCCLCompilerTool"
  326 + PreprocessorDefinitions=""
  327 + />
  328 + </FileConfiguration>
  329 + </File>
  330 + <File
  331 + RelativePath="READSTAT.C"
  332 + >
  333 + <FileConfiguration
  334 + Name="Release|Win32"
  335 + >
  336 + <Tool
  337 + Name="VCCLCompilerTool"
  338 + PreprocessorDefinitions=""
  339 + />
  340 + </FileConfiguration>
  341 + <FileConfiguration
  342 + Name="Debug|Win32"
  343 + >
  344 + <Tool
  345 + Name="VCCLCompilerTool"
  346 + PreprocessorDefinitions=""
  347 + />
  348 + </FileConfiguration>
  349 + </File>
  350 + <File
  351 + RelativePath="SETTINGS.C"
  352 + >
  353 + <FileConfiguration
  354 + Name="Release|Win32"
  355 + >
  356 + <Tool
  357 + Name="VCCLCompilerTool"
  358 + PreprocessorDefinitions=""
  359 + />
  360 + </FileConfiguration>
  361 + <FileConfiguration
  362 + Name="Debug|Win32"
  363 + >
  364 + <Tool
  365 + Name="VCCLCompilerTool"
  366 + PreprocessorDefinitions=""
  367 + />
  368 + </FileConfiguration>
  369 + </File>
  370 + <File
  371 + RelativePath="STATUS.C"
  372 + >
  373 + <FileConfiguration
  374 + Name="Release|Win32"
  375 + >
  376 + <Tool
  377 + Name="VCCLCompilerTool"
  378 + PreprocessorDefinitions=""
  379 + />
  380 + </FileConfiguration>
  381 + <FileConfiguration
  382 + Name="Debug|Win32"
  383 + >
  384 + <Tool
  385 + Name="VCCLCompilerTool"
  386 + PreprocessorDefinitions=""
  387 + />
  388 + </FileConfiguration>
  389 + </File>
  390 + <File
  391 + RelativePath="TRANSFER.C"
  392 + >
  393 + <FileConfiguration
  394 + Name="Release|Win32"
  395 + >
  396 + <Tool
  397 + Name="VCCLCompilerTool"
  398 + PreprocessorDefinitions=""
  399 + />
  400 + </FileConfiguration>
  401 + <FileConfiguration
  402 + Name="Debug|Win32"
  403 + >
  404 + <Tool
  405 + Name="VCCLCompilerTool"
  406 + PreprocessorDefinitions=""
  407 + />
  408 + </FileConfiguration>
  409 + </File>
  410 + <File
  411 + RelativePath="WRITER.C"
  412 + >
  413 + <FileConfiguration
  414 + Name="Release|Win32"
  415 + >
  416 + <Tool
  417 + Name="VCCLCompilerTool"
  418 + PreprocessorDefinitions=""
  419 + />
  420 + </FileConfiguration>
  421 + <FileConfiguration
  422 + Name="Debug|Win32"
  423 + >
  424 + <Tool
  425 + Name="VCCLCompilerTool"
  426 + PreprocessorDefinitions=""
  427 + />
  428 + </FileConfiguration>
  429 + </File>
  430 + </Filter>
  431 + <Filter
  432 + Name="Header Files"
  433 + Filter="h;hpp;hxx;hm;inl"
  434 + >
  435 + <File
  436 + RelativePath="MTTTY.H"
  437 + >
  438 + </File>
  439 + <File
  440 + RelativePath="RESOURCE.H"
  441 + >
  442 + </File>
  443 + <File
  444 + RelativePath="TTYINFO.H"
  445 + >
  446 + </File>
  447 + </Filter>
  448 + <Filter
  449 + Name="Resource Files"
  450 + Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
  451 + >
  452 + <File
  453 + RelativePath="MTTTY.ICO"
  454 + >
  455 + </File>
  456 + <File
  457 + RelativePath="MTTTY2.ICO"
  458 + >
  459 + </File>
  460 + <File
  461 + RelativePath="MTTTY3.ICO"
  462 + >
  463 + </File>
  464 + <File
  465 + RelativePath="MTTTY4.ICO"
  466 + >
  467 + </File>
  468 + </Filter>
  469 + </Files>
  470 + <Globals>
  471 + </Globals>
  472 +</VisualStudioProject>
... ...
No preview for this file type
  1 +/*-----------------------------------------------------------------------------
  2 +
  3 + This is a part of the Microsoft Source Code Samples.
  4 + Copyright (C) 1995 Microsoft Corporation.
  5 + All rights reserved.
  6 + This source code is only intended as a supplement to
  7 + Microsoft Development Tools and/or WinHelp documentation.
  8 + See these sources for detailed information regarding the
  9 + Microsoft samples programs.
  10 +
  11 + MODULE: Reader.c
  12 +
  13 + PURPOSE: Read from comm port
  14 +
  15 + FUNCTIONS:
  16 + OutputABufferToWindow - process incoming data destined for tty window
  17 + OutputABufferToFile - process incoming data destined for a file
  18 + OutputABuffer - called when data is read from port
  19 +
  20 +-----------------------------------------------------------------------------*/
  21 +
  22 +#include <windows.h>
  23 +#include <commctrl.h>
  24 +
  25 +#include "MTTTY.h"
  26 +
  27 +/*
  28 + Prototypes for functions call only within this file
  29 +*/
  30 +void OutputABufferToFile( HANDLE, char *, DWORD );
  31 +
  32 +
  33 +/*-----------------------------------------------------------------------------
  34 +
  35 +FUNCTION: OutputABufferToWindow(HWND, char *, DWORD)
  36 +
  37 +PURPOSE: Updates TTY Buffer with characters just received.
  38 +
  39 +PARAMETERS:
  40 + hTTY - handle to the TTY child window
  41 + lpBuf - address of data buffer
  42 + dwBufLen - size of data buffer
  43 +
  44 +HISTORY: Date Author Comment
  45 + 5/ 8/91 BryanW Wrote it
  46 + 10/27/95 AllenD Modified for MTTTY Sample
  47 +
  48 +-----------------------------------------------------------------------------*/
  49 +void OutputABufferToWindow(HWND hTTY, char * lpBuf, DWORD dwBufLen)
  50 +{
  51 + RECT rect;
  52 +
  53 + /*
  54 + update screen buffer with new buffer
  55 + need to do a character by character check
  56 + for special characters
  57 + */
  58 + int i;
  59 +
  60 + for ( i = 0 ; i < (int) dwBufLen; i++) {
  61 + switch (lpBuf[ i ]) {
  62 + case ASCII_BEL: // BELL CHAR
  63 + MessageBeep( 0 ) ;
  64 + break ;
  65 +
  66 + case ASCII_BS: // Backspace CHAR
  67 + if (COLUMN( TTYInfo ) > 0)
  68 + COLUMN( TTYInfo ) -- ;
  69 + break ;
  70 +
  71 + case ASCII_CR: // Carriage Return
  72 + COLUMN( TTYInfo ) = 0 ;
  73 + if (!NEWLINE( TTYInfo ))
  74 + break;
  75 +
  76 + //
  77 + // FALL THROUGH
  78 + //
  79 +
  80 + case ASCII_LF: // Line Feed
  81 + if (ROW( TTYInfo )++ == MAXROWS - 1)
  82 + {
  83 + MoveMemory( (LPSTR) (SCREEN( TTYInfo )),
  84 + (LPSTR) (SCREEN( TTYInfo ) + MAXCOLS),
  85 + (MAXROWS - 1) * MAXCOLS ) ;
  86 + FillMemory((LPSTR) (SCREEN( TTYInfo ) + (MAXROWS - 1) * MAXCOLS),
  87 + MAXCOLS, ' ' ) ;
  88 + InvalidateRect( hTTY, NULL, FALSE ) ;
  89 + ROW( TTYInfo )-- ;
  90 + }
  91 + break ;
  92 +
  93 + default: // standard character
  94 + SCREENCHAR(TTYInfo, COLUMN(TTYInfo), ROW(TTYInfo)) = lpBuf[ i ];
  95 +
  96 + rect.left = (COLUMN( TTYInfo ) * XCHAR( TTYInfo )) -
  97 + XOFFSET( TTYInfo ) ;
  98 + rect.right = rect.left + XCHAR( TTYInfo ) ;
  99 + rect.top = (ROW( TTYInfo ) * YCHAR( TTYInfo )) -
  100 + YOFFSET( TTYInfo ) ;
  101 + rect.bottom = rect.top + YCHAR( TTYInfo ) ;
  102 + InvalidateRect( hTTY, &rect, FALSE ) ;
  103 +
  104 + //
  105 + // Line wrap
  106 + //
  107 + if (COLUMN( TTYInfo ) < MAXCOLS-1 )
  108 + COLUMN( TTYInfo )++ ;
  109 + else if (AUTOWRAP( TTYInfo ))
  110 + OutputABufferToWindow(hTTY, "\r\n", 2 ) ;
  111 +
  112 + break;
  113 + }
  114 + }
  115 +
  116 + MoveTTYCursor(hTTY);
  117 + return;
  118 +}
  119 +
  120 +/*-----------------------------------------------------------------------------
  121 +
  122 +FUNCTION: OutputABufferToFile(HANDLE, char *, DWORD)
  123 +
  124 +PURPOSE: Output a rec'd buffer to a file
  125 +
  126 +PARAMETERS:
  127 + hFile - handle of file save data into
  128 + lpBuf - address of data buffer
  129 + dwBufLen - size of data buffer
  130 +
  131 +HISTORY: Date: Author: Comment:
  132 + 10/27/95 AllenD Wrote it
  133 +
  134 +-----------------------------------------------------------------------------*/
  135 +void OutputABufferToFile(HANDLE hFile, char * lpBuf, DWORD dwBufLen)
  136 +{
  137 + DWORD dwWritten;
  138 +
  139 + //
  140 + // place buffer into file, report any errors
  141 + //
  142 + if (!WriteFile(hFile, lpBuf, dwBufLen, &dwWritten, NULL))
  143 + ErrorReporter("WriteFile in file capture");
  144 +
  145 + if (dwBufLen != dwWritten)
  146 + ErrorReporter("WriteFile");
  147 +
  148 + //
  149 + // update transfer progress bar
  150 + //
  151 + PostMessage(GetDlgItem(ghWndStatusDlg, IDC_TRANSFERPROGRESS), PBM_STEPIT, 0, 0);
  152 +
  153 + return;
  154 +}
  155 +
  156 +/*-----------------------------------------------------------------------------
  157 +
  158 +FUNCTION: OutputABuffer(HWND, char *, DWORD)
  159 +
  160 +PURPOSE: Send a rec'd buffer to the approprate location
  161 +
  162 +PARAMETERS:
  163 + hTTY - handle to the TTY child window
  164 + lpBuf - address of data buffer
  165 + dwBufLen - size of data buffer
  166 +
  167 +COMMENTS: If buffer is 0 length, then do nothing.
  168 +
  169 +HISTORY: Date: Author: Comment:
  170 + 10/27/95 AllenD Wrote it
  171 +
  172 +-----------------------------------------------------------------------------*/
  173 +void OutputABuffer(HWND hTTY, char * lpBuf, DWORD dwBufLen)
  174 +{
  175 + if (dwBufLen == 0) {
  176 + OutputDebugString("NULL Buffer in OutputABuffer\n\r");
  177 + return;
  178 + }
  179 +
  180 + switch(gdwReceiveState)
  181 + {
  182 + case RECEIVE_TTY:
  183 + OutputABufferToWindow(hTTY, lpBuf, dwBufLen);
  184 + break;
  185 +
  186 + case RECEIVE_CAPTURED:
  187 + OutputABufferToFile(ghFileCapture, lpBuf, dwBufLen);
  188 + break;
  189 +
  190 + default:
  191 + OutputDebugString("Unknown receive state!\n\r");
  192 + }
  193 +
  194 + return;
  195 +}
... ...
Please register or login to post a comment