|
|
1.1 root 1: PMCOMM is a small port of the TERMINAL application found in the
2: OS/2 1.02 SDK. It turns out that only about 5% of the code was
3: ported. Modem support was commented out. For a person who wants
4: to do more with this, all they have to do is bring in the MODEM.C
5: file found with the TERMINAL sources and update it to the latest
6: os/2 release.
7:
8: This program was made to reflect the following items in a PM
9: application.
10: o use of a thread to read a Comm Port.
11: o how to display and hide the scroll bars on the Window FRAME.
12: o how to set the menu attributes in one section of your code.
13: o use of changing the caption bar.
14: o use of accelerator keys.
15: o use of button controls in a dialog box.
16: o use of the WinQueryQueueStatus fucntion to check the queue
17: for interesting messages.
18: o use of the peek message function
19: o changing the cursor
20:
21: Due to time constraints here is a TO DO / WISH list.
22: A lot more needs to be added to make it more functional.
23: ------------------------
24: Make the write fucntion a separate thread.
25: Move the WM_BLAST routine to another thread or put at the bottom
26: of the urrent read thread.
27: Allow for making the code more modual so that everything does not
28: need to be resident when running.
29: Allow for clipboard - both ways.
30: Allow a dialog for the desired display buffer size.
31: It is now set by #define MAXWIDTH and MAXLINES.
32: Make the Settings dialog more robust.
33: Fix pause scrolling.
34: Make the paint routine smarter. I keep the line length so that
35: an offset can be provided. The array of pointers for the display,
36: pStartLine is not necessary due to the fact that each line is a
37: fixed length from the start.
38: Also see if you can scroll two or three lines at a time.
39: Any more than three might be too much of a flicker.
40: Scroll bar ranges are not correct.
41:
42: Time and consideration was provided for adding more functionality.
43: That is why you will see flags and variables saved that are not used.
44:
45: Here is the flow of PMCOMM.
46:
47: MAIN
48: --------------------------------
49: Creates a window.
50:
51: WM_CREATE message:
52: Gets font metrics
53: Gets handles to scroll bars.
54: Hides scroll bars.
55: Creates the ReadComm thread.
56:
57: Checks to see if an *.INI file was supplied.
58: Calls ReadINIFile.
59: Reads the supplied or default INI file.
60: Builds the caption bar with the current file name.
61: Goes into normal Windows message loop.
62:
63:
64: MENU ITEMS follow:
65: --------------------------------
66: SETTINGS:
67: Dialog comes up to prompt the user for comm settings.
68:
69: START:
70: InitBuffers();
71: Initializes all necessary flags to be used.
72: Initializes all buffers.
73: InitCommPort();
74: Opens comm port with settings provided.
75: (Should I flush the queses at this poing also?)
76: Clears ReadComm thread.
77: Sets the focus to the window.
78: Enables and disables correct menu items.
79:
80: CAPTURE:
81: Sets a flag to pass all characters to a file.
82: Displays a simple dialog asking for a file name
83: to append to.
84: Sets the "c" in the caption bar.
85:
86: PAUSE:
87: Enables and disables:
88: arrow keys
89: menu item
90: scroll bars are made in/visible.
91:
92: TEST:
93: Dumps current contents of display buffer to a file.
94: Displays the characters in a MessageBox as they come in.
95:
96: BREAK:
97: Sends a BREAK character to the host.
98:
99: ECHO:
100: Enables and disables echo to local terminal.
101:
102: STOP:
103: Flushes and then closes the comm port.
104: Enables and disables correct menu items.
105: If any changes were made to the Comm Settings
106: the user is asked if they wish to save
107: the changes.
108:
109:
110: READ THREAD
111: --------------------------------
112: Checks the buffer to determine the # of characters to read.
113: DosReads the comm port with the # of characters from previous step.
114: After read, sets Read Semiphore not to read.
115: Posts a message, WM_BLAST,
116:
117: OTHER EVENTS
118: --------------------------------
119: WM_CHAR:
120: These are passed to the WriteCommPort().
121:
122: WM_INITMENU:
123: This message is sent before a menu is displayed.
124: This provides an easy way to set the menu items
125: in one place depending on flags you set up.
126:
127: WM_SIZE:
128: Determines displayable area and calls WM_PAINT routine.
129:
130: WM_PAINT:
131: Determines displayable area and displays from a circular
132: display buffer.
133:
134: WM_BLAST: does the following:
135: Formats the characters into a display buffer.
136: Displays the characters to the screen.
137: Clears Read Semiphore.
138:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.