Commit db93a804d21bc8aafb1da32e20b87e01eae0f7d8

Authored by xiemeng
1 parent 107a69d6

MYTTTY branch

Too many changes to show.

To preserve performance only 28 of 47 files are displayed.

1 -/*.ncb  
2 -/*.aps  
  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 +/*
  38 + Prototypes for functions called only within this file
  39 +*/
  40 +void StartThreads( void );
  41 +DWORD WaitForThreads( DWORD );
  42 +
  43 +/*
  44 + TimeoutsDefault
  45 + We need ReadIntervalTimeout here to cause the read operations
  46 + that we do to actually timeout and become overlapped.
  47 + Specifying 1 here causes ReadFile to return very quickly
  48 + so that our reader thread will continue execution.
  49 +*/
  50 +COMMTIMEOUTS gTimeoutsDefault = { 0x01, 0, 0, 0, 0 };
  51 +
  52 +
  53 +/*-----------------------------------------------------------------------------
  54 +
  55 +FUNCTION: GlobalInitialize
  56 +
  57 +PURPOSE: Intializes global variables before any windows are created
  58 +
  59 +COMMENTS: Partner to GlobalCleanup
  60 +
  61 +HISTORY: Date: Author: Comment:
  62 + 10/27/95 AllenD Wrote it
  63 +
  64 +-----------------------------------------------------------------------------*/
  65 +void GlobalInitialize()
  66 +{
  67 + int cyMenuHeight, cyCaptionHeight, cyFrameHeight;
  68 +
  69 + //
  70 + // critical sections in status reporting & node management
  71 + //
  72 + InitializeCriticalSection(&gStatusCritical);
  73 + InitializeCriticalSection(&gcsWriterHeap);
  74 + InitializeCriticalSection(&gcsDataHeap);
  75 +
  76 + //
  77 + // status message event
  78 + //
  79 + ghStatusMessageEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
  80 + if (ghStatusMessageEvent == NULL)
  81 + ErrorReporter("CreateEvent (Status message event)");
  82 +
  83 + //
  84 + // thread exit event
  85 + //
  86 + ghThreadExitEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
  87 + if (ghThreadExitEvent == NULL)
  88 + ErrorReporter("CreateEvent (Thread exit event)");
  89 +
  90 + //
  91 + // used in file transfer status bar
  92 + //
  93 + InitCommonControls();
  94 +
  95 + //
  96 + // font for status reporting control
  97 + //
  98 + ghFontStatus = CreateStatusEditFont();
  99 +
  100 + //
  101 + // the following are used for sizing the tty window and dialog windows
  102 + //
  103 + gwBaseY = HIWORD(GetDialogBaseUnits());
  104 + cyMenuHeight = GetSystemMetrics(SM_CYMENU);
  105 + cyCaptionHeight = GetSystemMetrics(SM_CYCAPTION);
  106 + cyFrameHeight = GetSystemMetrics(SM_CYFRAME);
  107 + gcyMinimumWindowHeight = cyMenuHeight + \
  108 + 4 * cyCaptionHeight + \
  109 + 2 * cyFrameHeight +
  110 + (SETTINGSFACTOR + STATUSFACTOR) * gwBaseY ;
  111 + return ;
  112 +}
  113 +
  114 +
  115 +/*-----------------------------------------------------------------------------
  116 +
  117 +FUNCTION: GlobalCleanup
  118 +
  119 +PURPOSE: Cleans up any global variables
  120 +
  121 +COMMENTS: Partner to GlobalInitialize
  122 +
  123 +HISTORY: Date: Author: Comment:
  124 + 10/27/95 AllenD Wrote it
  125 +
  126 +-----------------------------------------------------------------------------*/
  127 +void GlobalCleanup()
  128 +{
  129 + DeleteCriticalSection(&gStatusCritical);
  130 + DeleteCriticalSection(&gcsWriterHeap);
  131 + DeleteCriticalSection(&gcsDataHeap);
  132 + DeleteObject(ghFontStatus);
  133 + CloseHandle(ghStatusMessageEvent);
  134 + CloseHandle(ghThreadExitEvent);
  135 + HeapDestroy(ghStatusMessageHeap);
  136 + return;
  137 +}
  138 +
  139 +
  140 +/*-----------------------------------------------------------------------------
  141 +
  142 +FUNCTION: ClearTTYContents
  143 +
  144 +PURPOSE: Clears the tty buffer
  145 +
  146 +RETURN: always TRUE
  147 +
  148 +HISTORY: Date: Author: Comment:
  149 + 10/27/95 AllenD Wrote it
  150 +
  151 +-----------------------------------------------------------------------------*/
  152 +BOOL ClearTTYContents()
  153 +{
  154 + FillMemory(SCREEN(TTYInfo), MAXCOLS*MAXROWS, ' ');
  155 + return TRUE;
  156 +}
  157 +
  158 +
  159 +/*-----------------------------------------------------------------------------
  160 +
  161 +FUNCTION: InitNewFont(LOGFONT, COLORREF)
  162 +
  163 +PURPOSE: Prepares a font for use in the TTY screen
  164 +
  165 +PARAMETERS:
  166 + LogFont - New logical font for tty screen
  167 + rgbColor - New color for TTY painting
  168 +
  169 +COMMENTS: Called when a new connection is made, or the TTY font
  170 + is changed by the user.
  171 +
  172 +HISTORY: Date: Author: Comment:
  173 + 10/27/95 AllenD Wrote it
  174 +
  175 +-----------------------------------------------------------------------------*/
  176 +void InitNewFont(LOGFONT LogFont, COLORREF rgbColor)
  177 +{
  178 + TEXTMETRIC tm;
  179 + HDC hDC;
  180 +
  181 + //
  182 + // if old one exists, then I should delete it
  183 + //
  184 + if (HTTYFONT(TTYInfo))
  185 + DeleteObject(HTTYFONT(TTYInfo));
  186 +
  187 + LFTTYFONT(TTYInfo) = LogFont;
  188 + HTTYFONT(TTYInfo) = CreateFontIndirect(&(LFTTYFONT(TTYInfo)));
  189 + FGCOLOR(TTYInfo) = rgbColor;
  190 +
  191 + hDC = GetDC( ghwndMain ) ;
  192 + SelectObject( hDC, HTTYFONT( TTYInfo ) ) ;
  193 + GetTextMetrics( hDC, &tm ) ;
  194 + ReleaseDC( ghwndMain, hDC ) ;
  195 +
  196 + //
  197 + // character width and height
  198 + //
  199 + XCHAR( TTYInfo ) = tm.tmAveCharWidth ;
  200 + YCHAR( TTYInfo ) = tm.tmHeight + tm.tmExternalLeading ;
  201 +
  202 + XOFFSET( TTYInfo ) = 0 ;
  203 + YOFFSET( TTYInfo ) = YCHAR(TTYInfo) * ROW(TTYInfo);
  204 +}
  205 +
  206 +/*-----------------------------------------------------------------------------
  207 +
  208 +FUNCTION: InitTTYInfo
  209 +
  210 +PURPOSE: Initializes TTY structure
  211 +
  212 +COMMENTS: This structure is a collection of TTY attributes
  213 + used by all parts of this program
  214 +
  215 +HISTORY: Date: Author: Comment:
  216 + 10/27/95 AllenD Wrote it
  217 + 2/14/96 AllenD Removed npTTYInfo
  218 +
  219 +-----------------------------------------------------------------------------*/
  220 +BOOL InitTTYInfo()
  221 +{
  222 + //
  223 + // initialize generial TTY info
  224 + //
  225 + COMDEV( TTYInfo ) = NULL ;
  226 + CONNECTED( TTYInfo ) = FALSE ;
  227 + LOCALECHO( TTYInfo ) = FALSE ;
  228 + CURSORSTATE( TTYInfo ) = CS_HIDE ;
  229 + PORT( TTYInfo ) = 1 ;
  230 + BAUDRATE( TTYInfo ) = 921600 ;
  231 + BYTESIZE( TTYInfo ) = 8 ;
  232 + PARITY( TTYInfo ) = NOPARITY ;
  233 + STOPBITS( TTYInfo ) = ONESTOPBIT ;
  234 + AUTOWRAP( TTYInfo ) = TRUE;
  235 + NEWLINE( TTYInfo ) = FALSE;
  236 + XSIZE( TTYInfo ) = 0 ;
  237 + YSIZE( TTYInfo ) = 0 ;
  238 + XSCROLL( TTYInfo ) = 0 ;
  239 + YSCROLL( TTYInfo ) = 0 ;
  240 + COLUMN( TTYInfo ) = 0 ;
  241 + ROW( TTYInfo ) = MAXROWS - 1 ;
  242 + DISPLAYERRORS( TTYInfo ) = TRUE ;
  243 +
  244 + //
  245 + // timeouts
  246 + //
  247 + TIMEOUTSNEW( TTYInfo ) = gTimeoutsDefault;
  248 +
  249 + //
  250 + // read state and status events
  251 + //
  252 + gdwReceiveState = RECEIVE_TTY;
  253 + EVENTFLAGS( TTYInfo ) = EVENTFLAGS_DEFAULT;
  254 + FLAGCHAR( TTYInfo ) = FLAGCHAR_DEFAULT;
  255 +
  256 + //
  257 + // Flow Control Settings
  258 + //
  259 + DTRCONTROL( TTYInfo ) = DTR_CONTROL_ENABLE;
  260 + RTSCONTROL( TTYInfo ) = RTS_CONTROL_ENABLE;
  261 + XONCHAR( TTYInfo ) = ASCII_XON;
  262 + XOFFCHAR( TTYInfo ) = ASCII_XOFF;
  263 + XONLIMIT( TTYInfo ) = 0;
  264 + XOFFLIMIT( TTYInfo ) = 0;
  265 + CTSOUTFLOW( TTYInfo ) = FALSE;
  266 + DSROUTFLOW( TTYInfo ) = FALSE;
  267 + DSRINFLOW( TTYInfo ) = FALSE;
  268 + XONXOFFOUTFLOW(TTYInfo) = FALSE;
  269 + XONXOFFINFLOW(TTYInfo) = FALSE;
  270 + TXAFTERXOFFSENT(TTYInfo) = FALSE;
  271 +
  272 + NOREADING(TTYInfo) = FALSE;
  273 + NOWRITING(TTYInfo) = FALSE;
  274 + NOEVENTS(TTYInfo) = FALSE;
  275 + NOSTATUS(TTYInfo) = FALSE;
  276 + SHOWTIMEOUTS(TTYInfo) = FALSE;
  277 +
  278 + //
  279 + // setup default font information
  280 + //
  281 + LFTTYFONT( TTYInfo ).lfHeight = 14 ;
  282 + LFTTYFONT( TTYInfo ).lfWidth = 0 ;
  283 + LFTTYFONT( TTYInfo ).lfEscapement = 0 ;
  284 + LFTTYFONT( TTYInfo ).lfOrientation = 0 ;
  285 + LFTTYFONT( TTYInfo ).lfWeight = 0 ;
  286 + LFTTYFONT( TTYInfo ).lfItalic = 0 ;
  287 + LFTTYFONT( TTYInfo ).lfUnderline = 0 ;
  288 + LFTTYFONT( TTYInfo ).lfStrikeOut = 0 ;
  289 + LFTTYFONT( TTYInfo ).lfCharSet = OEM_CHARSET ;
  290 + LFTTYFONT( TTYInfo ).lfOutPrecision = OUT_DEFAULT_PRECIS ;
  291 + LFTTYFONT( TTYInfo ).lfClipPrecision = CLIP_DEFAULT_PRECIS ;
  292 + LFTTYFONT( TTYInfo ).lfQuality = DEFAULT_QUALITY ;
  293 + LFTTYFONT( TTYInfo ).lfPitchAndFamily = FIXED_PITCH | FF_MODERN ;
  294 + strcpy( LFTTYFONT( TTYInfo ).lfFaceName, "ËÎÌå" ) ;
  295 + TTYInfo.DownloadReday = FALSE;
  296 +
  297 + InitNewFont( LFTTYFONT(TTYInfo), RGB(0,0,0));
  298 +
  299 + ClearTTYContents();
  300 +
  301 + return ( TRUE ) ;
  302 +}
  303 +
  304 +/*-----------------------------------------------------------------------------
  305 +
  306 +FUNCTION: DestroyTTYInfo
  307 +
  308 +PURPOSE: Frees objects associated with the TTYInfo structure
  309 +
  310 +HISTORY: Date: Author: Comment:
  311 + 10/27/95 AllenD Wrote it
  312 + 2/14/96 AllenD Removed npTTYInfo
  313 +
  314 +-----------------------------------------------------------------------------*/
  315 +void DestroyTTYInfo()
  316 +{
  317 + DeleteObject(HTTYFONT(TTYInfo));
  318 +}
  319 +
  320 +/*-----------------------------------------------------------------------------
  321 +
  322 +FUNCTION: StartThreads
  323 +
  324 +PURPOSE: Creates the Reader/Status and Writer threads
  325 +
  326 +HISTORY: Date: Author: Comment:
  327 + 10/27/95 AllenD Wrote it
  328 +
  329 +-----------------------------------------------------------------------------*/
  330 +void StartThreads(void)
  331 +{
  332 + DWORD dwReadStatId;
  333 + DWORD dwWriterId;
  334 +
  335 + READSTATTHREAD(TTYInfo) =
  336 + CreateThread( NULL,
  337 + 0,
  338 + (LPTHREAD_START_ROUTINE) ReaderAndStatusProc,
  339 + (LPVOID) ghWndTTY,
  340 + 0,
  341 + &dwReadStatId);
  342 +
  343 + if (READSTATTHREAD(TTYInfo) == NULL)
  344 + ErrorInComm("CreateThread(Reader/Status)");
  345 +
  346 + WRITERTHREAD(TTYInfo) =
  347 + CreateThread( NULL,
  348 + 0,
  349 + (LPTHREAD_START_ROUTINE) WriterProc,
  350 + (LPVOID) NULL,
  351 + 0,
  352 + &dwWriterId );
  353 +
  354 + if (WRITERTHREAD(TTYInfo) == NULL)
  355 + ErrorInComm("CreateThread (Writer)");
  356 +
  357 + return;
  358 +}
  359 +
  360 +/*-----------------------------------------------------------------------------
  361 +
  362 +FUNCTION: SetupCommPort( void )
  363 +
  364 +PURPOSE: Setup Communication Port with our settings
  365 +
  366 +RETURN:
  367 + Handle of comm port is successful
  368 + NULL is error occurs
  369 +
  370 +HISTORY: Date: Author: Comment:
  371 + 10/27/95 AllenD Wrote it
  372 +
  373 +-----------------------------------------------------------------------------*/
  374 +HANDLE SetupCommPort()
  375 +{
  376 + //
  377 + // get tty settings from settings dialog
  378 + //
  379 + UpdateTTYInfo();
  380 +
  381 + //
  382 + // open communication port handle
  383 + //
  384 + COMDEV( TTYInfo ) = CreateFile( gszPort[0],
  385 + GENERIC_READ | GENERIC_WRITE,
  386 + 0,
  387 + 0,
  388 + OPEN_EXISTING,
  389 + FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED,
  390 + 0);
  391 +
  392 + if (COMDEV(TTYInfo) == INVALID_HANDLE_VALUE) {
  393 + ErrorReporter("CreateFile");
  394 + return NULL;
  395 + }
  396 +
  397 + //
  398 + // Save original comm timeouts and set new ones
  399 + //
  400 + if (!GetCommTimeouts( COMDEV(TTYInfo), &(TIMEOUTSORIG(TTYInfo))))
  401 + ErrorReporter("GetCommTimeouts");
  402 +
  403 + //
  404 + // Set port state
  405 + //
  406 + UpdateConnection();
  407 +
  408 + //
  409 + // set comm buffer sizes
  410 + //
  411 + SetupComm(COMDEV(TTYInfo), MAX_READ_BUFFER, MAX_WRITE_BUFFER);
  412 +
  413 + //
  414 + // raise DTR
  415 + //
  416 + if (!EscapeCommFunction(COMDEV(TTYInfo), SETDTR))
  417 + ErrorReporter("EscapeCommFunction (SETDTR)");
  418 +
  419 + //
  420 + // start threads and set initial thread state to not done
  421 + //
  422 + StartThreads();
  423 +
  424 + //
  425 + // set overall connect flag
  426 + //
  427 + CONNECTED( TTYInfo ) = TRUE ;
  428 +
  429 + return COMDEV(TTYInfo);
  430 +}
  431 +
  432 +/*-----------------------------------------------------------------------------
  433 +
  434 +FUNCTION: WaitForThreads(DWORD)
  435 +
  436 +PURPOSE: Waits a specified time for the worker threads to exit
  437 +
  438 +PARAMETERS:
  439 + dwTimeout - milliseconds to wait until timeout
  440 +
  441 +RETURN:
  442 + WAIT_OBJECT_0 - successful wait, threads are not running
  443 + WAIT_TIMEOUT - at least one thread is still running
  444 + WAIT_FAILED - failure in WaitForMultipleObjects
  445 +
  446 +HISTORY: Date: Author: Comment:
  447 + 10/27/95 AllenD Wrote it
  448 +
  449 +----------------------------------------------------------------------------*/
  450 +DWORD WaitForThreads(DWORD dwTimeout)
  451 +{
  452 + HANDLE hThreads[2];
  453 + DWORD dwRes;
  454 +
  455 + hThreads[0] = READSTATTHREAD(TTYInfo);
  456 + hThreads[1] = WRITERTHREAD(TTYInfo);
  457 +
  458 + //
  459 + // set thread exit event here
  460 + //
  461 + SetEvent(ghThreadExitEvent);
  462 +
  463 + dwRes = WaitForMultipleObjects(2, hThreads, TRUE, dwTimeout);
  464 + switch(dwRes)
  465 + {
  466 + case WAIT_OBJECT_0:
  467 + case WAIT_OBJECT_0 + 1:
  468 + dwRes = WAIT_OBJECT_0;
  469 + break;
  470 +
  471 + case WAIT_TIMEOUT:
  472 +
  473 + if (WaitForSingleObject(READSTATTHREAD(TTYInfo), 0) == WAIT_TIMEOUT)
  474 + OutputDebugString("Reader/Status Thread didn't exit.\n\r");
  475 +
  476 + if (WaitForSingleObject(WRITERTHREAD(TTYInfo), 0) == WAIT_TIMEOUT)
  477 + OutputDebugString("Writer Thread didn't exit.\n\r");
  478 +
  479 + break;
  480 +
  481 + default:
  482 + ErrorReporter("WaitForMultipleObjects");
  483 + break;
  484 + }
  485 +
  486 + //
  487 + // reset thread exit event here
  488 + //
  489 + ResetEvent(ghThreadExitEvent);
  490 +
  491 + return dwRes;
  492 +}
  493 +
  494 +/*-----------------------------------------------------------------------------
  495 +
  496 +FUNCTION: BreakDownCommPort
  497 +
  498 +PURPOSE: Closes a connection to a comm port
  499 +
  500 +RETURN:
  501 + TRUE - successful breakdown of port
  502 + FALSE - port isn't connected
  503 +
  504 +COMMENTS: Waits for threads to exit,
  505 + clears DTR, restores comm port timeouts, purges any i/o
  506 + and closes all pertinent handles
  507 +
  508 +HISTORY: Date: Author: Comment:
  509 + 10/27/95 AllenD Wrote it
  510 +
  511 +-----------------------------------------------------------------------------*/
  512 +BOOL BreakDownCommPort()
  513 +{
  514 + if (!CONNECTED(TTYInfo))
  515 + return FALSE;
  516 +
  517 + CONNECTED( TTYInfo ) = FALSE;
  518 +
  519 + //
  520 + // wait for the threads for a small period
  521 + //
  522 + if (WaitForThreads(20000) != WAIT_OBJECT_0)
  523 + /*
  524 + if threads haven't exited, then they will
  525 + interfere with a new connection. I must abort
  526 + the entire program.
  527 + */
  528 + ErrorHandler("Error closing port.");
  529 +
  530 + //
  531 + // lower DTR
  532 + //
  533 + if (!EscapeCommFunction(COMDEV(TTYInfo), CLRDTR))
  534 + ErrorReporter("EscapeCommFunction(CLRDTR)");
  535 +
  536 + //
  537 + // restore original comm timeouts
  538 + //
  539 + if (!SetCommTimeouts(COMDEV(TTYInfo), &(TIMEOUTSORIG(TTYInfo))))
  540 + ErrorReporter("SetCommTimeouts (Restoration to original)");
  541 +
  542 + //
  543 + // Purge reads/writes, input buffer and output buffer
  544 + //
  545 + if (!PurgeComm(COMDEV(TTYInfo), PURGE_FLAGS))
  546 + ErrorReporter("PurgeComm");
  547 +
  548 + CloseHandle(COMDEV(TTYInfo));
  549 + CloseHandle(READSTATTHREAD(TTYInfo));
  550 + CloseHandle(WRITERTHREAD(TTYInfo));
  551 +
  552 + return TRUE;
  553 +}
  554 +
  555 +/*-----------------------------------------------------------------------------
  556 +
  557 +FUNCTION: DisconnectOK
  558 +
  559 +PURPOSE: Asks user if it is OK to disconnect
  560 +
  561 +RETURN:
  562 + TRUE - OK to disconnect
  563 + FALSE - Disconnect not OK
  564 +
  565 +HISTORY: Date: Author: Comment:
  566 + 10/27/95 AllenD Wrote it
  567 +
  568 +-----------------------------------------------------------------------------*/
  569 +BOOL DisconnectOK()
  570 +{
  571 + if (!CONNECTED(TTYInfo))
  572 + return TRUE;
  573 +
  574 + return ((MessageBox(ghwndMain, "OK to Disconnect?", gszPort[0], MB_YESNO)) == IDYES);
  575 +}
  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 +# 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 +################################################################################
No preview for this file type
  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 +
  50 +/*-----------------------------------------------------------------------------
  51 +
  52 +FUNCTION: WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
  53 +
  54 +PURPOSE: Start application and process all window messages
  55 +
  56 +PARAMETERS:
  57 + hInstance - this apps hinstance
  58 + hPrevInstance - previous instance of this app - always NULL
  59 + lpCmdLine - command line parameters
  60 + nCmdShow - code for showing window
  61 +
  62 +RETURN:
  63 + 1 for success
  64 + 0 for failure to start app
  65 +
  66 +HISTORY: Date: Author: Comment:
  67 + 10/27/95 AllenD Wrote it
  68 +
  69 +/*-----------------------------------------------------------------------------*/
  70 +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
  71 +{
  72 + MSG msg;
  73 +
  74 + if (!VersionCheck()) {
  75 + MessageBox(NULL, "MTTTY can't run on this version of Windows.", NULL, MB_OK);
  76 + return 0;
  77 + }
  78 +
  79 + if (!InitializeApp(hInstance, nShowCmd)) {
  80 + MessageBox(NULL, "MTTTY couldn't start!", NULL, MB_OK);
  81 + return 0;
  82 + }
  83 +
  84 + while (GetMessage(&msg, NULL, 0, 0)) {
  85 + if (!TranslateAccelerator( ghwndMain, ghAccel, &msg )) {
  86 + TranslateMessage( &msg ) ;
  87 + DispatchMessage( &msg ) ;
  88 + }
  89 + }
  90 +
  91 + return 1;
  92 +}
  93 +
  94 +
  95 +/*-----------------------------------------------------------------------------
  96 +
  97 +FUNCTION: VersionCheck(void)
  98 +
  99 +PURPOSE: Verifies that the correct version of Windows is running
  100 +
  101 +RETURN:
  102 + TRUE - success version for running this app
  103 + FALSE - correct version not verified
  104 +
  105 +HISTORY: Date: Author: Comment:
  106 + 11/20/95 AllenD Wrote it
  107 +
  108 +-----------------------------------------------------------------------------*/
  109 +BOOL VersionCheck()
  110 +{
  111 + gOSV.dwOSVersionInfoSize = sizeof(gOSV);
  112 + if (!GetVersionEx(&gOSV))
  113 + return FALSE;
  114 +
  115 + if (gOSV.dwPlatformId == VER_PLATFORM_WIN32s)
  116 + return FALSE;
  117 +
  118 + return TRUE ;
  119 +}
  120 +
  121 +
  122 +/*-----------------------------------------------------------------------------
  123 +
  124 +FUNCTION: InitializeApp(HINSTANCE, int)
  125 +
  126 +PURPOSE: GlobalInitialize, Register window classes
  127 + and create main window
  128 +
  129 +PARAMETERS:
  130 + hInst - HINSTANCE of this app
  131 + nShowCmd - code for showing this window
  132 +
  133 +RETURN:
  134 + TRUE - successful inititialization of this app
  135 + FALSE - failure to init app
  136 +
  137 +HISTORY: Date: Author: Comment:
  138 + 10/27/95 AllenD Wrote it
  139 +
  140 +-----------------------------------------------------------------------------*/
  141 +BOOL InitializeApp(HINSTANCE hInst, int nShowCmd)
  142 +{
  143 + WNDCLASS wc = {0};
  144 +
  145 + GlobalInitialize(); // get all global variables initialized to defaults
  146 +
  147 + //
  148 + // setup program's main window class
  149 + //
  150 + wc.lpfnWndProc = (WNDPROC) MTTTYWndProc;
  151 + wc.hInstance = hInst;
  152 + wc.hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_APPICON));
  153 + wc.hCursor = LoadCursor(NULL, IDC_ARROW);
  154 + wc.lpszMenuName = MAKEINTRESOURCE(IDR_MTTTYMENU);
  155 + wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1) ;
  156 + wc.lpszClassName = "MTTTYClass";
  157 +
  158 + if (!RegisterClass(&wc)) {
  159 + GlobalCleanup();
  160 + return FALSE;
  161 + }
  162 +
  163 + //
  164 + // setup program's tty child window class
  165 + //
  166 + wc.lpfnWndProc = (WNDPROC) TTYChildProc;
  167 + wc.hInstance = hInst;
  168 + wc.hCursor = LoadCursor(NULL, IDC_IBEAM);
  169 + wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);
  170 + wc.lpszClassName = "MTTTYChildClass";
  171 + wc.lpszMenuName = NULL;
  172 + wc.hIcon = NULL;
  173 +
  174 + if (!RegisterClass(&wc)) {
  175 + GlobalCleanup();
  176 + return FALSE;
  177 + }
  178 +
  179 + //
  180 + // create main window
  181 + //
  182 + ghwndMain = CreateWindow("MTTTYClass", "Multi-threaded TTY",
  183 + WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
  184 + STARTXWINDOW, STARTYWINDOW,
  185 + MAXXWINDOW, MAXYWINDOW,
  186 + NULL, NULL, hInst, NULL);
  187 +
  188 + if (ghwndMain == NULL) {
  189 + GlobalCleanup();
  190 + return FALSE;
  191 + }
  192 +
  193 + ShowWindow( ghwndMain, nShowCmd ) ;
  194 + UpdateWindow( ghwndMain ) ;
  195 +
  196 + ghInst = hInst;
  197 + ghAccel = LoadAccelerators( hInst, MAKEINTRESOURCE( IDR_MTTTYACCELERATOR) ) ;
  198 +
  199 + return TRUE;
  200 +}
  201 +
  202 +
  203 +/*-----------------------------------------------------------------------------
  204 +
  205 +FUNCTION: MTTTYWndProc(HWND, UINT, WPARAM, LPARAM)
  206 +
  207 +PURPOSE: Window Procedure for main window
  208 +
  209 +PARAMETERS:
  210 + hwnd - window handle
  211 + message - window message
  212 + wParam - window message parameter (depends on message)
  213 + lParam - window message parameter (depends on message)
  214 +
  215 +RETURN:
  216 + If message is process, return value is 0
  217 + If message is not processed, then it is passed to DefWindowProc
  218 + and the return value from that function is returned
  219 +
  220 +HISTORY: Date: Author: Comment:
  221 + 10/27/95 AllenD Wrote it
  222 +
  223 +-----------------------------------------------------------------------------*/
  224 +int WINAPI MTTTYWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
  225 +{
  226 + switch (message)
  227 + {
  228 + case WM_CREATE:
  229 + //
  230 + // since main window is created, I can now open all other windows
  231 + //
  232 + InitTTYInfo();
  233 + OpenTTYChildWindow(hwnd);
  234 + OpenSettingsToolbar(hwnd);
  235 + OpenStatusToolbar(hwnd);
  236 + ChangeConnection(hwnd, CONNECTED(TTYInfo));
  237 + break;
  238 +
  239 + case WM_DESTROY:
  240 + //
  241 + // since main windows is being destroyed, so same to other windows
  242 + //
  243 + DestroyTTYInfo();
  244 + DestroyWindow(ghWndToolbarDlg);
  245 + DestroyWindow(ghWndStatusDlg);
  246 + DestroyWindow(ghWndTTY);
  247 +
  248 + GlobalCleanup();
  249 + PostQuitMessage(0);
  250 + break;
  251 +
  252 + case WM_GETMINMAXINFO:
  253 + {
  254 + //
  255 + // make sure that main window doesn't get smaller than
  256 + // the minimum child windows.
  257 + //
  258 + LPMINMAXINFO lpTemp;
  259 + POINT ptTemp;
  260 +
  261 + lpTemp = (LPMINMAXINFO) lParam;
  262 +
  263 + ptTemp.x = (long) lpTemp->ptMinTrackSize.x;
  264 + ptTemp.y = (long) gcyMinimumWindowHeight;
  265 +
  266 + lpTemp->ptMinTrackSize = ptTemp;
  267 + }
  268 +
  269 + break;
  270 +
  271 + case WM_SIZE:
  272 + {
  273 + //
  274 + // main window size has changed,
  275 + // so I need to change the positions of child windows
  276 + //
  277 + WORD wTop;
  278 + WORD wHeight;
  279 + WORD wWidth = LOWORD(lParam);
  280 +
  281 + //
  282 + // put Settings window at top
  283 + //
  284 + wHeight = SETTINGSFACTOR*gwBaseY;
  285 + wTop = 0;
  286 + MoveWindow(ghWndToolbarDlg, 0,wTop, wWidth, wHeight, TRUE);
  287 +
  288 + //
  289 + // put Status window at bottom
  290 + //
  291 + wHeight = STATUSFACTOR*gwBaseY;
  292 + wTop = HIWORD(lParam) - wHeight;
  293 + MoveWindow(ghWndStatusDlg, 0, wTop, wWidth, wHeight, TRUE);
  294 +
  295 + //
  296 + // put TTTY window right in the middle
  297 + // height = whole window - height of two previous windows
  298 + //
  299 + wHeight = HIWORD(lParam) - ((STATUSFACTOR + SETTINGSFACTOR)*gwBaseY);
  300 + wTop = SETTINGSFACTOR*gwBaseY;
  301 + MoveWindow(ghWndTTY, 0, wTop, wWidth, wHeight, TRUE);
  302 + }
  303 +
  304 + break;
  305 +
  306 + case WM_COMMAND:
  307 + CmdDispatch(LOWORD(wParam), hwnd, lParam);
  308 + break;
  309 +
  310 + case WM_CHAR:
  311 + SetFocus(ghWndTTY);
  312 + SendMessage(ghWndTTY, WM_CHAR, wParam, lParam);
  313 + break;
  314 +
  315 + case WM_CLOSE:
  316 + if (DisconnectOK()) {
  317 + if (CONNECTED(TTYInfo)) {
  318 + if (TRANSFERRING(TTYInfo))
  319 + TransferFileTextEnd();
  320 + BreakDownCommPort();
  321 + }
  322 + DestroyWindow(hwnd);
  323 + }
  324 + break;
  325 +
  326 + default:
  327 + return DefWindowProc(hwnd, message, wParam, lParam);
  328 + }
  329 +
  330 + return 0L;
  331 +}
  332 +
  333 +/*-----------------------------------------------------------------------------
  334 +
  335 +FUNCTION: CmdDispatch(int, HWND)
  336 +
  337 +PURPOSE: Responds to menu selections
  338 +
  339 +PARAMETERS:
  340 + iMenuChoice - ID of menu choice (from resource file)
  341 + hwnd - window handle of menu owner
  342 +
  343 +HISTORY: Date: Author: Comment:
  344 + 10/27/95 AllenD Wrote it
  345 +
  346 +-----------------------------------------------------------------------------*/
  347 +void CmdDispatch(int iMenuChoice, HWND hwnd, LPARAM lParam)
  348 +{
  349 + static char szFileName[MAX_PATH] = {0};
  350 +
  351 + switch (iMenuChoice)
  352 + {
  353 + case ID_HELP_ABOUTMTTTY:
  354 + CmdAbout(hwnd);
  355 + break;
  356 +
  357 + case ID_TRANSFER_SENDFILETEXT:
  358 + {
  359 + if (strlen(TTYInfo.szFileName) == 0)
  360 + {
  361 + char * szFilter = "Text Files\0*.*\0";
  362 + OPENFILENAME ofn = {0};
  363 +
  364 + ofn.lStructSize = sizeof(OPENFILENAME);
  365 + ofn.hwndOwner = hwnd;
  366 + ofn.lpstrFilter = szFilter;
  367 + ofn.lpstrFile = szFileName;
  368 + ofn.nMaxFile = MAX_PATH;
  369 + ofn.lpstrTitle = "Send File";
  370 + ofn.Flags = OFN_FILEMUSTEXIST;
  371 +
  372 + if (!GetOpenFileName(&ofn))
  373 + break;
  374 + strcpy(TTYInfo.szFileName,szFileName); }
  375 +
  376 +
  377 + if (TRUE)
  378 + TransferFileTextStart(TTYInfo.szFileName);
  379 + }
  380 + break;
  381 +
  382 + case ID_TRANSFER_RECEIVEFILETEXT:
  383 + {
  384 + char * szFilter = "Text Files\0*.TXT\0";
  385 + OPENFILENAME ofn = {0};
  386 +
  387 + ofn.lStructSize = sizeof(OPENFILENAME);
  388 + ofn.hwndOwner = hwnd;
  389 + ofn.lpstrFilter = szFilter;
  390 + ofn.lpstrFile = szFileName;
  391 + ofn.nMaxFile = MAX_PATH;
  392 + ofn.lpstrTitle = "Receive File";
  393 + ofn.Flags = OFN_OVERWRITEPROMPT;
  394 +
  395 + if (!GetSaveFileName(&ofn))
  396 + break;
  397 +
  398 + ReceiveFileText(szFileName);
  399 + }
  400 + break;
  401 +
  402 + case ID_TRANSFER_ABORTSENDING:
  403 + // was abort sent from the abort button?
  404 + if (LOWORD(lParam) == IDC_ABORTBTN) {
  405 + // am I in a transfer repeat?
  406 + if (REPEATING(TTYInfo))
  407 + TransferRepeatDestroy();
  408 + // am I in a normal recieve state, then stop sending
  409 + else if (gdwReceiveState == RECEIVE_TTY)
  410 + TransferFileTextEnd();
  411 + // if I am not in a normal receive state, then stop capturing
  412 + else
  413 + gfAbortTransfer = TRUE;
  414 + }
  415 + else
  416 + // transfer abort was sent by transfer thread
  417 + TransferFileTextEnd();
  418 + break;
  419 +
  420 + case ID_TRANSFER_SENDREPEATEDLY:
  421 + {
  422 + DWORD dwFreq;
  423 + char * szFilter = "Text Files\0*.TXT\0";
  424 + OPENFILENAME ofn = {0};
  425 +
  426 + ofn.lStructSize = sizeof(OPENFILENAME);
  427 + ofn.hwndOwner = hwnd;
  428 + ofn.lpstrFilter = szFilter;
  429 + ofn.lpstrFile = szFileName;
  430 + ofn.nMaxFile = MAX_PATH;
  431 + ofn.lpstrTitle = "Send File Repeatedly";
  432 + ofn.Flags = OFN_FILEMUSTEXIST;
  433 +
  434 + if (!GetOpenFileName(&ofn))
  435 + break;
  436 +
  437 + dwFreq = GetAFrequency();
  438 +
  439 + TransferRepeatCreate(szFileName, dwFreq);
  440 + }
  441 + break;
  442 +
  443 + case ID_TRANSFER_ABORTREPEATEDSENDING:
  444 + TransferRepeatDestroy();
  445 + break;
  446 +
  447 + case ID_TTY_CLEAR:
  448 + ClearTTYContents();
  449 + InvalidateRect(ghWndTTY, NULL, TRUE);
  450 + break;
  451 +
  452 + // The following correspond to menu choices and buttons in the settings dlog
  453 + case IDC_FONTBTN:
  454 + case IDC_COMMEVENTSBTN:
  455 + case IDC_FLOWCONTROLBTN:
  456 + case IDC_TIMEOUTSBTN:
  457 + SendMessage(ghWndToolbarDlg, WM_COMMAND, (WPARAM) iMenuChoice, (LPARAM) GetDlgItem(ghWndToolbarDlg, iMenuChoice));
  458 + break;
  459 +
  460 + case ID_FILE_CONNECT:
  461 + if (SetupCommPort() != NULL)
  462 + ChangeConnection(hwnd, CONNECTED(TTYInfo));
  463 + break;
  464 +
  465 + case ID_FILE_DISCONNECT:
  466 + if (BreakDownCommPort())
  467 + ChangeConnection(hwnd, CONNECTED(TTYInfo));
  468 + break;
  469 +
  470 + case ID_FILE_EXIT:
  471 + PostMessage(hwnd, WM_CLOSE, 0, 0);
  472 + break;
  473 + }
  474 + return;
  475 +}
  476 +
  477 +
  478 +/*-----------------------------------------------------------------------------
  479 +
  480 +FUNCTION: OpenTTYChildWindow(HWND)
  481 +
  482 +PURPOSE: Creates the TTY Child Window
  483 +
  484 +PARAMETERS:
  485 + hWnd - parent window handle of TTY child window
  486 +
  487 +COMMENTS: This window is actually the TTY Screen
  488 +
  489 +HISTORY: Date: Author: Comment:
  490 + 10/27/95 AllenD Wrote it
  491 +
  492 +/*-----------------------------------------------------------------------------*/
  493 +void OpenTTYChildWindow(HWND hWnd)
  494 +{
  495 + ghWndTTY = CreateWindow( "MTTTYChildClass", "TTY Window",
  496 + WS_CHILD | WS_VISIBLE | WS_VSCROLL,
  497 + 0,0,
  498 + 0,0,
  499 + hWnd, (HMENU)ID_TTYWINDOW, ghInst, NULL);
  500 + if (ghWndTTY == NULL)
  501 + ErrorReporter("Can't Create TTY Child Window");
  502 +
  503 + return;
  504 +}
  505 +
  506 +
  507 +//---------------------------------------------------------------------------
  508 +// BOOL NEAR ScrollTTYVert( HWND hWnd, WORD wScrollCmd, WORD wScrollPos )
  509 +//
  510 +// Description:
  511 +// Scrolls TTY window vertically.
  512 +//
  513 +// Parameters:
  514 +// HWND hWnd
  515 +// handle to TTY window
  516 +//
  517 +// WORD wScrollCmd
  518 +// type of scrolling we're doing
  519 +//
  520 +// WORD wScrollPos
  521 +// scroll position
  522 +//
  523 +// History: Date Author Comment
  524 +// 5/ 8/91 BryanW Wrote it.
  525 +// 10/27/95 AllenD Included it for MTTTY Sample.
  526 +//
  527 +//---------------------------------------------------------------------------
  528 +BOOL NEAR ScrollTTYVert( HWND hWnd, WORD wScrollCmd, WORD wScrollPos )
  529 +{
  530 + int nScrollAmt ;
  531 +
  532 + switch (wScrollCmd)
  533 + {
  534 + case SB_TOP:
  535 + nScrollAmt = -YOFFSET( TTYInfo ) ;
  536 + break ;
  537 +
  538 + case SB_BOTTOM:
  539 + nScrollAmt = YSCROLL( TTYInfo ) - YOFFSET( TTYInfo ) ;
  540 + break ;
  541 +
  542 + case SB_PAGEUP:
  543 + nScrollAmt = -YSIZE( TTYInfo ) ;
  544 + break ;
  545 +
  546 + case SB_PAGEDOWN:
  547 + nScrollAmt = YSIZE( TTYInfo ) ;
  548 + break ;
  549 +
  550 + case SB_LINEUP:
  551 + nScrollAmt = -YCHAR( TTYInfo ) ;
  552 + break ;
  553 +
  554 + case SB_LINEDOWN:
  555 + nScrollAmt = YCHAR( TTYInfo ) ;
  556 + break ;
  557 +
  558 + case SB_THUMBPOSITION:
  559 + nScrollAmt = wScrollPos - YOFFSET( TTYInfo ) ;
  560 + break ;
  561 +
  562 + default:
  563 + return ( FALSE ) ;
  564 + }
  565 +
  566 + if ((YOFFSET( TTYInfo ) + nScrollAmt) > YSCROLL( TTYInfo ))
  567 + nScrollAmt = YSCROLL( TTYInfo ) - YOFFSET( TTYInfo ) ;
  568 +
  569 + if ((YOFFSET( TTYInfo ) + nScrollAmt) < 0)
  570 + nScrollAmt = -YOFFSET( TTYInfo ) ;
  571 +
  572 + ScrollWindowEx( hWnd, 0, -nScrollAmt, NULL, NULL, NULL, NULL, SW_INVALIDATE | SW_ERASE) ;
  573 +
  574 + YOFFSET( TTYInfo ) = YOFFSET( TTYInfo ) + nScrollAmt ;
  575 +
  576 + SetScrollPos( hWnd, SB_VERT, YOFFSET( TTYInfo ), TRUE ) ;
  577 +
  578 + return ( TRUE ) ;
  579 +
  580 +} // end of ScrollTTYVert()
  581 +
  582 +//---------------------------------------------------------------------------
  583 +// BOOL NEAR ScrollTTYHorz( HWND hWnd, WORD wScrollCmd, WORD wScrollPos )
  584 +//
  585 +// Description:
  586 +// Scrolls TTY window horizontally.
  587 +//
  588 +// Parameters:
  589 +// HWND hWnd
  590 +// handle to TTY window
  591 +//
  592 +// WORD wScrollCmd
  593 +// type of scrolling we're doing
  594 +//
  595 +// WORD wScrollPos
  596 +// scroll position
  597 +//
  598 +// History: Date Author Comment
  599 +// 5/ 8/91 BryanW Wrote it.
  600 +// 10/27/95 AllenD Included it for MTTTY Sample.
  601 +//
  602 +//---------------------------------------------------------------------------
  603 +BOOL NEAR ScrollTTYHorz( HWND hWnd, WORD wScrollCmd, WORD wScrollPos )
  604 +{
  605 + int nScrollAmt ;
  606 +
  607 + switch (wScrollCmd)
  608 + {
  609 + case SB_TOP:
  610 + nScrollAmt = -XOFFSET( TTYInfo ) ;
  611 + break ;
  612 +
  613 + case SB_BOTTOM:
  614 + nScrollAmt = XSCROLL( TTYInfo ) - XOFFSET( TTYInfo ) ;
  615 + break ;
  616 +
  617 + case SB_PAGEUP:
  618 + nScrollAmt = -XSIZE( TTYInfo ) ;
  619 + break ;
  620 +
  621 + case SB_PAGEDOWN:
  622 + nScrollAmt = XSIZE( TTYInfo ) ;
  623 + break ;
  624 +
  625 + case SB_LINEUP:
  626 + nScrollAmt = -XCHAR( TTYInfo ) ;
  627 + break ;
  628 +
  629 + case SB_LINEDOWN:
  630 + nScrollAmt = XCHAR( TTYInfo ) ;
  631 + break ;
  632 +
  633 + case SB_THUMBPOSITION:
  634 + nScrollAmt = wScrollPos - XOFFSET( TTYInfo ) ;
  635 + break ;
  636 +
  637 + default:
  638 + return ( FALSE ) ;
  639 + }
  640 + if ((XOFFSET( TTYInfo ) + nScrollAmt) > XSCROLL( TTYInfo ))
  641 + nScrollAmt = XSCROLL( TTYInfo ) - XOFFSET( TTYInfo ) ;
  642 + if ((XOFFSET( TTYInfo ) + nScrollAmt) < 0)
  643 + nScrollAmt = -XOFFSET( TTYInfo ) ;
  644 + ScrollWindowEx( hWnd, -nScrollAmt, 0, NULL, NULL, NULL, NULL, SW_INVALIDATE | SW_ERASE) ;
  645 + XOFFSET( TTYInfo ) = XOFFSET( TTYInfo ) + nScrollAmt ;
  646 + SetScrollPos( hWnd, SB_HORZ, XOFFSET( TTYInfo ), TRUE ) ;
  647 +
  648 + return ( TRUE ) ;
  649 +
  650 +} // end of ScrollTTYHorz()
  651 +
  652 +//---------------------------------------------------------------------------
  653 +// BOOL NEAR PaintTTY( HWND hWnd )
  654 +//
  655 +// Description:
  656 +// Paints the rectangle determined by the paint struct of
  657 +// the DC.
  658 +//
  659 +// Parameters:
  660 +// HWND hWnd
  661 +// handle to TTY window (as always)
  662 +//
  663 +// History: Date Author Comment
  664 +// 5/ 9/91 BryanW Wrote it.
  665 +// 10/22/91 BryanW Problem with background color
  666 +// and "off by one" fixed.
  667 +//
  668 +// 2/25/92 BryanW Off-by-one not quite fixed...
  669 +// also resolved min/max problem
  670 +// for windows extended beyond
  671 +// the "TTY display".
  672 +//
  673 +// 10/27/95 AllenD Included it for MTTTY Sample.
  674 +//
  675 +//---------------------------------------------------------------------------
  676 +BOOL NEAR PaintTTY( HWND hWnd )
  677 +{
  678 + PAINTSTRUCT ps ;
  679 + HFONT hOldFont ;
  680 + RECT rect ;
  681 + HDC hDC ;
  682 + int nRow, nCol, nEndRow, nEndCol;
  683 + int nCount, nHorzPos, nVertPos ;
  684 +
  685 + hDC = BeginPaint( hWnd, &ps ) ;
  686 + hOldFont = SelectObject( hDC, HTTYFONT( TTYInfo ) ) ;
  687 + SetTextColor( hDC, FGCOLOR( TTYInfo ) ) ;
  688 + SetBkColor( hDC, GetSysColor( COLOR_WINDOW ) ) ;
  689 + rect = ps.rcPaint ;
  690 + nRow =
  691 + min( MAXROWS - 1,
  692 + max( 0, (rect.top + YOFFSET( TTYInfo )) / YCHAR( TTYInfo ) ) ) ;
  693 + nEndRow =
  694 + min( MAXROWS - 1,
  695 + ((rect.bottom + YOFFSET( TTYInfo ) - 1) / YCHAR( TTYInfo ) ) ) ;
  696 + nCol =
  697 + min( MAXCOLS - 1,
  698 + max( 0, (rect.left + XOFFSET( TTYInfo )) / XCHAR( TTYInfo ) ) ) ;
  699 + nEndCol =
  700 + min( MAXCOLS - 1,
  701 + ((rect.right + XOFFSET( TTYInfo ) - 1) / XCHAR( TTYInfo ) ) ) ;
  702 + nCount = nEndCol - nCol + 1 ;
  703 + for (; nRow <= nEndRow; nRow++)
  704 + {
  705 + nVertPos = (nRow * YCHAR( TTYInfo )) - YOFFSET( TTYInfo ) ;
  706 + nHorzPos = (nCol * XCHAR( TTYInfo )) - XOFFSET( TTYInfo ) ;
  707 + rect.top = nVertPos ;
  708 + rect.bottom = nVertPos + YCHAR( TTYInfo ) ;
  709 + rect.left = nHorzPos ;
  710 + rect.right = nHorzPos + XCHAR( TTYInfo ) * nCount ;
  711 + SetBkMode( hDC, OPAQUE ) ;
  712 + ExtTextOut( hDC, nHorzPos, nVertPos, ETO_OPAQUE | ETO_CLIPPED, &rect,
  713 + (LPSTR)( SCREEN( TTYInfo ) + nRow * MAXCOLS + nCol ),
  714 + nCount, NULL ) ;
  715 + }
  716 + SelectObject( hDC, hOldFont ) ;
  717 + EndPaint( hWnd, &ps ) ;
  718 + MoveTTYCursor( hWnd ) ;
  719 + return ( TRUE ) ;
  720 +
  721 +} // end of PaintTTY()
  722 +
  723 +//---------------------------------------------------------------------------
  724 +// BOOL NEAR MoveTTYCursor( HWND hWnd )
  725 +//
  726 +// Description:
  727 +// Moves caret to current position.
  728 +//
  729 +// Parameters:
  730 +// HWND hWnd
  731 +// handle to TTY window
  732 +//
  733 +// History: Date Author Comment
  734 +// 5/ 9/91 BryanW Wrote it.
  735 +// 10/27/95 AllenD Included it for MTTTY Sample.
  736 +//
  737 +//---------------------------------------------------------------------------
  738 +BOOL NEAR MoveTTYCursor( HWND hWnd )
  739 +{
  740 + if (CONNECTED( TTYInfo ) && (CURSORSTATE( TTYInfo ) & CS_SHOW))
  741 + SetCaretPos( (COLUMN( TTYInfo ) * XCHAR( TTYInfo )) -
  742 + XOFFSET( TTYInfo ),
  743 + (ROW( TTYInfo ) * YCHAR( TTYInfo )) -
  744 + YOFFSET( TTYInfo ) ) ;
  745 +
  746 + return ( TRUE ) ;
  747 +
  748 +} // end of MoveTTYCursor()
  749 +
  750 +//---------------------------------------------------------------------------
  751 +// BOOL NEAR SetTTYFocus( HWND hWnd )
  752 +//
  753 +// Description:
  754 +// Sets the focus to the TTY window also creates caret.
  755 +//
  756 +// Parameters:
  757 +// HWND hWnd
  758 +// handle to TTY window
  759 +//
  760 +// History: Date Author Comment
  761 +// 5/ 9/91 BryanW Wrote it.
  762 +// 10/27/95 AllenD Included it for MTTTY Sample.
  763 +//
  764 +//---------------------------------------------------------------------------
  765 +BOOL NEAR SetTTYFocus( HWND hWnd )
  766 +{
  767 + if (CONNECTED(TTYInfo) && (CURSORSTATE( TTYInfo ) != CS_SHOW) )
  768 + {
  769 + CreateCaret( hWnd, NULL, XCHAR( TTYInfo ), YCHAR( TTYInfo ) ) ;
  770 + ShowCaret( hWnd ) ;
  771 + CURSORSTATE( TTYInfo ) = CS_SHOW ;
  772 + }
  773 +
  774 + MoveTTYCursor( hWnd ) ;
  775 + return ( TRUE ) ;
  776 +
  777 +} // end of SetTTYFocus()
  778 +
  779 +//---------------------------------------------------------------------------
  780 +// BOOL NEAR KillTTYFocus( HWND hWnd )
  781 +//
  782 +// Description:
  783 +// Kills TTY focus and destroys the caret.
  784 +//
  785 +// Parameters:
  786 +// HWND hWnd
  787 +// handle to TTY window
  788 +//
  789 +// History: Date Author Comment
  790 +// 5/ 9/91 BryanW Wrote it.
  791 +// 10/27/95 AllenD Included it for MTTTY Sample.
  792 +//
  793 +//---------------------------------------------------------------------------
  794 +BOOL NEAR KillTTYFocus( HWND hWnd )
  795 +{
  796 + if (CURSORSTATE( TTYInfo ) != CS_HIDE)
  797 + {
  798 + HideCaret( hWnd ) ;
  799 + DestroyCaret() ;
  800 + CURSORSTATE( TTYInfo ) = CS_HIDE ;
  801 + }
  802 + return ( TRUE ) ;
  803 +
  804 +} // end of KillTTYFocus()
  805 +
  806 +
  807 +//---------------------------------------------------------------------------
  808 +// BOOL NEAR SizeTTY( HWND hWnd, WORD wVertSize, WORD wHorzSize )
  809 +//
  810 +// Description:
  811 +// Sizes TTY and sets up scrolling regions.
  812 +//
  813 +// Parameters:
  814 +// HWND hWnd
  815 +// handle to TTY window
  816 +//
  817 +// WORD wVertSize
  818 +// new vertical size
  819 +//
  820 +// WORD wHorzSize
  821 +// new horizontal size
  822 +//
  823 +// History: Date Author Comment
  824 +// 5/ 8/ 91 BryanW Wrote it
  825 +// 10/27/95 AllenD Included it for MTTTY Sample.
  826 +//
  827 +//---------------------------------------------------------------------------
  828 +BOOL NEAR SizeTTY( HWND hWnd, WORD wWidth, WORD wHeight )
  829 +{
  830 + int nScrollAmt ;
  831 +
  832 + //
  833 + // adjust vert settings
  834 + //
  835 + YSIZE( TTYInfo ) = (int) wHeight ;
  836 + YSCROLL( TTYInfo ) = max( 0, (MAXROWS * YCHAR( TTYInfo )) -
  837 + YSIZE( TTYInfo ) ) ;
  838 + nScrollAmt = min( YSCROLL( TTYInfo ), YOFFSET( TTYInfo ) ) -
  839 + YOFFSET( TTYInfo ) ;
  840 + ScrollWindow( hWnd, 0, -nScrollAmt, NULL, NULL ) ;
  841 +
  842 + YOFFSET( TTYInfo ) = YOFFSET( TTYInfo ) + nScrollAmt ;
  843 + SetScrollPos( hWnd, SB_VERT, YOFFSET( TTYInfo ), FALSE ) ;
  844 + SetScrollRange( hWnd, SB_VERT, 0, YSCROLL( TTYInfo ), TRUE ) ;
  845 +
  846 + //
  847 + // adjust horz settings
  848 + //
  849 + XSIZE( TTYInfo ) = (int) wHeight ;
  850 + XSCROLL( TTYInfo ) = max( 0, (MAXCOLS * XCHAR( TTYInfo )) -
  851 + XSIZE( TTYInfo ) ) ;
  852 + nScrollAmt = min( XSCROLL( TTYInfo ), XOFFSET( TTYInfo )) -
  853 + XOFFSET( TTYInfo ) ;
  854 + ScrollWindow( hWnd, nScrollAmt, 0, NULL, NULL );
  855 + XOFFSET( TTYInfo ) = XOFFSET( TTYInfo ) + nScrollAmt ;
  856 + SetScrollRange( hWnd, SB_HORZ, 0, XSCROLL( TTYInfo ), FALSE ) ;
  857 + SetScrollPos( hWnd, SB_HORZ, XOFFSET( TTYInfo ), TRUE ) ;
  858 +
  859 + InvalidateRect( hWnd, NULL, FALSE ) ; // redraw entire window
  860 +
  861 + return ( TRUE ) ;
  862 +
  863 +} // end of SizeTTY()
  864 +
  865 +/*-----------------------------------------------------------------------------
  866 +
  867 +FUNCTION: TTYChildProc(HWND, UINT, WPARAM, LPARAM)
  868 +
  869 +PURPOSE: Window Procedure to process message for the TTY Child Window
  870 +
  871 +PARAMETERS:
  872 + hwnd - window handle
  873 + message - window message
  874 + wParam - window message parameter (depends on message)
  875 + lParam - window message parameter (depends on message)
  876 +
  877 +HISTORY: Date: Author: Comment:
  878 + 10/27/95 AllenD Wrote it
  879 +
  880 +-----------------------------------------------------------------------------*/
  881 +int WINAPI TTYChildProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
  882 +{
  883 + switch(uMessage)
  884 + {
  885 + case WM_VSCROLL:
  886 + ScrollTTYVert( hWnd, LOWORD( wParam ), HIWORD( wParam ) ) ;
  887 + break ;
  888 +
  889 + case WM_HSCROLL:
  890 + ScrollTTYHorz( hWnd, LOWORD( wParam ), HIWORD( wParam ) ) ;
  891 + break ;
  892 +
  893 + case WM_SIZE:
  894 + SizeTTY(hWnd, LOWORD(lParam), HIWORD(lParam));
  895 + break;
  896 +
  897 + case WM_PAINT:
  898 + PaintTTY(hWnd);
  899 + break;
  900 +
  901 + case WM_CHAR:
  902 + {
  903 + //
  904 + // keyboard activity in TTY Window
  905 + //
  906 + if (CONNECTED(TTYInfo)) {
  907 +
  908 + if (!WriterAddNewNode(WRITE_CHAR, 0, (char) wParam, NULL, NULL, NULL))
  909 + return FALSE;
  910 +
  911 + if (LOCALECHO(TTYInfo))
  912 + OutputABufferToWindow(ghWndTTY, (CHAR *) &wParam, 1);
  913 + }
  914 + }
  915 + break;
  916 +
  917 + case WM_SETFOCUS:
  918 + SetTTYFocus( ghWndTTY ) ;
  919 + break ;
  920 +
  921 + case WM_KILLFOCUS:
  922 + KillTTYFocus( ghWndTTY ) ;
  923 + break ;
  924 +
  925 + case WM_MOUSEACTIVATE:
  926 + /*
  927 + If mouse is clicked in me (the tty child window)
  928 + then I need to get the focus.
  929 + */
  930 + SetFocus(hWnd);
  931 + return MA_ACTIVATE;
  932 + break;
  933 +
  934 + default:
  935 + return DefWindowProc(hWnd, uMessage, wParam, lParam);
  936 + }
  937 + return 0L;
  938 +}
1 -# Microsoft Developer Studio Project File - Name="BlueFlashTool" - Package Owner=<4> 1 +# Microsoft Developer Studio Project File - Name="MTTTY" - Package Owner=<4>
2 # Microsoft Developer Studio Generated Build File, Format Version 6.00 2 # Microsoft Developer Studio Generated Build File, Format Version 6.00
3 # ** DO NOT EDIT ** 3 # ** DO NOT EDIT **
4 4
5 # TARGTYPE "Win32 (x86) Application" 0x0101 5 # TARGTYPE "Win32 (x86) Application" 0x0101
6 6
7 -CFG=BlueFlashTool - Win32 Debug 7 +CFG=MTTTY - Win32 Debug
8 !MESSAGE This is not a valid makefile. To build this project using NMAKE, 8 !MESSAGE This is not a valid makefile. To build this project using NMAKE,
9 !MESSAGE use the Export Makefile command and run 9 !MESSAGE use the Export Makefile command and run
10 !MESSAGE 10 !MESSAGE
11 -!MESSAGE NMAKE /f "BlueFlashTool.mak". 11 +!MESSAGE NMAKE /f "MTTTY.MAK".
12 !MESSAGE 12 !MESSAGE
13 !MESSAGE You can specify a configuration when running NMAKE 13 !MESSAGE You can specify a configuration when running NMAKE
14 !MESSAGE by defining the macro CFG on the command line. For example: 14 !MESSAGE by defining the macro CFG on the command line. For example:
15 !MESSAGE 15 !MESSAGE
16 -!MESSAGE NMAKE /f "BlueFlashTool.mak" CFG="BlueFlashTool - Win32 Debug" 16 +!MESSAGE NMAKE /f "MTTTY.MAK" CFG="MTTTY - Win32 Debug"
17 !MESSAGE 17 !MESSAGE
18 !MESSAGE Possible choices for configuration are: 18 !MESSAGE Possible choices for configuration are:
19 !MESSAGE 19 !MESSAGE
20 -!MESSAGE "BlueFlashTool - Win32 Release" (based on "Win32 (x86) Application")  
21 -!MESSAGE "BlueFlashTool - Win32 Debug" (based on "Win32 (x86) Application") 20 +!MESSAGE "MTTTY - Win32 Release" (based on "Win32 (x86) Application")
  21 +!MESSAGE "MTTTY - Win32 Debug" (based on "Win32 (x86) Application")
22 !MESSAGE 22 !MESSAGE
23 23
24 # Begin Project 24 # Begin Project
@@ -29,135 +29,142 @@ CPP=cl.exe @@ -29,135 +29,142 @@ CPP=cl.exe
29 MTL=midl.exe 29 MTL=midl.exe
30 RSC=rc.exe 30 RSC=rc.exe
31 31
32 -!IF "$(CFG)" == "BlueFlashTool - Win32 Release" 32 +!IF "$(CFG)" == "MTTTY - Win32 Release"
33 33
34 -# PROP BASE Use_MFC 6 34 +# PROP BASE Use_MFC 0
35 # PROP BASE Use_Debug_Libraries 0 35 # PROP BASE Use_Debug_Libraries 0
36 -# PROP BASE Output_Dir "Release"  
37 -# PROP BASE Intermediate_Dir "Release"  
38 -# PROP BASE Target_Dir ""  
39 -# PROP Use_MFC 6 36 +# PROP BASE Output_Dir "WinRel"
  37 +# PROP BASE Intermediate_Dir "WinRel"
  38 +# PROP Use_MFC 0
40 # PROP Use_Debug_Libraries 0 39 # PROP Use_Debug_Libraries 0
41 -# PROP Output_Dir "Release"  
42 -# PROP Intermediate_Dir "Release"  
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  
46 -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 40 +# PROP Output_Dir "WinRel"
  41 +# PROP Intermediate_Dir "WinRel"
  42 +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR /YX /c
  43 +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
  44 +# SUBTRACT CPP /Fr
  45 +# ADD BASE MTL /nologo /D "NDEBUG" /win32
47 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 46 # 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" 47 +# ADD BASE RSC /l 0x409 /d "NDEBUG"
  48 +# ADD RSC /l 0x409 /d "NDEBUG"
50 BSC32=bscmake.exe 49 BSC32=bscmake.exe
51 # ADD BASE BSC32 /nologo 50 # ADD BASE BSC32 /nologo
52 # ADD BSC32 /nologo 51 # ADD BSC32 /nologo
53 LINK32=link.exe 52 LINK32=link.exe
54 -# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386  
55 -# ADD LINK32 /nologo /subsystem:windows /machine:I386 53 +# 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
  54 +# 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
56 55
57 -!ELSEIF "$(CFG)" == "BlueFlashTool - Win32 Debug" 56 +!ELSEIF "$(CFG)" == "MTTTY - Win32 Debug"
58 57
59 -# PROP BASE Use_MFC 6 58 +# PROP BASE Use_MFC 0
60 # PROP BASE Use_Debug_Libraries 1 59 # PROP BASE Use_Debug_Libraries 1
61 -# PROP BASE Output_Dir "Debug"  
62 -# PROP BASE Intermediate_Dir "Debug"  
63 -# PROP BASE Target_Dir ""  
64 -# PROP Use_MFC 6 60 +# PROP BASE Output_Dir "WinDebug"
  61 +# PROP BASE Intermediate_Dir "WinDebug"
  62 +# PROP Use_MFC 0
65 # PROP Use_Debug_Libraries 1 63 # PROP Use_Debug_Libraries 1
66 -# PROP Output_Dir "Debug"  
67 -# PROP Intermediate_Dir "Debug"  
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  
71 -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 64 +# PROP Output_Dir "WinDebug"
  65 +# PROP Intermediate_Dir "WinDebug"
  66 +# ADD BASE CPP /nologo /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /c
  67 +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /Fr /YX /FD /c
  68 +# ADD BASE MTL /nologo /D "_DEBUG" /win32
72 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 69 # 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" 70 +# ADD BASE RSC /l 0x409 /d "_DEBUG"
  71 +# ADD RSC /l 0x409 /d "_DEBUG"
75 BSC32=bscmake.exe 72 BSC32=bscmake.exe
76 # ADD BASE BSC32 /nologo 73 # ADD BASE BSC32 /nologo
77 # ADD BSC32 /nologo 74 # ADD BSC32 /nologo
78 LINK32=link.exe 75 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 76 +# 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
  77 +# 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
81 78
82 !ENDIF 79 !ENDIF
83 80
84 # Begin Target 81 # Begin Target
85 82
86 -# Name "BlueFlashTool - Win32 Release"  
87 -# Name "BlueFlashTool - Win32 Debug" 83 +# Name "MTTTY - Win32 Release"
  84 +# Name "MTTTY - Win32 Debug"
88 # Begin Group "Source Files" 85 # Begin Group "Source Files"
89 86
90 -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" 87 +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
91 # Begin Source File 88 # Begin Source File
92 89
93 -SOURCE=.\BlueFlashTool.cpp 90 +SOURCE=.\About.c
94 # End Source File 91 # End Source File
95 # Begin Source File 92 # Begin Source File
96 93
97 -SOURCE=.\BlueFlashTool.rc 94 +SOURCE=.\Error.c
98 # End Source File 95 # End Source File
99 # Begin Source File 96 # Begin Source File
100 97
101 -SOURCE=.\BlueFlashToolDlg.cpp 98 +SOURCE=.\Init.c
102 # End Source File 99 # End Source File
103 # Begin Source File 100 # Begin Source File
104 101
105 -SOURCE=.\mscomm.cpp 102 +SOURCE=.\MTTTY.c
106 # End Source File 103 # End Source File
107 # Begin Source File 104 # Begin Source File
108 105
109 -SOURCE=.\StdAfx.cpp  
110 -# ADD CPP /Yc"stdafx.h" 106 +SOURCE=.\MTTTY.RC
111 # End Source File 107 # End Source File
112 -# End Group  
113 -# Begin Group "Header Files" 108 +# Begin Source File
114 109
115 -# PROP Default_Filter "h;hpp;hxx;hm;inl" 110 +SOURCE=.\Reader.c
  111 +# End Source File
116 # Begin Source File 112 # Begin Source File
117 113
118 -SOURCE=.\BlueFlashTool.h 114 +SOURCE=.\ReadStat.c
119 # End Source File 115 # End Source File
120 # Begin Source File 116 # Begin Source File
121 117
122 -SOURCE=.\BlueFlashToolDlg.h 118 +SOURCE=.\Settings.c
123 # End Source File 119 # End Source File
124 # Begin Source File 120 # Begin Source File
125 121
126 -SOURCE=.\mscomm.h 122 +SOURCE=.\Status.c
127 # End Source File 123 # End Source File
128 # Begin Source File 124 # Begin Source File
129 125
130 -SOURCE=.\Resource.h 126 +SOURCE=.\Transfer.c
131 # End Source File 127 # End Source File
132 # Begin Source File 128 # Begin Source File
133 129
134 -SOURCE=.\StdAfx.h 130 +SOURCE=.\Writer.c
135 # End Source File 131 # End Source File
136 # End Group 132 # End Group
137 -# Begin Group "Resource Files" 133 +# Begin Group "Header Files"
138 134
139 -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" 135 +# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
140 # Begin Source File 136 # Begin Source File
141 137
142 -SOURCE=.\res\BlueFlashTool.ico 138 +SOURCE=.\MTTTY.h
143 # End Source File 139 # End Source File
144 # Begin Source File 140 # Begin Source File
145 141
146 -SOURCE=.\res\BlueFlashTool.rc2 142 +SOURCE=.\RESOURCE.H
  143 +# End Source File
  144 +# Begin Source File
  145 +
  146 +SOURCE=.\TTYInfo.h
147 # End Source File 147 # End Source File
148 # End Group 148 # End Group
  149 +# Begin Group "Resource Files"
  150 +
  151 +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
149 # Begin Source File 152 # Begin Source File
150 153
151 -SOURCE=.\ReadMe.txt 154 +SOURCE=.\MTTTY.ICO
152 # End Source File 155 # End Source File
  156 +# Begin Source File
  157 +
  158 +SOURCE=.\MTTTY2.ICO
  159 +# End Source File
  160 +# Begin Source File
  161 +
  162 +SOURCE=.\MTTTY3.ICO
  163 +# End Source File
  164 +# Begin Source File
  165 +
  166 +SOURCE=.\MTTTY4.ICO
  167 +# End Source File
  168 +# End Group
153 # End Target 169 # End Target
154 # End Project 170 # 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,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: "MTTTY"=".\MTTTY.DSP" - Package Owner=<4>
7 7
8 Package=<5> 8 Package=<5>
9 {{{ 9 {{{
@@ -23,7 +23,6 @@ Package=<5> @@ -23,7 +23,6 @@ Package=<5>
23 23
24 Package=<3> 24 Package=<3>
25 {{{ 25 {{{
26 - {648A5600-2C6E-101B-82B6-000000000014}  
27 }}} 26 }}}
28 27
29 ############################################################################### 28 ###############################################################################
  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[50][10];
  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 +################################################################################
No preview for this file type
  1 +<html>
  2 +<body>
  3 +<pre>
  4 +<h1>Build Log</h1>
  5 +<h3>
  6 +--------------------Configuration: MTTTY - Win32 Debug--------------------
  7 +</h3>
  8 +<h3>Command Lines</h3>
  9 +Creating command line "rc.exe /l 0x409 /fo"WinDebug/MTTTY.res" /d "_DEBUG" "H:\other_demo\mttty1022\MTTTY.RC""
  10 +Creating temporary file "D:\temp\RSP21A0.tmp" with contents
  11 +[
  12 +/nologo /MLd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /Fr"WinDebug/" /Fp"WinDebug/MTTTY.pch" /YX /Fo"WinDebug/" /Fd"WinDebug/" /FD /c
  13 +"H:\other_demo\mttty1022\About.c"
  14 +"H:\other_demo\mttty1022\Error.c"
  15 +"H:\other_demo\mttty1022\Init.c"
  16 +"H:\other_demo\mttty1022\MTTTY.c"
  17 +"H:\other_demo\mttty1022\Reader.c"
  18 +"H:\other_demo\mttty1022\ReadStat.c"
  19 +"H:\other_demo\mttty1022\Settings.c"
  20 +"H:\other_demo\mttty1022\Status.c"
  21 +"H:\other_demo\mttty1022\Transfer.c"
  22 +"H:\other_demo\mttty1022\Writer.c"
  23 +]
  24 +Creating command line "cl.exe @D:\temp\RSP21A0.tmp"
  25 +Creating temporary file "D:\temp\RSP21A1.tmp" with contents
  26 +[
  27 +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 /incremental:yes /pdb:"WinDebug/MTTTY.pdb" /debug /machine:I386 /out:"WinDebug/MTTTY.exe"
  28 +.\WinDebug\About.obj
  29 +.\WinDebug\Error.obj
  30 +.\WinDebug\Init.obj
  31 +.\WinDebug\MTTTY.obj
  32 +.\WinDebug\Reader.obj
  33 +.\WinDebug\ReadStat.obj
  34 +.\WinDebug\Settings.obj
  35 +.\WinDebug\Status.obj
  36 +.\WinDebug\Transfer.obj
  37 +.\WinDebug\Writer.obj
  38 +.\WinDebug\MTTTY.res
  39 +]
  40 +Creating command line "link.exe @D:\temp\RSP21A1.tmp"
  41 +<h3>Output Window</h3>
  42 +Compiling resources...
  43 +Compiling...
  44 +About.c
  45 +Error.c
  46 +Init.c
  47 +MTTTY.c
  48 +Reader.c
  49 +ReadStat.c
  50 +Settings.c
  51 +Status.c
  52 +Transfer.c
  53 +Writer.c
  54 +Linking...
  55 +Creating temporary file "D:\temp\RSP34B5.tmp" with contents
  56 +[
  57 +/nologo /o"WinDebug/MTTTY.bsc"
  58 +.\WinDebug\About.sbr
  59 +.\WinDebug\Error.sbr
  60 +.\WinDebug\Init.sbr
  61 +.\WinDebug\MTTTY.sbr
  62 +.\WinDebug\Reader.sbr
  63 +.\WinDebug\ReadStat.sbr
  64 +.\WinDebug\Settings.sbr
  65 +.\WinDebug\Status.sbr
  66 +.\WinDebug\Transfer.sbr
  67 +.\WinDebug\Writer.sbr]
  68 +Creating command line "bscmake.exe @D:\temp\RSP34B5.tmp"
  69 +Creating browse info file...
  70 +<h3>Output Window</h3>
  71 +
  72 +
  73 +
  74 +<h3>Results</h3>
  75 +MTTTY.exe - 0 error(s), 0 warning(s)
  76 +</pre>
  77 +</body>
  78 +</html>
  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_CHS)
  18 +#ifdef _WIN32
  19 +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
  20 +#pragma code_page(936)
  21 +#endif //_WIN32
  22 +
  23 +/////////////////////////////////////////////////////////////////////////////
  24 +//
  25 +// Accelerator
  26 +//
  27 +
  28 +IDR_MTTTYACCELERATOR ACCELERATORS
  29 +BEGIN
  30 + VK_F5, ID_TRANSFER_SENDFILETEXT, VIRTKEY, NOINVERT
  31 + VK_F5, ID_TRANSFER_ABORTREPEATEDSENDING, VIRTKEY, ALT, NOINVERT
  32 + VK_F5, ID_TRANSFER_ABORTSENDING, VIRTKEY, SHIFT, NOINVERT
  33 + "x", ID_FILE_EXIT, ASCII, ALT, NOINVERT
  34 +END
  35 +
  36 +
  37 +/////////////////////////////////////////////////////////////////////////////
  38 +//
  39 +// Dialog
  40 +//
  41 +
  42 +IDD_ABOUT DIALOG 0, 0, 149, 159
  43 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
  44 +CAPTION "About MTTTY"
  45 +FONT 8, "MS Sans Serif"
  46 +BEGIN
  47 + DEFPUSHBUTTON "Close",IDOK,49,137,50,14
  48 + ICON IDI_APPICON,IDC_PICTURE,9,12,18,20
  49 + LTEXT "Microsoft Corporation",IDC_STATIC,36,15,86,12
  50 + LTEXT "Multi-threaded TTY Sample",IDC_STATIC,36,31,91,12
  51 + LTEXT "Version 4.00",IDC_STATIC,36,47,51,12
  52 + LTEXT "Copyright (c) 1995",IDC_STATIC,36,63,72,12
  53 + EDITTEXT IDC_OSVERSIONINFO,36,81,104,46,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY
  54 +END
  55 +
  56 +IDD_TOOLBARSETTINGS DIALOGEX 0, 0, 414, 48
  57 +STYLE DS_ABSALIGN | DS_SETFONT | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_BORDER
  58 +FONT 12, "??", 400, 0, 0x0
  59 +BEGIN
  60 + COMBOBOX IDC_PORTCOMBO,2,13,48,51,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
  61 + COMBOBOX IDC_BAUDCOMBO,168,0,48,64,CBS_DROPDOWNLIST | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
  62 + COMBOBOX IDC_PARITYCOMBO,170,13,48,56,CBS_DROPDOWNLIST | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
  63 + COMBOBOX IDC_DATABITSCOMBO,217,0,48,48,CBS_DROPDOWNLIST | CBS_SORT | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
  64 + COMBOBOX IDC_STOPBITSCOMBO,219,12,48,39,CBS_DROPDOWNLIST | CBS_SORT | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
  65 + LTEXT "Port",IDC_STATIC,2,2,17,8
  66 + CONTROL "Local Echo",IDC_LOCALECHOCHK,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,268,0,49,10
  67 + CONTROL "Display Errors",IDC_DISPLAYERRORSCHK,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,268,7,57,10
  68 + PUSHBUTTON "Font...",IDC_FONTBTN,10,30,33,14
  69 + PUSHBUTTON "Comm Events...",IDC_COMMEVENTSBTN,47,30,61,14
  70 + CONTROL "CR => CR/LF",IDC_LFBTN,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,268,14,56,10
  71 + CONTROL "Autowrap",IDC_AUTOWRAPCHK,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,268,21,43,10
  72 + PUSHBUTTON "Flow Control...",IDC_FLOWCONTROLBTN,112,30,59,14
  73 + PUSHBUTTON "Timeouts...",IDC_TIMEOUTSBTN,175,30,49,14
  74 + CONTROL "No Reading",IDC_NOREADINGCHK,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,327,0,53,10
  75 + CONTROL "No Writing",IDC_NOWRITINGCHK,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,327,6,58,10
  76 + CONTROL "No Status",IDC_NOSTATUSCHK,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,327,21,54,10
  77 + CONTROL "No Events",IDC_NOEVENTSCHK,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,327,13,68,10
  78 + PUSHBUTTON "连接夹具",IDC_BUTTON_CONNECT_UART,52,11,50,14
  79 + PUSHBUTTON "软件路径",IDC_BUTTON2_SEC_BINFILE,109,11,50,14
  80 +END
  81 +
  82 +IDD_STATUSDIALOG DIALOGEX 0, 0, 460, 48
  83 +STYLE DS_ABSALIGN | DS_SETFONT | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_BORDER
  84 +FONT 8, "MS Sans Serif", 0, 0, 0x0
  85 +BEGIN
  86 + PUSHBUTTON "",IDC_ABORTBTN,7,31,60,12,NOT WS_VISIBLE
  87 + CONTROL "Generic1",IDC_TRANSFERPROGRESS,"msctls_progress32",NOT WS_VISIBLE | WS_BORDER,75,33,65,6
  88 + GROUPBOX "Modem Status",IDC_MODEMSTATUSGRP,2,0,153,25
  89 + CONTROL "CTS",IDC_STATCTS,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,5,10,26,10
  90 + CONTROL "DSR",IDC_STATDSR,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,35,10,29,10
  91 + CONTROL "RING",IDC_STATRING,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,68,10,30,10
  92 + CONTROL "RLSD (CD)",IDC_STATRLSD,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,103,10,48,10
  93 + GROUPBOX "Comm Status",IDC_STATIC,158,0,164,47,WS_DISABLED
  94 + CONTROL "CTS Hold",IDC_CTSHOLDCHK,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,162,10,50,10
  95 + CONTROL "DSR Hold",IDC_DSRHOLDCHK,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,162,22,50,10
  96 + CONTROL "RLSD Hold",IDC_RLSDHOLDCHK,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,162,34,50,10
  97 + CONTROL "XOFF Hold",IDC_XOFFHOLDCHK,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,214,10,48,10
  98 + CONTROL "XOFF Sent",IDC_XOFFSENTCHK,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,214,22,48,10
  99 + CONTROL "EOF Sent",IDC_EOFSENTCHK,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,214,34,47,10
  100 + CONTROL "TX Char",IDC_TXIMCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,265,10,42,10
  101 + LTEXT "TX Chars:",IDC_STATIC,265,23,34,8
  102 + EDITTEXT IDC_TXCHAREDIT,299,20,19,12,ES_AUTOHSCROLL | ES_READONLY
  103 + LTEXT "RX Chars:",IDC_STATIC,265,35,34,8
  104 + EDITTEXT IDC_RXCHAREDIT,299,33,19,12,ES_AUTOHSCROLL | ES_READONLY
  105 + EDITTEXT IDC_STATUSEDIT,324,3,96,43,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL
  106 +END
  107 +
  108 +IDD_COMMEVENTSDLG DIALOG 0, 0, 226, 113
  109 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
  110 +CAPTION "Select Comm Events"
  111 +FONT 8, "MS Sans Serif"
  112 +BEGIN
  113 + DEFPUSHBUTTON "OK",IDOK,164,8,50,14
  114 + PUSHBUTTON "Cancel",IDCANCEL,164,26,50,14
  115 + PUSHBUTTON "&Defaults",IDC_DEFAULTSBTN,164,44,50,14
  116 + CONTROL "Errors",IDC_EVERRBTN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,10,40,10
  117 + CONTROL "Break",IDC_EVBREAKBTN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,74,10,40,10
  118 + CONTROL "CTS Changes",IDC_EVCTSBTN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,22,60,10
  119 + CONTROL "Ring Indicator",IDC_EVRINGBTN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,74,22,65,10
  120 + CONTROL "DSR Changes",IDC_EVDSRBTN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,34,60,10
  121 + CONTROL "RLSD (CD) Changes",IDC_EVRLSDBTN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,74,34,80,10
  122 + CONTROL "Transmit Buffer Empty",IDC_EVTXEMPTYBTN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,46,89,10
  123 + CONTROL "Character Reception",IDC_EVRXCHARBTN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,58,85,10
  124 + CONTROL "Flag Character Reception",IDC_EVRXFLAGBTN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,70,99,10
  125 + EDITTEXT IDC_FLAGEDIT,19,95,25,12,ES_UPPERCASE | ES_AUTOHSCROLL
  126 + EDITTEXT IDC_FLAGCHAR,49,95,14,12,ES_AUTOHSCROLL | ES_READONLY
  127 + LTEXT "Flag Char Value:",IDC_STATIC,10,85,65,8
  128 + LTEXT "0x",IDC_STATIC,10,99,9,8
  129 +END
  130 +
  131 +IDD_FLOWCONTROLDLG DIALOG 0, 0, 210, 208
  132 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
  133 +CAPTION "Flow Control Settings"
  134 +FONT 8, "MS Sans Serif"
  135 +BEGIN
  136 + DEFPUSHBUTTON "OK",IDOK,153,8,50,14
  137 + PUSHBUTTON "Cancel",IDCANCEL,153,26,50,14
  138 + PUSHBUTTON "&Rts/Cts",IDC_RTSCTSBTN,153,44,50,14
  139 + PUSHBUTTON "&Xoff/Xon",IDC_XOFFXONBTN,153,80,50,14
  140 + PUSHBUTTON "&None",IDC_NONEBTN,153,98,50,14
  141 + CONTROL "CTS Output Control",IDC_CTSOUTCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,20,84,10
  142 + CONTROL "DSR Output Control",IDC_DSROUTCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,32,84,10
  143 + CONTROL "DSR Sensitivity (Input Control)",IDC_DSRINCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,44,113,10
  144 + LTEXT "DTR Control:",IDC_STATIC,16,60,45,9
  145 + LTEXT "RTS Control:",IDC_STATIC,76,60,45,9
  146 + COMBOBOX IDC_DTRCONTROLCOMBO,16,68,52,48,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
  147 + COMBOBOX IDC_RTSCONTROLCOMBO,76,68,52,49,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
  148 + CONTROL "XON/XOFF Output Control",IDC_XONXOFFOUTCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,111,102,10
  149 + CONTROL "XON/XOFF Input Control",IDC_XONXOFFINCHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,123,102,10
  150 + EDITTEXT IDC_XONLIMITEDIT,15,158,40,12,ES_AUTOHSCROLL
  151 + EDITTEXT IDC_XOFFLIMITEDIT,79,158,40,12,ES_AUTOHSCROLL
  152 + EDITTEXT IDC_XONCHAREDIT,27,182,24,12,ES_AUTOHSCROLL
  153 + EDITTEXT IDC_XOFFCHAREDIT,91,182,24,12,ES_AUTOHSCROLL
  154 + LTEXT "XON Limit:",IDC_STATIC,15,150,39,8
  155 + LTEXT "XOFF Limit:",IDC_STATIC,79,150,39,8
  156 + LTEXT "Ox",IDC_STATIC,15,185,9,8
  157 + LTEXT "Ox",IDC_STATIC,79,185,9,8
  158 + LTEXT "XON Char:",IDC_STATIC,15,174,39,8
  159 + LTEXT "XOFF Char:",IDC_STATIC,79,174,39,8
  160 + GROUPBOX "Hardware Control Settings",IDC_STATIC,8,8,128,80
  161 + GROUPBOX "Software Control Settings",IDC_STATIC,8,96,136,105
  162 + EDITTEXT IDC_XONCHARDISP,55,182,15,12,ES_AUTOHSCROLL | WS_DISABLED
  163 + EDITTEXT IDC_XOFFCHARDISP,119,182,15,12,ES_AUTOHSCROLL | WS_DISABLED
  164 + CONTROL "Continue sending after XOFF sent",IDC_TXAFTERXOFFSENTCHK,
  165 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,135,122,10
  166 + PUSHBUTTON "&Dtr/Dsr",IDC_DTRDSRBTN,153,62,50,14
  167 +END
  168 +
  169 +IDD_TIMEOUTSDLG DIALOG 0, 0, 231, 158
  170 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
  171 +CAPTION "Timeouts"
  172 +FONT 8, "MS Sans Serif"
  173 +BEGIN
  174 + DEFPUSHBUTTON "OK",IDOK,172,6,50,14
  175 + PUSHBUTTON "Cancel",IDCANCEL,172,24,50,14
  176 + PUSHBUTTON "&Defaults",IDC_DEFAULTSBTN,171,42,50,14
  177 + EDITTEXT IDC_READINTERVALEDIT,114,19,40,14,ES_AUTOHSCROLL
  178 + EDITTEXT IDC_READMULTIPLIEREDIT,114,37,40,14,ES_AUTOHSCROLL
  179 + EDITTEXT IDC_READCONSTANTEDIT,113,55,40,14,ES_AUTOHSCROLL
  180 + EDITTEXT IDC_WRITEMULTIPLIEREDIT,113,95,40,14,ES_AUTOHSCROLL
  181 + EDITTEXT IDC_WRITECONSTANTEDIT,113,113,40,14,ES_AUTOHSCROLL
  182 + LTEXT "Read Interval Timeout:",IDC_STATIC,14,22,76,8
  183 + LTEXT "Read Total Timeout Multipler:",IDC_STATIC,14,40,98,8
  184 + LTEXT "Read Total Timeout Constant:",IDC_STATIC,13,58,99,8
  185 + LTEXT "Write Total Timeout Multiplier:",IDC_STATIC,13,99,99,8
  186 + LTEXT "Write Total Timeout Constant:",IDC_STATIC,13,115,99,8
  187 + GROUPBOX "Read Timeouts",IDC_STATIC,7,7,155,69
  188 + GROUPBOX "Write Timeouts",IDC_STATIC,7,84,155,50
  189 + CONTROL "Display Timeout Status Messages",IDC_DISPLAYTIMEOUTS,
  190 + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,20,140,122,10
  191 +END
  192 +
  193 +IDD_GETADWORD DIALOG 0, 0, 183, 68
  194 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
  195 +CAPTION "Please Enter A Number"
  196 +FONT 8, "MS Sans Serif"
  197 +BEGIN
  198 + EDITTEXT IDC_DWORDEDIT,25,45,52,14,ES_AUTOHSCROLL
  199 + DEFPUSHBUTTON "OK",IDOK,125,10,50,14
  200 + PUSHBUTTON "Cancel",IDCANCEL,125,30,50,14
  201 + LTEXT "Please enter a frequency in milliseconds for the repeated transfer:",IDC_DWORDSTATIC,10,10,94,25
  202 +END
  203 +
  204 +
  205 +/////////////////////////////////////////////////////////////////////////////
  206 +//
  207 +// Icon
  208 +//
  209 +
  210 +// Icon with lowest ID value placed first to ensure application icon
  211 +// remains consistent on all systems.
  212 +IDI_APPICON ICON "MTTTY.ICO"
  213 +IDI_APPICON2 ICON "MTTTY2.ICO"
  214 +IDI_APPICON3 ICON "MTTTY3.ICO"
  215 +IDI_APPICON4 ICON "MTTTY4.ICO"
  216 +
  217 +/////////////////////////////////////////////////////////////////////////////
  218 +//
  219 +// Menu
  220 +//
  221 +
  222 +IDR_MTTTYMENU MENU
  223 +BEGIN
  224 + POPUP "&File"
  225 + BEGIN
  226 + MENUITEM "Connect", ID_FILE_CONNECT, INACTIVE
  227 + MENUITEM "Disconnect", ID_FILE_DISCONNECT, INACTIVE
  228 + MENUITEM SEPARATOR
  229 + MENUITEM "E&xit\tAlt-X", ID_FILE_EXIT
  230 + END
  231 + POPUP "&TTY"
  232 + BEGIN
  233 + MENUITEM "&Clear", ID_TTY_CLEAR
  234 + MENUITEM "&Set Font...", IDC_FONTBTN
  235 + MENUITEM "Comm &Events...", IDC_COMMEVENTSBTN
  236 + MENUITEM "&Flow Control...", IDC_FLOWCONTROLBTN
  237 + MENUITEM "&Timeouts...", IDC_TIMEOUTSBTN
  238 + END
  239 + POPUP "T&ransfer"
  240 + BEGIN
  241 + MENUITEM "&Send Bin File .\tF5", ID_TRANSFER_SENDFILETEXT
  242 + MENUITEM "&Receive File (Text)...", ID_TRANSFER_RECEIVEFILETEXT
  243 + MENUITEM "&Abort Sending\tShift+F5", ID_TRANSFER_ABORTSENDING, GRAYED
  244 + MENUITEM SEPARATOR
  245 + MENUITEM "S&end Repeatedly...", ID_TRANSFER_SENDREPEATEDLY
  246 + MENUITEM "A&bort Repeated Sending\tAlt+F5", ID_TRANSFER_ABORTREPEATEDSENDING
  247 + END
  248 + POPUP "&Help"
  249 + BEGIN
  250 + MENUITEM "&About MTTTY", ID_HELP_ABOUTMTTTY
  251 + END
  252 +END
  253 +
  254 +
  255 +#ifdef APSTUDIO_INVOKED
  256 +/////////////////////////////////////////////////////////////////////////////
  257 +//
  258 +// TEXTINCLUDE
  259 +//
  260 +
  261 +1 TEXTINCLUDE
  262 +BEGIN
  263 + "resource.h\0"
  264 +END
  265 +
  266 +2 TEXTINCLUDE
  267 +BEGIN
  268 + "#include <Windows.h>\0"
  269 +END
  270 +
  271 +3 TEXTINCLUDE
  272 +BEGIN
  273 + "\r\n"
  274 + "\0"
  275 +END
  276 +
  277 +#endif // APSTUDIO_INVOKED
  278 +
  279 +
  280 +/////////////////////////////////////////////////////////////////////////////
  281 +//
  282 +// Version
  283 +//
  284 +
  285 +VS_VERSION_INFO VERSIONINFO
  286 + FILEVERSION 4,0,0,0
  287 + PRODUCTVERSION 4,0,0,0
  288 + FILEFLAGSMASK 0x3fL
  289 +#ifdef _DEBUG
  290 + FILEFLAGS 0x1L
  291 +#else
  292 + FILEFLAGS 0x0L
  293 +#endif
  294 + FILEOS 0x4L
  295 + FILETYPE 0x1L
  296 + FILESUBTYPE 0x0L
  297 +BEGIN
  298 + BLOCK "StringFileInfo"
  299 + BEGIN
  300 + BLOCK "040904b0"
  301 + BEGIN
  302 + VALUE "Comments", "Multi-threaded TTY Sample for the Win32 SDK.\r\nDemonstrates serial communiction using multiple threads."
  303 + VALUE "CompanyName", "Microsoft Corporation"
  304 + VALUE "FileDescription", "Multi-threaded TTY Sample for Win32"
  305 + VALUE "FileVersion", "4, 0, 0, 0"
  306 + VALUE "InternalName", "MTTTY"
  307 + VALUE "LegalCopyright", "Copyright ?1995"
  308 + VALUE "OriginalFilename", "MTTTY.exe"
  309 + VALUE "ProductName", "Microsoft MTTTY Sample"
  310 + VALUE "ProductVersion", "4, 0, 0, 0"
  311 + END
  312 + END
  313 + BLOCK "VarFileInfo"
  314 + BEGIN
  315 + VALUE "Translation", 0x409, 1200
  316 + END
  317 +END
  318 +
  319 +
  320 +/////////////////////////////////////////////////////////////////////////////
  321 +//
  322 +// DESIGNINFO
  323 +//
  324 +
  325 +#ifdef APSTUDIO_INVOKED
  326 +GUIDELINES DESIGNINFO
  327 +BEGIN
  328 + IDD_GETADWORD, DIALOG
  329 + BEGIN
  330 + LEFTMARGIN, 7
  331 + RIGHTMARGIN, 176
  332 + TOPMARGIN, 7
  333 + BOTTOMMARGIN, 61
  334 + END
  335 +END
  336 +#endif // APSTUDIO_INVOKED
  337 +
  338 +#endif // 中文(中华人民共和国) resources
  339 +/////////////////////////////////////////////////////////////////////////////
  340 +
  341 +
  342 +
  343 +#ifndef APSTUDIO_INVOKED
  344 +/////////////////////////////////////////////////////////////////////////////
  345 +//
  346 +// Generated from the TEXTINCLUDE 3 resource.
  347 +//
  348 +
  349 +
  350 +/////////////////////////////////////////////////////////////////////////////
  351 +#endif // not APSTUDIO_INVOKED
  352 +
No preview for this file type
  1 +
  2 +Microsoft Visual Studio Solution File, Format Version 10.00
  3 +# Visual Studio 2008
  4 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MTTTY", "MTTTY.vcproj", "{3ACAB324-DC55-40DE-B49A-EEBB712A0590}"
  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 + {3ACAB324-DC55-40DE-B49A-EEBB712A0590}.Debug|Win32.ActiveCfg = Debug|Win32
  13 + {3ACAB324-DC55-40DE-B49A-EEBB712A0590}.Debug|Win32.Build.0 = Debug|Win32
  14 + {3ACAB324-DC55-40DE-B49A-EEBB712A0590}.Release|Win32.ActiveCfg = Release|Win32
  15 + {3ACAB324-DC55-40DE-B49A-EEBB712A0590}.Release|Win32.Build.0 = Release|Win32
  16 + EndGlobalSection
  17 + GlobalSection(SolutionProperties) = preSolution
  18 + HideSolutionNode = FALSE
  19 + EndGlobalSection
  20 +EndGlobal
No preview for this file type
Please register or login to post a comment