|
@@ -54,20 +54,19 @@ void FillComboBox( HWND, char ** szString, DWORD *, WORD, DWORD ); |
|
@@ -54,20 +54,19 @@ void FillComboBox( HWND, char ** szString, DWORD *, WORD, DWORD ); |
|
54
|
BOOL SettingsDlgInit( HWND );
|
54
|
BOOL SettingsDlgInit( HWND );
|
|
55
|
DWORD GetdwTTYItem( HWND, int, char **, DWORD *, int );
|
55
|
DWORD GetdwTTYItem( HWND, int, char **, DWORD *, int );
|
|
56
|
BYTE GetbTTYItem( HWND, int, char **, DWORD *, int);
|
56
|
BYTE GetbTTYItem( HWND, int, char **, DWORD *, int);
|
|
57
|
-BOOL CALLBACK CommEventsProc( HWND, UINT, WPARAM, LPARAM );
|
57
|
+//BOOL CALLBACK CommEventsProc( HWND, UINT, WPARAM, LPARAM );
|
|
58
|
BOOL CALLBACK ToolbarProc( HWND, UINT, WPARAM, LPARAM );
|
58
|
BOOL CALLBACK ToolbarProc( HWND, UINT, WPARAM, LPARAM );
|
|
59
|
void InitHexControl(HWND, WORD, WORD, char);
|
59
|
void InitHexControl(HWND, WORD, WORD, char);
|
|
60
|
char GetHexControl(HWND, WORD, WORD);
|
60
|
char GetHexControl(HWND, WORD, WORD);
|
|
61
|
-void SaveCommEventsDlg( HWND );
|
|
|
|
62
|
-void InitCommEventsDlg( HWND, DWORD );
|
|
|
|
63
|
-BOOL CALLBACK FlowControlProc( HWND, UINT, WPARAM, LPARAM );
|
|
|
|
64
|
-void InitFlowControlDlg( HWND );
|
|
|
|
65
|
-void SaveFlowControlDlg( HWND );
|
|
|
|
66
|
-void FlowDefault(HWND hdlg, WORD wId);
|
|
|
|
67
|
-BOOL CALLBACK TimeoutsProc( HWND, UINT, WPARAM, LPARAM );
|
|
|
|
68
|
-void InitTimeoutsDlg( HWND, COMMTIMEOUTS );
|
|
|
|
69
|
-void SaveTimeoutsDlg( HWND );
|
|
|
|
70
|
-BOOL CALLBACK GetADWORDProc( HWND, UINT, WPARAM, LPARAM );
|
61
|
+//void SaveCommEventsDlg( HWND );
|
|
|
|
62
|
+//void InitCommEventsDlg( HWND, DWORD );
|
|
|
|
63
|
+//BOOL CALLBACK FlowControlProc( HWND, UINT, WPARAM, LPARAM );
|
|
|
|
64
|
+//void InitFlowControlDlg( HWND );
|
|
|
|
65
|
+//void SaveFlowControlDlg( HWND );
|
|
|
|
66
|
+//void FlowDefault(HWND hdlg, WORD wId);
|
|
|
|
67
|
+//BOOL CALLBACK TimeoutsProc( HWND, UINT, WPARAM, LPARAM );
|
|
|
|
68
|
+//void InitTimeoutsDlg( HWND, COMMTIMEOUTS );
|
|
|
|
69
|
+//void SaveTimeoutsDlg( HWND );
|
|
71
|
|
70
|
|
|
72
|
/*
|
71
|
/*
|
|
73
|
GLOBALS for this file
|
72
|
GLOBALS for this file
|
|
@@ -179,18 +178,6 @@ void ChangeConnection( HWND hwnd, BOOL fConnected ) |
|
@@ -179,18 +178,6 @@ void ChangeConnection( HWND hwnd, BOOL fConnected ) |
|
179
|
EnableMenuItem( hMenu, ID_TRANSFER_ABORTREPEATEDSENDING,
|
178
|
EnableMenuItem( hMenu, ID_TRANSFER_ABORTREPEATEDSENDING,
|
|
180
|
MF_DISABLED | MF_GRAYED | MF_BYCOMMAND );
|
179
|
MF_DISABLED | MF_GRAYED | MF_BYCOMMAND );
|
|
181
|
|
180
|
|
|
182
|
-// EnableWindow( GetDlgItem(ghWndToolbarDlg, IDC_PORTCOMBO), FALSE);
|
|
|
|
183
|
-// EnableWindow( GetDlgItem(ghWndToolbarDlg, IDC_NOWRITINGCHK), FALSE);
|
|
|
|
184
|
-// EnableWindow( GetDlgItem(ghWndToolbarDlg, IDC_NOREADINGCHK), FALSE);
|
|
|
|
185
|
-// EnableWindow( GetDlgItem(ghWndToolbarDlg, IDC_NOEVENTSCHK), FALSE);
|
|
|
|
186
|
-// EnableWindow( GetDlgItem(ghWndToolbarDlg, IDC_NOSTATUSCHK), FALSE);
|
|
|
|
187
|
-//
|
|
|
|
188
|
-// for (i = IDC_STATCTS; i <= IDC_STATRLSD; i++)
|
|
|
|
189
|
-// EnableWindow( GetDlgItem(ghWndStatusDlg, i), TRUE );
|
|
|
|
190
|
-//
|
|
|
|
191
|
-// for (i = IDC_CTSHOLDCHK; i <= IDC_RXCHAREDIT; i++)
|
|
|
|
192
|
-// EnableWindow( GetDlgItem(ghWndStatusDlg, i), TRUE);
|
|
|
|
193
|
-
|
|
|
|
194
|
SetFocus(ghWndTTY);
|
181
|
SetFocus(ghWndTTY);
|
|
195
|
}
|
182
|
}
|
|
196
|
else {
|
183
|
else {
|
|
@@ -200,38 +187,12 @@ void ChangeConnection( HWND hwnd, BOOL fConnected ) |
|
@@ -200,38 +187,12 @@ void ChangeConnection( HWND hwnd, BOOL fConnected ) |
|
200
|
hMenu = GetMenu( hwnd ) ;
|
187
|
hMenu = GetMenu( hwnd ) ;
|
|
201
|
EnableMenuItem( hMenu, ID_FILE_CONNECT, MF_DISABLED | MF_GRAYED) ;
|
188
|
EnableMenuItem( hMenu, ID_FILE_CONNECT, MF_DISABLED | MF_GRAYED) ;
|
|
202
|
EnableMenuItem( hMenu, ID_FILE_DISCONNECT,MF_DISABLED | MF_GRAYED) ;
|
189
|
EnableMenuItem( hMenu, ID_FILE_DISCONNECT,MF_DISABLED | MF_GRAYED) ;
|
|
203
|
-
|
|
|
|
204
|
- EnableMenuItem( hMenu, ID_TRANSFER_SENDFILETEXT,
|
|
|
|
205
|
- MF_DISABLED | MF_GRAYED | MF_BYCOMMAND ) ;
|
|
|
|
206
|
- EnableMenuItem( hMenu, ID_TRANSFER_RECEIVEFILETEXT,
|
|
|
|
207
|
- MF_DISABLED | MF_GRAYED | MF_BYCOMMAND ) ;
|
|
|
|
208
|
- EnableMenuItem( hMenu, ID_TRANSFER_SENDREPEATEDLY,
|
|
|
|
209
|
- MF_DISABLED | MF_GRAYED | MF_BYCOMMAND ) ;
|
|
|
|
210
|
- EnableMenuItem( hMenu, ID_TRANSFER_ABORTSENDING,
|
|
|
|
211
|
- MF_DISABLED | MF_GRAYED | MF_BYCOMMAND ) ;
|
|
|
|
212
|
- EnableMenuItem( hMenu, ID_TRANSFER_ABORTREPEATEDSENDING,
|
|
|
|
213
|
- MF_DISABLED | MF_GRAYED | MF_BYCOMMAND );
|
|
|
|
214
|
-
|
190
|
+ EnableMenuItem( hMenu, ID_TRANSFER_SENDFILETEXT,MF_DISABLED | MF_GRAYED | MF_BYCOMMAND ) ;
|
|
|
|
191
|
+ EnableMenuItem( hMenu, ID_TRANSFER_RECEIVEFILETEXT,MF_DISABLED | MF_GRAYED | MF_BYCOMMAND ) ;
|
|
|
|
192
|
+ EnableMenuItem( hMenu, ID_TRANSFER_SENDREPEATEDLY,MF_DISABLED | MF_GRAYED | MF_BYCOMMAND ) ;
|
|
|
|
193
|
+ EnableMenuItem( hMenu, ID_TRANSFER_ABORTSENDING,MF_DISABLED | MF_GRAYED | MF_BYCOMMAND ) ;
|
|
|
|
194
|
+ EnableMenuItem( hMenu, ID_TRANSFER_ABORTREPEATEDSENDING,MF_DISABLED | MF_GRAYED | MF_BYCOMMAND );
|
|
215
|
EnableWindow( GetDlgItem(ghWndToolbarDlg, IDC_PORTCOMBO), TRUE);
|
195
|
EnableWindow( GetDlgItem(ghWndToolbarDlg, IDC_PORTCOMBO), TRUE);
|
|
216
|
- EnableWindow( GetDlgItem(ghWndToolbarDlg, IDC_NOWRITINGCHK), TRUE);
|
|
|
|
217
|
- EnableWindow( GetDlgItem(ghWndToolbarDlg, IDC_NOREADINGCHK), TRUE);
|
|
|
|
218
|
- EnableWindow( GetDlgItem(ghWndToolbarDlg, IDC_NOEVENTSCHK), TRUE);
|
|
|
|
219
|
- EnableWindow( GetDlgItem(ghWndToolbarDlg, IDC_NOSTATUSCHK), TRUE);
|
|
|
|
220
|
-
|
|
|
|
221
|
- for (i = IDC_STATCTS; i <= IDC_STATRLSD; i++) {
|
|
|
|
222
|
- CheckDlgButton(ghWndStatusDlg, i, 0);
|
|
|
|
223
|
- EnableWindow( GetDlgItem(ghWndStatusDlg, i), FALSE );
|
|
|
|
224
|
- }
|
|
|
|
225
|
-
|
|
|
|
226
|
- for (i = IDC_CTSHOLDCHK; i <= IDC_RXCHAREDIT; i++) {
|
|
|
|
227
|
- if (i != IDC_TXCHAREDIT && i != IDC_RXCHAREDIT)
|
|
|
|
228
|
- CheckDlgButton(ghWndStatusDlg, i, 0);
|
|
|
|
229
|
- else
|
|
|
|
230
|
- SetDlgItemInt(ghWndStatusDlg, i, 0, FALSE);
|
|
|
|
231
|
-
|
|
|
|
232
|
- EnableWindow( GetDlgItem(ghWndStatusDlg, i), FALSE);
|
|
|
|
233
|
- }
|
|
|
|
234
|
-
|
|
|
|
235
|
SetFocus(ghwndMain);
|
196
|
SetFocus(ghwndMain);
|
|
236
|
}
|
197
|
}
|
|
237
|
|
198
|
|
|
@@ -255,43 +216,9 @@ HISTORY: Date: Author: Comment: |
|
@@ -255,43 +216,9 @@ HISTORY: Date: Author: Comment: |
|
255
|
-----------------------------------------------------------------------------*/
|
216
|
-----------------------------------------------------------------------------*/
|
|
256
|
void UpdateTTYInfo()
|
217
|
void UpdateTTYInfo()
|
|
257
|
{
|
218
|
{
|
|
258
|
- //
|
|
|
|
259
|
- // update globals from dialog settings
|
|
|
|
260
|
- //
|
|
|
|
261
|
GetDlgItemText(ghWndToolbarDlg, IDC_PORTCOMBO, gszPort, sizeof(gszPort));
|
219
|
GetDlgItemText(ghWndToolbarDlg, IDC_PORTCOMBO, gszPort, sizeof(gszPort));
|
|
262
|
-
|
|
|
|
263
|
- TTYInfo.dwBaudRate = GetdwTTYItem( ghWndToolbarDlg,
|
|
|
|
264
|
- IDC_BAUDCOMBO,
|
|
|
|
265
|
- szBaud,
|
|
|
|
266
|
- BaudTable,
|
|
|
|
267
|
- sizeof(BaudTable)/sizeof(BaudTable[0]));
|
|
|
|
268
|
-
|
|
|
|
269
|
- TTYInfo.bParity = GetbTTYItem( ghWndToolbarDlg,
|
|
|
|
270
|
- IDC_PARITYCOMBO,
|
|
|
|
271
|
- szParity,
|
|
|
|
272
|
- ParityTable,
|
|
|
|
273
|
- sizeof(ParityTable)/sizeof(ParityTable[0]));
|
|
|
|
274
|
-
|
|
|
|
275
|
- TTYInfo.bStopBits = GetbTTYItem( ghWndToolbarDlg,
|
|
|
|
276
|
- IDC_STOPBITSCOMBO,
|
|
|
|
277
|
- szStopBits,
|
|
|
|
278
|
- StopBitsTable,
|
|
|
|
279
|
- sizeof(StopBitsTable)/sizeof(StopBitsTable[0]));
|
|
|
|
280
|
-
|
|
|
|
281
|
- TTYInfo.fLocalEcho = IsDlgButtonChecked(ghWndToolbarDlg, IDC_LOCALECHOCHK);
|
|
|
|
282
|
- TTYInfo.bByteSize = GetDlgItemInt(ghWndToolbarDlg, IDC_DATABITSCOMBO, NULL, FALSE);
|
|
|
|
283
|
- TTYInfo.fNewLine = IsDlgButtonChecked(ghWndToolbarDlg, IDC_LFBTN);
|
|
|
|
284
|
- TTYInfo.fAutowrap = IsDlgButtonChecked(ghWndToolbarDlg, IDC_AUTOWRAPCHK);
|
|
|
|
285
|
- TTYInfo.fDisplayErrors = IsDlgButtonChecked(ghWndToolbarDlg, IDC_DISPLAYERRORSCHK);
|
|
|
|
286
|
-
|
|
|
|
287
|
- TTYInfo.fNoReading = IsDlgButtonChecked(ghWndToolbarDlg, IDC_NOREADINGCHK);
|
|
|
|
288
|
- TTYInfo.fNoWriting = IsDlgButtonChecked(ghWndToolbarDlg, IDC_NOWRITINGCHK);
|
|
|
|
289
|
- TTYInfo.fNoEvents = IsDlgButtonChecked(ghWndToolbarDlg, IDC_NOEVENTSCHK);
|
|
|
|
290
|
- TTYInfo.fNoStatus = IsDlgButtonChecked(ghWndToolbarDlg, IDC_NOSTATUSCHK);
|
|
|
|
291
|
-
|
|
|
|
292
|
if (TTYInfo.fConnected) // if connected, then update port state
|
220
|
if (TTYInfo.fConnected) // if connected, then update port state
|
|
293
|
UpdateConnection();
|
221
|
UpdateConnection();
|
|
294
|
-
|
|
|
|
295
|
return;
|
222
|
return;
|
|
296
|
}
|
223
|
}
|
|
297
|
|
224
|
|
|
@@ -490,59 +417,23 @@ BOOL SettingsDlgInit( HWND hDlg ) |
|
@@ -490,59 +417,23 @@ BOOL SettingsDlgInit( HWND hDlg ) |
|
490
|
|
417
|
|
|
491
|
GetDlgItemText(hDlg, IDC_PORTCOMBO, gszPort, sizeof(gszPort));
|
418
|
GetDlgItemText(hDlg, IDC_PORTCOMBO, gszPort, sizeof(gszPort));
|
|
492
|
|
419
|
|
|
493
|
- //
|
|
|
|
494
|
- // fill baud combo box and make initial selection
|
|
|
|
495
|
- //
|
|
|
|
496
|
- FillComboBox( GetDlgItem( hDlg, IDC_BAUDCOMBO ),
|
|
|
|
497
|
- szBaud, BaudTable,
|
|
|
|
498
|
- sizeof( BaudTable ) / sizeof( BaudTable[ 0 ] ),
|
|
|
|
499
|
- TTYInfo.dwBaudRate ) ;
|
|
|
|
500
|
|
420
|
|
|
501
|
//
|
421
|
//
|
|
502
|
// fill data bits combo box and make initial selection
|
422
|
// fill data bits combo box and make initial selection
|
|
503
|
//
|
423
|
//
|
|
504
|
- for (wCount = 5; wCount < 9; wCount++) {
|
|
|
|
505
|
- wsprintf( szBuffer, "%d", wCount ) ;
|
|
|
|
506
|
- wPosition = LOWORD( SendDlgItemMessage( hDlg, IDC_DATABITSCOMBO,
|
|
|
|
507
|
- CB_ADDSTRING, 0,
|
|
|
|
508
|
- (LPARAM) (LPSTR) szBuffer ) ) ;
|
|
|
|
509
|
-
|
|
|
|
510
|
- //
|
424
|
+ for (wCount = 5; wCount < 9; wCount++)
|
|
|
|
425
|
+ {
|
|
|
|
426
|
+ //wsprintf( szBuffer, "%d", wCount ) ;
|
|
|
|
427
|
+ //wPosition = LOWORD( SendDlgItemMessage( hDlg, IDC_DATABITSCOMBO,CB_ADDSTRING, 0,(LPARAM) (LPSTR) szBuffer ) ) ;
|
|
511
|
// if wCount is current selection, tell the combo box
|
428
|
// if wCount is current selection, tell the combo box
|
|
512
|
- //
|
|
|
|
513
|
- if (wCount == TTYInfo.bByteSize)
|
|
|
|
514
|
- SendDlgItemMessage( hDlg, IDC_DATABITSCOMBO, CB_SETCURSEL,
|
|
|
|
515
|
- (WPARAM) wPosition, 0L ) ;
|
429
|
+ //if (wCount == TTYInfo.bByteSize)SendDlgItemMessage( hDlg, IDC_DATABITSCOMBO, CB_SETCURSEL,(WPARAM) wPosition, 0L ) ;
|
|
516
|
}
|
430
|
}
|
|
517
|
|
431
|
|
|
518
|
- //
|
|
|
|
519
|
// fill parity combo box and make initial selection
|
432
|
// fill parity combo box and make initial selection
|
|
520
|
- //
|
|
|
|
521
|
- FillComboBox( GetDlgItem( hDlg, IDC_PARITYCOMBO ),
|
|
|
|
522
|
- szParity, ParityTable,
|
|
|
|
523
|
- sizeof( ParityTable ) / sizeof( ParityTable[ 0 ] ),
|
|
|
|
524
|
- TTYInfo.bParity ) ;
|
|
|
|
525
|
-
|
|
|
|
526
|
- //
|
433
|
+ //FillComboBox( GetDlgItem( hDlg, IDC_PARITYCOMBO ),szParity, ParityTable,sizeof( ParityTable ) / sizeof( ParityTable[ 0 ] ),TTYInfo.bParity ) ;
|
|
527
|
// fill stop bits combo box and make initial selection
|
434
|
// fill stop bits combo box and make initial selection
|
|
528
|
- //
|
|
|
|
529
|
- FillComboBox( GetDlgItem( hDlg, IDC_STOPBITSCOMBO ),
|
|
|
|
530
|
- szStopBits, StopBitsTable,
|
|
|
|
531
|
- sizeof( StopBitsTable ) / sizeof ( StopBitsTable[ 0 ] ),
|
|
|
|
532
|
- TTYInfo.bStopBits ) ;
|
|
|
|
533
|
- //
|
|
|
|
534
|
- // set check marks based on TTY data
|
|
|
|
535
|
- //
|
|
|
|
536
|
- CheckDlgButton( hDlg, IDC_LOCALECHOCHK, TTYInfo.fLocalEcho ) ;
|
|
|
|
537
|
- CheckDlgButton( hDlg, IDC_DISPLAYERRORSCHK, TTYInfo.fDisplayErrors );
|
|
|
|
538
|
- CheckDlgButton( hDlg, IDC_LFBTN, TTYInfo.fNewLine );
|
|
|
|
539
|
- CheckDlgButton( hDlg, IDC_AUTOWRAPCHK, TTYInfo.fAutowrap );
|
|
|
|
540
|
-
|
|
|
|
541
|
- CheckDlgButton( hDlg, IDC_NOWRITINGCHK, TTYInfo.fNoWriting );
|
|
|
|
542
|
- CheckDlgButton( hDlg, IDC_NOREADINGCHK, TTYInfo.fNoReading );
|
|
|
|
543
|
- CheckDlgButton( hDlg, IDC_NOSTATUSCHK, TTYInfo.fNoStatus );
|
|
|
|
544
|
- CheckDlgButton( hDlg, IDC_NOEVENTSCHK, TTYInfo.fNoEvents );
|
|
|
|
545
|
-
|
435
|
+ //FillComboBox( GetDlgItem( hDlg, IDC_STOPBITSCOMBO ),szStopBits, StopBitsTable,sizeof( StopBitsTable ) / sizeof ( StopBitsTable[ 0 ] ),TTYInfo.bStopBits ) ;
|
|
|
|
436
|
+
|
|
546
|
return ( TRUE ) ;
|
437
|
return ( TRUE ) ;
|
|
547
|
|
438
|
|
|
548
|
} // end of SettingsDlgInit()
|
439
|
} // end of SettingsDlgInit()
|
|
@@ -768,18 +659,18 @@ BOOL CALLBACK ToolbarProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
|
@@ -768,18 +659,18 @@ BOOL CALLBACK ToolbarProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
|
768
|
break;
|
659
|
break;
|
|
769
|
|
660
|
|
|
770
|
case IDC_COMMEVENTSBTN: // comm events button pressed
|
661
|
case IDC_COMMEVENTSBTN: // comm events button pressed
|
|
771
|
- DialogBox(ghInst, MAKEINTRESOURCE(IDD_COMMEVENTSDLG), ghwndMain, CommEventsProc);
|
|
|
|
772
|
- fRet = FALSE;
|
662
|
+ //DialogBox(ghInst, MAKEINTRESOURCE(IDD_COMMEVENTSDLG), ghwndMain, CommEventsProc);
|
|
|
|
663
|
+ //fRet = FALSE;
|
|
773
|
break;
|
664
|
break;
|
|
774
|
|
665
|
|
|
775
|
case IDC_FLOWCONTROLBTN:
|
666
|
case IDC_FLOWCONTROLBTN:
|
|
776
|
- DialogBox(ghInst, MAKEINTRESOURCE(IDD_FLOWCONTROLDLG), ghwndMain, FlowControlProc);
|
|
|
|
777
|
- fRet = FALSE;
|
667
|
+ //DialogBox(ghInst, MAKEINTRESOURCE(IDD_FLOWCONTROLDLG), ghwndMain, FlowControlProc);
|
|
|
|
668
|
+ //fRet = FALSE;
|
|
778
|
break;
|
669
|
break;
|
|
779
|
|
670
|
|
|
780
|
case IDC_TIMEOUTSBTN:
|
671
|
case IDC_TIMEOUTSBTN:
|
|
781
|
- DialogBox(ghInst, MAKEINTRESOURCE(IDD_TIMEOUTSDLG), ghwndMain, TimeoutsProc);
|
|
|
|
782
|
- fRet = FALSE;
|
672
|
+ //DialogBox(ghInst, MAKEINTRESOURCE(IDD_TIMEOUTSDLG), ghwndMain, TimeoutsProc);
|
|
|
|
673
|
+ //fRet = FALSE;
|
|
783
|
break;
|
674
|
break;
|
|
784
|
|
675
|
|
|
785
|
default: // some other control has been modified
|
676
|
default: // some other control has been modified
|
|
@@ -884,589 +775,6 @@ char GetHexControl(HWND hdlg, WORD wIdNumberBox, WORD wIdCharBox) |
|
@@ -884,589 +775,6 @@ char GetHexControl(HWND hdlg, WORD wIdNumberBox, WORD wIdCharBox) |
|
884
|
|
775
|
|
|
885
|
return chFlag[0];
|
776
|
return chFlag[0];
|
|
886
|
}
|
777
|
}
|
|
887
|
-
|
|
|
|
888
|
-/*-----------------------------------------------------------------------------
|
|
|
|
889
|
-
|
|
|
|
890
|
-FUNCTION: InitCommEventsDlg(HWND, DWORD)
|
|
|
|
891
|
-
|
|
|
|
892
|
-PURPOSE: Initializes Comm Event Dialog Control
|
|
|
|
893
|
-
|
|
|
|
894
|
-PARAMETERS:
|
|
|
|
895
|
- hdlg - Dialog window handle
|
|
|
|
896
|
- dwEventFlags - event flag to set controls to
|
|
|
|
897
|
-
|
|
|
|
898
|
-COMMENTS: Since controls are checked based on the dwEventFlags parameter,
|
|
|
|
899
|
- it is easy to init control based on current settings,
|
|
|
|
900
|
- or default settings.
|
|
|
|
901
|
-
|
|
|
|
902
|
-HISTORY: Date: Author: Comment:
|
|
|
|
903
|
- 10/27/95 AllenD Wrote it
|
|
|
|
904
|
-
|
|
|
|
905
|
------------------------------------------------------------------------------*/
|
|
|
|
906
|
-void InitCommEventsDlg(HWND hdlg, DWORD dwEventFlags)
|
|
|
|
907
|
-{
|
|
|
|
908
|
- int i,j;
|
|
|
|
909
|
-
|
|
|
|
910
|
- for (i = IDC_EVBREAKBTN, j = 0; i <= IDC_EVTXEMPTYBTN; i++, j++)
|
|
|
|
911
|
- CheckDlgButton( hdlg, i, dwEventFlags & EventFlagsTable[j]) ;
|
|
|
|
912
|
-
|
|
|
|
913
|
- InitHexControl(hdlg, IDC_FLAGEDIT, IDC_FLAGCHAR, TTYInfo.chFlag);
|
|
|
|
914
|
-
|
|
|
|
915
|
- EnableWindow(GetDlgItem(hdlg, IDC_FLAGEDIT), dwEventFlags & EV_RXFLAG);
|
|
|
|
916
|
- EnableWindow(GetDlgItem(hdlg, IDC_FLAGCHAR), dwEventFlags & EV_RXFLAG);
|
|
|
|
917
|
-
|
|
|
|
918
|
- return;
|
|
|
|
919
|
-}
|
|
|
|
920
|
-
|
|
|
|
921
|
-/*-----------------------------------------------------------------------------
|
|
|
|
922
|
-
|
|
|
|
923
|
-FUNCTION: SaveCommEventsDlg(HWND)
|
|
|
|
924
|
-
|
|
|
|
925
|
-PURPOSE: Saves new Comm Events Flag
|
|
|
|
926
|
-
|
|
|
|
927
|
-PARAMETERS:
|
|
|
|
928
|
- hdlg - Dialog window handle
|
|
|
|
929
|
-
|
|
|
|
930
|
-COMMENTS: Builds a new flag based on current dialog control.
|
|
|
|
931
|
- If the new flag differs from old, then new is updated.
|
|
|
|
932
|
-
|
|
|
|
933
|
-HISTORY: Date: Author: Comment:
|
|
|
|
934
|
- 10/27/95 AllenD Wrote it
|
|
|
|
935
|
-
|
|
|
|
936
|
------------------------------------------------------------------------------*/
|
|
|
|
937
|
-void SaveCommEventsDlg(HWND hdlg)
|
|
|
|
938
|
-{
|
|
|
|
939
|
- int i,j;
|
|
|
|
940
|
- DWORD dwNew = {0};
|
|
|
|
941
|
- char chNewFlag = '\0';
|
|
|
|
942
|
- BOOL fChangingRXFLAG;
|
|
|
|
943
|
-
|
|
|
|
944
|
- //
|
|
|
|
945
|
- // create a flag out of dialog selections
|
|
|
|
946
|
- //
|
|
|
|
947
|
- for (i = IDC_EVBREAKBTN, j = 0; i <= IDC_EVTXEMPTYBTN; i++, j++) {
|
|
|
|
948
|
- if (IsDlgButtonChecked(hdlg, i))
|
|
|
|
949
|
- dwNew |= EventFlagsTable[j];
|
|
|
|
950
|
- }
|
|
|
|
951
|
-
|
|
|
|
952
|
- //
|
|
|
|
953
|
- // get current flag character from dialog
|
|
|
|
954
|
- //
|
|
|
|
955
|
- chNewFlag = GetHexControl(hdlg, IDC_FLAGEDIT, IDC_FLAGCHAR);
|
|
|
|
956
|
- fChangingRXFLAG = (TTYInfo.dwEventFlags & EV_RXFLAG) != (dwNew & EV_RXFLAG);
|
|
|
|
957
|
- if (chNewFlag != TTYInfo.chFlag || fChangingRXFLAG) {
|
|
|
|
958
|
- TTYInfo.chFlag = chNewFlag;
|
|
|
|
959
|
- UpdateTTYInfo();
|
|
|
|
960
|
- }
|
|
|
|
961
|
-
|
|
|
|
962
|
- //
|
|
|
|
963
|
- // if new flags have been selected, or
|
|
|
|
964
|
- //
|
|
|
|
965
|
- if (dwNew != TTYInfo.dwEventFlags)
|
|
|
|
966
|
- TTYInfo.dwEventFlags = dwNew;
|
|
|
|
967
|
-
|
|
|
|
968
|
- return;
|
|
|
|
969
|
-}
|
|
|
|
970
|
-
|
|
|
|
971
|
-/*-----------------------------------------------------------------------------
|
|
|
|
972
|
-
|
|
|
|
973
|
-FUNCTION: CommEventsProc(HWND, UINT, WPARAM, LPARAM)
|
|
|
|
974
|
-
|
|
|
|
975
|
-PURPOSE: Dialog Procedure for Comm Events Dialog
|
|
|
|
976
|
-
|
|
|
|
977
|
-PARAMETERS:
|
|
|
|
978
|
- hdlg - Dialog window handle
|
|
|
|
979
|
- uMessage - window message
|
|
|
|
980
|
- wparam - message parameter (depends on message)
|
|
|
|
981
|
- lparam - message parameter (depends on message)
|
|
|
|
982
|
-
|
|
|
|
983
|
-RETURN:
|
|
|
|
984
|
- TRUE if message is handled
|
|
|
|
985
|
- FALSE if message is not handled
|
|
|
|
986
|
- Exception is WM_INITDIALOG: returns FALSE since focus is not set
|
|
|
|
987
|
-
|
|
|
|
988
|
-HISTORY: Date: Author: Comment:
|
|
|
|
989
|
- 10/27/95 AllenD Wrote it
|
|
|
|
990
|
-
|
|
|
|
991
|
------------------------------------------------------------------------------*/
|
|
|
|
992
|
-BOOL CALLBACK CommEventsProc(HWND hdlg, UINT uMessage, WPARAM wparam, LPARAM lparam)
|
|
|
|
993
|
-{
|
|
|
|
994
|
- switch(uMessage)
|
|
|
|
995
|
- {
|
|
|
|
996
|
- case WM_INITDIALOG: // init controls
|
|
|
|
997
|
- InitCommEventsDlg(hdlg, TTYInfo.dwEventFlags);
|
|
|
|
998
|
- break;
|
|
|
|
999
|
-
|
|
|
|
1000
|
- case WM_COMMAND:
|
|
|
|
1001
|
- switch(LOWORD(wparam))
|
|
|
|
1002
|
- {
|
|
|
|
1003
|
- case IDOK:
|
|
|
|
1004
|
- SaveCommEventsDlg(hdlg);
|
|
|
|
1005
|
-
|
|
|
|
1006
|
- //
|
|
|
|
1007
|
- // FALL THROUGH
|
|
|
|
1008
|
- //
|
|
|
|
1009
|
-
|
|
|
|
1010
|
- case IDCANCEL:
|
|
|
|
1011
|
- EndDialog(hdlg, LOWORD(wparam));
|
|
|
|
1012
|
- return TRUE;
|
|
|
|
1013
|
-
|
|
|
|
1014
|
- case IDC_DEFAULTSBTN:
|
|
|
|
1015
|
- InitCommEventsDlg(hdlg, EVENTFLAGS_DEFAULT);
|
|
|
|
1016
|
- return TRUE;
|
|
|
|
1017
|
-
|
|
|
|
1018
|
- case IDC_EVRXFLAGBTN:
|
|
|
|
1019
|
- EnableWindow(GetDlgItem(hdlg, IDC_FLAGEDIT), IsDlgButtonChecked(hdlg, IDC_EVRXFLAGBTN));
|
|
|
|
1020
|
- EnableWindow(GetDlgItem(hdlg, IDC_FLAGCHAR), IsDlgButtonChecked(hdlg, IDC_EVRXFLAGBTN));
|
|
|
|
1021
|
- return TRUE;
|
|
|
|
1022
|
-
|
|
|
|
1023
|
- case IDC_FLAGEDIT:
|
|
|
|
1024
|
- GetHexControl(hdlg, IDC_FLAGEDIT, IDC_FLAGCHAR);
|
|
|
|
1025
|
- return TRUE;
|
|
|
|
1026
|
- }
|
|
|
|
1027
|
- break;
|
|
|
|
1028
|
- }
|
|
|
|
1029
|
-
|
|
|
|
1030
|
- return FALSE;
|
|
|
|
1031
|
-}
|
|
|
|
1032
|
-
|
|
|
|
1033
|
-/*-----------------------------------------------------------------------------
|
|
|
|
1034
|
-
|
|
|
|
1035
|
-FUNCTION: SaveFlowControlDlg(HWND)
|
|
|
|
1036
|
-
|
|
|
|
1037
|
-PURPOSE: Sets TTY flow control settings based on dlg controls
|
|
|
|
1038
|
-
|
|
|
|
1039
|
-PARAMETERS:
|
|
|
|
1040
|
- hdlg - Dialog window handle
|
|
|
|
1041
|
-
|
|
|
|
1042
|
-HISTORY: Date: Author: Comment:
|
|
|
|
1043
|
- 10/27/95 AllenD Wrote it
|
|
|
|
1044
|
-
|
|
|
|
1045
|
------------------------------------------------------------------------------*/
|
|
|
|
1046
|
-void SaveFlowControlDlg(HWND hdlg)
|
|
|
|
1047
|
-{
|
|
|
|
1048
|
- BOOL fNewCTSOut, fNewDSROut, fNewDSRIn, fNewXOut, fNewXIn, fNewTXafterXoffSent;
|
|
|
|
1049
|
- DWORD dwNewDTRControl, dwNewRTSControl;
|
|
|
|
1050
|
- WORD wNewXONLimit, wNewXOFFLimit;
|
|
|
|
1051
|
- char chNewXON, chNewXOFF;
|
|
|
|
1052
|
- BOOL fSuccess;
|
|
|
|
1053
|
-
|
|
|
|
1054
|
- BOOL fUpdateDCB = FALSE;
|
|
|
|
1055
|
-
|
|
|
|
1056
|
- //
|
|
|
|
1057
|
- // update DTR and RTS control if needed
|
|
|
|
1058
|
- //
|
|
|
|
1059
|
- dwNewDTRControl = GetdwTTYItem( hdlg, IDC_DTRCONTROLCOMBO,
|
|
|
|
1060
|
- szDTRControlStrings, DTRControlTable,
|
|
|
|
1061
|
- sizeof(DTRControlTable)/sizeof(DTRControlTable[0]));
|
|
|
|
1062
|
-
|
|
|
|
1063
|
- dwNewRTSControl = GetdwTTYItem( hdlg, IDC_RTSCONTROLCOMBO,
|
|
|
|
1064
|
- szRTSControlStrings, RTSControlTable,
|
|
|
|
1065
|
- sizeof(RTSControlTable)/sizeof(RTSControlTable[0]));
|
|
|
|
1066
|
- if (dwNewRTSControl != TTYInfo.fRtsControl ||
|
|
|
|
1067
|
- dwNewDTRControl != TTYInfo.fDtrControl) {
|
|
|
|
1068
|
- TTYInfo.fRtsControl = dwNewRTSControl;
|
|
|
|
1069
|
- TTYInfo.fDtrControl = dwNewDTRControl;
|
|
|
|
1070
|
- fUpdateDCB = TRUE;
|
|
|
|
1071
|
- }
|
|
|
|
1072
|
-
|
|
|
|
1073
|
- //
|
|
|
|
1074
|
- // update XON/XOFF limits if needed
|
|
|
|
1075
|
- //
|
|
|
|
1076
|
- wNewXONLimit = GetDlgItemInt(hdlg, IDC_XONLIMITEDIT, &fSuccess, FALSE);
|
|
|
|
1077
|
- wNewXOFFLimit = GetDlgItemInt(hdlg, IDC_XOFFLIMITEDIT, &fSuccess, FALSE);
|
|
|
|
1078
|
- if (wNewXOFFLimit != TTYInfo.wXOFFLimit ||
|
|
|
|
1079
|
- wNewXONLimit != TTYInfo.wXONLimit) {
|
|
|
|
1080
|
- TTYInfo.wXOFFLimit = wNewXOFFLimit;
|
|
|
|
1081
|
- TTYInfo.wXONLimit = wNewXONLimit;
|
|
|
|
1082
|
- fUpdateDCB = TRUE;
|
|
|
|
1083
|
- }
|
|
|
|
1084
|
-
|
|
|
|
1085
|
- //
|
|
|
|
1086
|
- // update XON/XOFF chars if needed
|
|
|
|
1087
|
- //
|
|
|
|
1088
|
- chNewXON = GetHexControl(hdlg, IDC_XONCHAREDIT, IDC_XONCHARDISP);
|
|
|
|
1089
|
- chNewXOFF = GetHexControl(hdlg, IDC_XOFFCHAREDIT, IDC_XOFFCHARDISP);
|
|
|
|
1090
|
- if (chNewXOFF != TTYInfo.chXOFF ||
|
|
|
|
1091
|
- chNewXON != TTYInfo.chXON) {
|
|
|
|
1092
|
- TTYInfo.chXOFF = chNewXOFF;
|
|
|
|
1093
|
- TTYInfo.chXON = chNewXON;
|
|
|
|
1094
|
- fUpdateDCB = TRUE;
|
|
|
|
1095
|
- }
|
|
|
|
1096
|
-
|
|
|
|
1097
|
- //
|
|
|
|
1098
|
- // update booleans from check boxes
|
|
|
|
1099
|
- //
|
|
|
|
1100
|
- fNewTXafterXoffSent = IsDlgButtonChecked(hdlg, IDC_TXAFTERXOFFSENTCHK);
|
|
|
|
1101
|
- fNewCTSOut = IsDlgButtonChecked(hdlg, IDC_CTSOUTCHK);
|
|
|
|
1102
|
- fNewDSROut = IsDlgButtonChecked(hdlg, IDC_DSROUTCHK);
|
|
|
|
1103
|
- fNewDSRIn = IsDlgButtonChecked(hdlg, IDC_DSRINCHK);
|
|
|
|
1104
|
- fNewXOut = IsDlgButtonChecked(hdlg, IDC_XONXOFFOUTCHK);
|
|
|
|
1105
|
- fNewXIn = IsDlgButtonChecked(hdlg, IDC_XONXOFFINCHK);
|
|
|
|
1106
|
-
|
|
|
|
1107
|
- if (fNewTXafterXoffSent != TTYInfo.fTXafterXoffSent ||
|
|
|
|
1108
|
- fNewCTSOut != TTYInfo.fCTSOutFlow ||
|
|
|
|
1109
|
- fNewDSROut != TTYInfo.fDSROutFlow ||
|
|
|
|
1110
|
- fNewDSRIn != TTYInfo.fDSRInFlow ||
|
|
|
|
1111
|
- fNewXOut != TTYInfo.fXonXoffOutFlow ||
|
|
|
|
1112
|
- fNewXIn != TTYInfo.fXonXoffInFlow ) {
|
|
|
|
1113
|
- TTYInfo.fCTSOutFlow = fNewCTSOut;
|
|
|
|
1114
|
- TTYInfo.fDSROutFlow = fNewDSROut;
|
|
|
|
1115
|
- TTYInfo.fDSRInFlow = fNewDSRIn;
|
|
|
|
1116
|
- TTYInfo.fXonXoffOutFlow = fNewXOut;
|
|
|
|
1117
|
- TTYInfo.fXonXoffInFlow = fNewXIn;
|
|
|
|
1118
|
- TTYInfo.fTXafterXoffSent = fNewTXafterXoffSent;
|
|
|
|
1119
|
- fUpdateDCB = TRUE;
|
|
|
|
1120
|
- }
|
|
|
|
1121
|
-
|
|
|
|
1122
|
- //
|
|
|
|
1123
|
- // update current settings if they have actually changed
|
|
|
|
1124
|
- //
|
|
|
|
1125
|
- if (fUpdateDCB)
|
|
|
|
1126
|
- UpdateTTYInfo();
|
|
|
|
1127
|
-
|
|
|
|
1128
|
- return;
|
|
|
|
1129
|
-}
|
|
|
|
1130
|
-
|
|
|
|
1131
|
-/*-----------------------------------------------------------------------------
|
|
|
|
1132
|
-
|
|
|
|
1133
|
-FUNCTION: InitFlowControlDlg(HWND)
|
|
|
|
1134
|
-
|
|
|
|
1135
|
-PURPOSE: Sets controls based on current tty flow control settings
|
|
|
|
1136
|
-
|
|
|
|
1137
|
-PARAMETERS:
|
|
|
|
1138
|
- hdlg - Dialog window handle
|
|
|
|
1139
|
-
|
|
|
|
1140
|
-HISTORY: Date: Author: Comment:
|
|
|
|
1141
|
- 10/27/95 AllenD Wrote it
|
|
|
|
1142
|
-
|
|
|
|
1143
|
------------------------------------------------------------------------------*/
|
|
|
|
1144
|
-void InitFlowControlDlg(HWND hdlg)
|
|
|
|
1145
|
-{
|
|
|
|
1146
|
- //
|
|
|
|
1147
|
- // fill and init DTR control combo
|
|
|
|
1148
|
- //
|
|
|
|
1149
|
- FillComboBox( GetDlgItem( hdlg, IDC_DTRCONTROLCOMBO ),
|
|
|
|
1150
|
- szDTRControlStrings, DTRControlTable,
|
|
|
|
1151
|
- sizeof( DTRControlTable) / sizeof( DTRControlTable[0] ),
|
|
|
|
1152
|
- TTYInfo.fDtrControl );
|
|
|
|
1153
|
-
|
|
|
|
1154
|
- //
|
|
|
|
1155
|
- // fill and init RTS control combo
|
|
|
|
1156
|
- //
|
|
|
|
1157
|
- FillComboBox( GetDlgItem( hdlg, IDC_RTSCONTROLCOMBO ),
|
|
|
|
1158
|
- szRTSControlStrings, RTSControlTable,
|
|
|
|
1159
|
- sizeof( RTSControlTable) / sizeof( RTSControlTable[0] ),
|
|
|
|
1160
|
- TTYInfo.fRtsControl );
|
|
|
|
1161
|
-
|
|
|
|
1162
|
- //
|
|
|
|
1163
|
- // XON/XOFF characters
|
|
|
|
1164
|
- //
|
|
|
|
1165
|
- InitHexControl(hdlg, IDC_XONCHAREDIT, IDC_XONCHARDISP, TTYInfo.chXON);
|
|
|
|
1166
|
- InitHexControl(hdlg, IDC_XOFFCHAREDIT, IDC_XOFFCHARDISP, TTYInfo.chXOFF);
|
|
|
|
1167
|
-
|
|
|
|
1168
|
- //
|
|
|
|
1169
|
- // XON/XOFF limits
|
|
|
|
1170
|
- //
|
|
|
|
1171
|
- SetDlgItemInt(hdlg, IDC_XONLIMITEDIT, TTYInfo.wXONLimit, FALSE);
|
|
|
|
1172
|
- SetDlgItemInt(hdlg, IDC_XOFFLIMITEDIT, TTYInfo.wXOFFLimit, FALSE);
|
|
|
|
1173
|
-
|
|
|
|
1174
|
- //
|
|
|
|
1175
|
- // check boxes
|
|
|
|
1176
|
- //
|
|
|
|
1177
|
- CheckDlgButton(hdlg, IDC_CTSOUTCHK, TTYInfo.fCTSOutFlow);
|
|
|
|
1178
|
- CheckDlgButton(hdlg, IDC_DSROUTCHK, TTYInfo.fDSROutFlow);
|
|
|
|
1179
|
- CheckDlgButton(hdlg, IDC_DSRINCHK, TTYInfo.fDSRInFlow);
|
|
|
|
1180
|
- CheckDlgButton(hdlg, IDC_XONXOFFOUTCHK, TTYInfo.fXonXoffOutFlow);
|
|
|
|
1181
|
- CheckDlgButton(hdlg, IDC_XONXOFFINCHK, TTYInfo.fXonXoffInFlow);
|
|
|
|
1182
|
- CheckDlgButton(hdlg, IDC_TXAFTERXOFFSENTCHK, TTYInfo.fTXafterXoffSent);
|
|
|
|
1183
|
-
|
|
|
|
1184
|
- return;
|
|
|
|
1185
|
-}
|
|
|
|
1186
|
-
|
|
|
|
1187
|
-/*-----------------------------------------------------------------------------
|
|
|
|
1188
|
-
|
|
|
|
1189
|
-FUNCTION: FlowDefault(HWND, WORD)
|
|
|
|
1190
|
-
|
|
|
|
1191
|
-PURPOSE: Sets controls based on hardware or software flow control
|
|
|
|
1192
|
-
|
|
|
|
1193
|
-PARAMETERS:
|
|
|
|
1194
|
- hdlg - Dialog window handle
|
|
|
|
1195
|
- wId - ID of button used to set the default:
|
|
|
|
1196
|
- IDC_DTRDSRBTN - DTR/DSR hardware flow-control
|
|
|
|
1197
|
- IDC_RTSCTSBTN - RTS/CTS hardware flow-control
|
|
|
|
1198
|
- IDC_XOFFXONBTNBTN - XOFF/XON software flow control
|
|
|
|
1199
|
- IDC_NONEBTN - no flow control
|
|
|
|
1200
|
-
|
|
|
|
1201
|
-HISTORY: Date: Author: Comment:
|
|
|
|
1202
|
- 10/27/95 AllenD Wrote it
|
|
|
|
1203
|
-
|
|
|
|
1204
|
------------------------------------------------------------------------------*/
|
|
|
|
1205
|
-void FlowDefault(HWND hdlg, WORD wId)
|
|
|
|
1206
|
-{
|
|
|
|
1207
|
- //
|
|
|
|
1208
|
- // set dtr control to handshake if using DTR/DSR flow-control
|
|
|
|
1209
|
- //
|
|
|
|
1210
|
- SetComboBox( GetDlgItem( hdlg, IDC_DTRCONTROLCOMBO ),
|
|
|
|
1211
|
- sizeof( DTRControlTable) / sizeof( DTRControlTable[0] ),
|
|
|
|
1212
|
- wId == IDC_DTRDSRBTN ? DTR_CONTROL_HANDSHAKE : DTR_CONTROL_ENABLE);
|
|
|
|
1213
|
-
|
|
|
|
1214
|
- //
|
|
|
|
1215
|
- // set rts control to handshake if using RTS/CTS flow-control
|
|
|
|
1216
|
- //
|
|
|
|
1217
|
- SetComboBox( GetDlgItem( hdlg, IDC_RTSCONTROLCOMBO ),
|
|
|
|
1218
|
- sizeof( RTSControlTable) / sizeof( RTSControlTable[0] ),
|
|
|
|
1219
|
- wId == IDC_RTSCTSBTN ? RTS_CONTROL_HANDSHAKE : RTS_CONTROL_ENABLE);
|
|
|
|
1220
|
-
|
|
|
|
1221
|
- //
|
|
|
|
1222
|
- // set check boxes according to wId
|
|
|
|
1223
|
- //
|
|
|
|
1224
|
- switch(wId)
|
|
|
|
1225
|
- {
|
|
|
|
1226
|
- case IDC_RTSCTSBTN:
|
|
|
|
1227
|
- case IDC_DTRDSRBTN:
|
|
|
|
1228
|
- CheckDlgButton(hdlg, IDC_CTSOUTCHK, wId == IDC_RTSCTSBTN);
|
|
|
|
1229
|
- CheckDlgButton(hdlg, IDC_DSROUTCHK, wId == IDC_DTRDSRBTN);
|
|
|
|
1230
|
- CheckDlgButton(hdlg, IDC_XONXOFFOUTCHK, FALSE);
|
|
|
|
1231
|
- CheckDlgButton(hdlg, IDC_XONXOFFINCHK, FALSE);
|
|
|
|
1232
|
- break;
|
|
|
|
1233
|
-
|
|
|
|
1234
|
- case IDC_XOFFXONBTN:
|
|
|
|
1235
|
- case IDC_NONEBTN:
|
|
|
|
1236
|
- CheckDlgButton(hdlg, IDC_CTSOUTCHK, FALSE);
|
|
|
|
1237
|
- CheckDlgButton(hdlg, IDC_DSROUTCHK, FALSE);
|
|
|
|
1238
|
- CheckDlgButton(hdlg, IDC_XONXOFFOUTCHK, wId == IDC_XOFFXONBTN);
|
|
|
|
1239
|
- CheckDlgButton(hdlg, IDC_XONXOFFINCHK, wId == IDC_XOFFXONBTN);
|
|
|
|
1240
|
- break;
|
|
|
|
1241
|
- }
|
|
|
|
1242
|
-
|
|
|
|
1243
|
- //
|
|
|
|
1244
|
- // settings that are disabled when any 'default' flow-control is used
|
|
|
|
1245
|
- //
|
|
|
|
1246
|
- CheckDlgButton(hdlg, IDC_DSRINCHK, FALSE);
|
|
|
|
1247
|
- CheckDlgButton(hdlg, IDC_TXAFTERXOFFSENTCHK, FALSE);
|
|
|
|
1248
|
-
|
|
|
|
1249
|
-
|
|
|
|
1250
|
- return;
|
|
|
|
1251
|
-}
|
|
|
|
1252
|
-
|
|
|
|
1253
|
-/*-----------------------------------------------------------------------------
|
|
|
|
1254
|
-
|
|
|
|
1255
|
-FUNCTION: FlowControlProc(HWND, UINT, WPARAM, LPARAM)
|
|
|
|
1256
|
-
|
|
|
|
1257
|
-PURPOSE: Dialog Procedure for Flow Control Settings Dialog
|
|
|
|
1258
|
-
|
|
|
|
1259
|
-PARAMETERS:
|
|
|
|
1260
|
- hdlg - Dialog window handle
|
|
|
|
1261
|
- uMessage - window message
|
|
|
|
1262
|
- wparam - message parameter (depends on message)
|
|
|
|
1263
|
- lparam - message parameter (depends on message)
|
|
|
|
1264
|
-
|
|
|
|
1265
|
-RETURN:
|
|
|
|
1266
|
- TRUE if message is handled
|
|
|
|
1267
|
- FALSE if message is not handled
|
|
|
|
1268
|
- Exception is WM_INITDIALOG: returns FALSE since focus is not set
|
|
|
|
1269
|
-
|
|
|
|
1270
|
-HISTORY: Date: Author: Comment:
|
|
|
|
1271
|
- 10/27/95 AllenD Wrote it
|
|
|
|
1272
|
-
|
|
|
|
1273
|
------------------------------------------------------------------------------*/
|
|
|
|
1274
|
-BOOL CALLBACK FlowControlProc(HWND hdlg, UINT uMessage, WPARAM wparam, LPARAM lparam)
|
|
|
|
1275
|
-{
|
|
|
|
1276
|
- switch(uMessage)
|
|
|
|
1277
|
- {
|
|
|
|
1278
|
- case WM_INITDIALOG: // init controls
|
|
|
|
1279
|
- InitFlowControlDlg(hdlg);
|
|
|
|
1280
|
- break;
|
|
|
|
1281
|
-
|
|
|
|
1282
|
- case WM_COMMAND:
|
|
|
|
1283
|
- switch(LOWORD(wparam))
|
|
|
|
1284
|
- {
|
|
|
|
1285
|
- case IDOK:
|
|
|
|
1286
|
- SaveFlowControlDlg(hdlg);
|
|
|
|
1287
|
- //
|
|
|
|
1288
|
- // FALL THROUGH
|
|
|
|
1289
|
- //
|
|
|
|
1290
|
-
|
|
|
|
1291
|
- case IDCANCEL:
|
|
|
|
1292
|
- EndDialog(hdlg, LOWORD(wparam));
|
|
|
|
1293
|
- return TRUE;
|
|
|
|
1294
|
-
|
|
|
|
1295
|
- case IDC_RTSCTSBTN:
|
|
|
|
1296
|
- case IDC_DTRDSRBTN:
|
|
|
|
1297
|
- case IDC_XOFFXONBTN:
|
|
|
|
1298
|
- case IDC_NONEBTN:
|
|
|
|
1299
|
- FlowDefault(hdlg, LOWORD(wparam));
|
|
|
|
1300
|
- return TRUE;
|
|
|
|
1301
|
-
|
|
|
|
1302
|
- case IDC_XONCHAREDIT:
|
|
|
|
1303
|
- GetHexControl(hdlg, IDC_XONCHAREDIT, IDC_XONCHARDISP);
|
|
|
|
1304
|
- return TRUE;
|
|
|
|
1305
|
-
|
|
|
|
1306
|
- case IDC_XOFFCHAREDIT:
|
|
|
|
1307
|
- GetHexControl(hdlg, IDC_XOFFCHAREDIT, IDC_XOFFCHARDISP);
|
|
|
|
1308
|
- return TRUE;
|
|
|
|
1309
|
- }
|
|
|
|
1310
|
- break;
|
|
|
|
1311
|
- }
|
|
|
|
1312
|
-
|
|
|
|
1313
|
- return FALSE;
|
|
|
|
1314
|
-}
|
|
|
|
1315
|
-
|
|
|
|
1316
|
-/*-----------------------------------------------------------------------------
|
|
|
|
1317
|
-
|
|
|
|
1318
|
-FUNCTION: InitTimeoutsDlg(HWND, COMMTIMEOUTS)
|
|
|
|
1319
|
-
|
|
|
|
1320
|
-PURPOSE: Initializes timeouts dialog controls based on parameter
|
|
|
|
1321
|
-
|
|
|
|
1322
|
-PARAMETERS:
|
|
|
|
1323
|
- hdlg - Dialog window handle
|
|
|
|
1324
|
- ct - COMMTIMEOUTS used to set the dialog controls
|
|
|
|
1325
|
-
|
|
|
|
1326
|
-HISTORY: Date: Author: Comment:
|
|
|
|
1327
|
- 10/27/95 AllenD Wrote it
|
|
|
|
1328
|
-
|
|
|
|
1329
|
------------------------------------------------------------------------------*/
|
|
|
|
1330
|
-void InitTimeoutsDlg(HWND hdlg, COMMTIMEOUTS ct)
|
|
|
|
1331
|
-{
|
|
|
|
1332
|
- SetDlgItemInt(hdlg, IDC_READINTERVALEDIT, ct.ReadIntervalTimeout, FALSE);
|
|
|
|
1333
|
- SetDlgItemInt(hdlg, IDC_READMULTIPLIEREDIT, ct.ReadTotalTimeoutMultiplier, FALSE);
|
|
|
|
1334
|
- SetDlgItemInt(hdlg, IDC_READCONSTANTEDIT, ct.ReadTotalTimeoutConstant, FALSE);
|
|
|
|
1335
|
- SetDlgItemInt(hdlg, IDC_WRITEMULTIPLIEREDIT, ct.WriteTotalTimeoutMultiplier, FALSE);
|
|
|
|
1336
|
- SetDlgItemInt(hdlg, IDC_WRITECONSTANTEDIT, ct.WriteTotalTimeoutConstant, FALSE);
|
|
|
|
1337
|
- CheckDlgButton(hdlg, IDC_DISPLAYTIMEOUTS, TTYInfo.fDisplayTimeouts);
|
|
|
|
1338
|
- return;
|
|
|
|
1339
|
-}
|
|
|
|
1340
|
|
778
|
|
|
1341
|
-/*-----------------------------------------------------------------------------
|
|
|
|
1342
|
-
|
|
|
|
1343
|
-FUNCTION: SaveTimeoutsDlg(HWND)
|
|
|
|
1344
|
|
779
|
|
|
1345
|
-PURPOSE: Saves values from controls into tty timeout settings
|
|
|
|
1346
|
|
780
|
|
|
1347
|
-PARAMETERS:
|
|
|
|
1348
|
- hdlg - Dialog window handle
|
|
|
|
1349
|
-
|
|
|
|
1350
|
-HISTORY: Date: Author: Comment:
|
|
|
|
1351
|
- 10/27/95 AllenD Wrote it
|
|
|
|
1352
|
-
|
|
|
|
1353
|
------------------------------------------------------------------------------*/
|
|
|
|
1354
|
-void SaveTimeoutsDlg(HWND hdlg)
|
|
|
|
1355
|
-{
|
|
|
|
1356
|
- COMMTIMEOUTS ctNew;
|
|
|
|
1357
|
-
|
|
|
|
1358
|
- //
|
|
|
|
1359
|
- // get new timeouts from dialog controls
|
|
|
|
1360
|
- //
|
|
|
|
1361
|
- ctNew.ReadIntervalTimeout = GetDlgItemInt(hdlg, IDC_READINTERVALEDIT, NULL, FALSE);
|
|
|
|
1362
|
- ctNew.ReadTotalTimeoutMultiplier = GetDlgItemInt(hdlg, IDC_READMULTIPLIEREDIT, NULL, FALSE);
|
|
|
|
1363
|
- ctNew.ReadTotalTimeoutConstant = GetDlgItemInt(hdlg, IDC_READCONSTANTEDIT, NULL, FALSE);
|
|
|
|
1364
|
- ctNew.WriteTotalTimeoutMultiplier = GetDlgItemInt(hdlg, IDC_WRITEMULTIPLIEREDIT, NULL, FALSE);
|
|
|
|
1365
|
- ctNew.WriteTotalTimeoutConstant = GetDlgItemInt(hdlg, IDC_WRITECONSTANTEDIT, NULL, FALSE);
|
|
|
|
1366
|
-
|
|
|
|
1367
|
- TTYInfo.fDisplayTimeouts = IsDlgButtonChecked(hdlg, IDC_DISPLAYTIMEOUTS);
|
|
|
|
1368
|
-
|
|
|
|
1369
|
- //
|
|
|
|
1370
|
- // set new timeouts if they are different
|
|
|
|
1371
|
- //
|
|
|
|
1372
|
- if (memcmp(&ctNew, &(TTYInfo.timeoutsnew), sizeof(COMMTIMEOUTS))) {
|
|
|
|
1373
|
- //
|
|
|
|
1374
|
- // if connected, set new time outs and purge pending operations
|
|
|
|
1375
|
- //
|
|
|
|
1376
|
- if (TTYInfo.fConnected) {
|
|
|
|
1377
|
- if (!SetCommTimeouts(TTYInfo.hCommPort, &ctNew)) {
|
|
|
|
1378
|
- ErrorReporter("SetCommTimeouts");
|
|
|
|
1379
|
- return;
|
|
|
|
1380
|
- }
|
|
|
|
1381
|
-
|
|
|
|
1382
|
- if (!PurgeComm(TTYInfo.hCommPort, PURGE_TXABORT | PURGE_RXABORT))
|
|
|
|
1383
|
- ErrorReporter("PurgeComm");
|
|
|
|
1384
|
- }
|
|
|
|
1385
|
-
|
|
|
|
1386
|
- //
|
|
|
|
1387
|
- // save timeouts in the tty info structure
|
|
|
|
1388
|
- //
|
|
|
|
1389
|
- TTYInfo.timeoutsnew = ctNew;
|
|
|
|
1390
|
- }
|
|
|
|
1391
|
-
|
|
|
|
1392
|
- return;
|
|
|
|
1393
|
-}
|
|
|
|
1394
|
-
|
|
|
|
1395
|
-/*-----------------------------------------------------------------------------
|
|
|
|
1396
|
-
|
|
|
|
1397
|
-FUNCTION: TimeoutsProc(HWND, UINT, WPARAM, LPARAM)
|
|
|
|
1398
|
-
|
|
|
|
1399
|
-PURPOSE: Dialog Procedure for comm timeouts
|
|
|
|
1400
|
-
|
|
|
|
1401
|
-PARAMETERS:
|
|
|
|
1402
|
- hdlg - Dialog window handle
|
|
|
|
1403
|
- uMessage - window message
|
|
|
|
1404
|
- wparam - message parameter (depends on message)
|
|
|
|
1405
|
- lparam - message parameter (depends on message)
|
|
|
|
1406
|
-
|
|
|
|
1407
|
-RETURN:
|
|
|
|
1408
|
- TRUE if message is handled
|
|
|
|
1409
|
- FALSE if message is not handled
|
|
|
|
1410
|
- Exception is WM_INITDIALOG: returns FALSE since focus is not set
|
|
|
|
1411
|
-
|
|
|
|
1412
|
-HISTORY: Date: Author: Comment:
|
|
|
|
1413
|
- 10/27/95 AllenD Wrote it
|
|
|
|
1414
|
-
|
|
|
|
1415
|
------------------------------------------------------------------------------*/
|
|
|
|
1416
|
-BOOL CALLBACK TimeoutsProc(HWND hdlg, UINT uMessage, WPARAM wparam, LPARAM lparam)
|
|
|
|
1417
|
-{
|
|
|
|
1418
|
- switch(uMessage)
|
|
|
|
1419
|
- {
|
|
|
|
1420
|
- case WM_INITDIALOG: // init controls
|
|
|
|
1421
|
- InitTimeoutsDlg(hdlg, TTYInfo.timeoutsnew);
|
|
|
|
1422
|
- break;
|
|
|
|
1423
|
-
|
|
|
|
1424
|
- case WM_COMMAND:
|
|
|
|
1425
|
- switch(LOWORD(wparam))
|
|
|
|
1426
|
- {
|
|
|
|
1427
|
- case IDOK:
|
|
|
|
1428
|
- SaveTimeoutsDlg(hdlg);
|
|
|
|
1429
|
-
|
|
|
|
1430
|
- //
|
|
|
|
1431
|
- // FALL THROUGH
|
|
|
|
1432
|
- //
|
|
|
|
1433
|
-
|
|
|
|
1434
|
- case IDCANCEL:
|
|
|
|
1435
|
- EndDialog(hdlg, LOWORD(wparam));
|
|
|
|
1436
|
- return TRUE;
|
|
|
|
1437
|
-
|
|
|
|
1438
|
- case IDC_DEFAULTSBTN:
|
|
|
|
1439
|
- InitTimeoutsDlg(hdlg, gTimeoutsDefault);
|
|
|
|
1440
|
- return TRUE;
|
|
|
|
1441
|
- }
|
|
|
|
1442
|
- break;
|
|
|
|
1443
|
- }
|
|
|
|
1444
|
-
|
|
|
|
1445
|
- return FALSE;
|
|
|
|
1446
|
-}
|
|
|
|
1447
|
-
|
|
|
|
1448
|
-BOOL CALLBACK GetADWORDProc(HWND hDlg, UINT uMessage, WPARAM wParam, LPARAM lParam)
|
|
|
|
1449
|
-{
|
|
|
|
1450
|
- int iRet = 0;
|
|
|
|
1451
|
-
|
|
|
|
1452
|
- if (uMessage == WM_COMMAND) {
|
|
|
|
1453
|
- switch(LOWORD(wParam)) {
|
|
|
|
1454
|
- case IDOK:
|
|
|
|
1455
|
- iRet = GetDlgItemInt(hDlg, IDC_DWORDEDIT, NULL, FALSE);
|
|
|
|
1456
|
- //
|
|
|
|
1457
|
- // FALL THROUGH
|
|
|
|
1458
|
- //
|
|
|
|
1459
|
-
|
|
|
|
1460
|
- case IDCANCEL:
|
|
|
|
1461
|
- EndDialog(hDlg, iRet);
|
|
|
|
1462
|
- return TRUE;
|
|
|
|
1463
|
- }
|
|
|
|
1464
|
- }
|
|
|
|
1465
|
-
|
|
|
|
1466
|
- return FALSE;
|
|
|
|
1467
|
-}
|
|
|
|
1468
|
-
|
|
|
|
1469
|
-DWORD GetAFrequency()
|
|
|
|
1470
|
-{
|
|
|
|
1471
|
- return ((DWORD) DialogBox(ghInst, MAKEINTRESOURCE(IDD_GETADWORD), ghwndMain, GetADWORDProc));
|
|
|
|
1472
|
-} |
|
|