-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSIPCallDlg.cpp
9389 lines (8974 loc) · 268 KB
/
SIPCallDlg.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// SIPCallDlg.cpp : implementation file
#include "stdafx.h"
//#include "vld.h"
#include "SIPCall.h"
#include "SIPCallDlg.h"
#include "VoiceTTS.h"
#include "DlgSet.h"
#include "DlgRecord.h"
//#include "DlgSend.h"
#include "DlgDB.h"
#include "tinyxml.h"
#include "DlgLogin.h"
#include "ZBase64.h"
#include "DlgBC.h"
#include "DlgUser.h"
#include "DlgPwdCheck.h"
#include"tlhelp32.h"
#include "LayoutConfig.h"
#include "DlgMonitor.h"
#include "DlgPopCall.h"
#if 0
#include "pcap.h"
#pragma comment(lib,"wpcap.lib")
#endif
#pragma region GLOBLE
static bool s_bOne = true;
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
#ifdef _DEBUG
#define DEBUG_FILE (0)
#else
#define DEBUG_FILE (0)
#endif
#ifdef _DEBUG
#define DEBUG_MEMORY (0)
#else
#define DEBUG_MEMORY (0)
#endif
#define BEAT_SEND_CLOSE (1)
#define BUTTON_PICTURE_MODEL (1)
#define TIMER_ID_CHECK (100) // 心跳包
#define TIMER_ID_UPDATE_STATUS (101) // 心跳1分钟后更新状态
#define TIMER_ID_REFLASH (102) // 刷新
#define TIMER_ID_PLAY (103) // 播放
#define TIMER_ID_CALL (104) // 拨打电话
#define TIMER_ID_PC_BEAT (105) // PC心跳(用于使用状态更新,有延迟)
#define TIMER_ID_PC_BEAT_FAST (106) // PC实时更新心跳
#define TIMER_ID_INFO_SHOW (107) // 主呼时定时检测解码板是否回应
#define TIMER_INTER_500 (500)
#define TIMER_INTER_1000 (1000)
#define TIMER_INTER_3000 (3000)
#define TIMER_INTER_5000 (5000)
#define TIMER_INTER_30000 (30*1000)
#define TIMER_INTER_60000 (60*1000)
#define TIMER_INTER_120000 (2*60*1000)
#define TIMER_INTER_300000 (5*60*1000)
#define TIMER_INTER_1800000 (30*60*1000)
#define TIMER_INTER_3000000 (50*60*1000)
#define CALL_TIME (2016)
#define INVALID_TIME_VALUE (60*1000)
CSIPCallDlg* m_pAPP = NULL;
CString g_ttsFilePath = L"";
CConfig g_Config;
CLog2File g_Log;
CAudioPlay g_Play;
CDataM g_data;
CDecodeMsg g_MSG;
enAdminType g_dataType;
bool g_RunPlay = false;
CString g_szAPPPath = L"";
char* g_dwLocalIp = NULL;
CMgrUser g_User;
CMgrPlay g_MgrPlay;
// CAboutDlg dialog used for App About
bool g_bOpenMic = false;
bool g_bOpenAux = false;
bool g_bOpenAPP = true; // 正常打开程序,非重启打开
bool g_bExitApp = false;
bool g_bExitSipgw = false; // sip代理网管是否关闭
bool g_bExitAudiogw = false;
bool g_bExitCallgw = false;
HANDLE g_hSipgwExitEvent = NULL;
HANDLE g_hCallRecordAgentEvent = NULL;
HANDLE g_hAudioRecordAgentEvent = NULL;
HANDLE g_hSipgwPacketEvent = NULL;
static bool s_ExitOpt = false; // 强制重启操作
static bool s_bManulBeat = false; // 手动巡检开关
static bool s_bBeatStop = false; // 停止巡检
static bool s_SipgwSend = false;
static bool s_OmSend = false;
static int s_UsingNetwork = -1;
static CString s_strSoftVer = L"1.0.103";
static CString s_strSoftDate = L"2017/11/07";
static int s_bFirst = 0; //消息机制s_bFirst = (int)wParam
static DWORD s_callEvtTime = 0; //最新电话事件的产生时间
static DWORD s_bcEvtTime = 0; //最新广播事件的产生时间
static int s_pic_bk_x = 0;
static int s_pic_bk_y = 0;
static int s_pic_bk_w = 0;
static int s_pic_bk_h = 0;
#pragma endregion GLOBLE
#if 0
UINT CheckUsingNetworkProc(LPVOID lp);
UINT CheckSipgwUdpPacketProc(LPVOID lp);
#endif
#pragma region ABOUTGLG
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
enum { IDD = IDD_ABOUTBOX };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
// Implementation
protected:
DECLARE_MESSAGE_MAP()
public:
CString m_strSoftVer;
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
m_strSoftVer = L"软件版本:" + s_strSoftVer;
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Text(pDX, IDC_STATIC_SOFT_VER, m_strSoftVer);
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
END_MESSAGE_MAP()
#pragma endregion ABOUTGLG
// CSIPCallDlg dialog
CSIPCallDlg::CSIPCallDlg(CWnd* pParent /*=NULL*/)
: CDialog(CSIPCallDlg::IDD, pParent)
{
//_CrtSetBreakAlloc(1035);
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
m_nPageTunnel = 0;
m_nPageDevice = 0;
m_pTunnelInfo = NULL; //CK注释,隧道结构体初始化NULL!!!
m_nTunnelNum = 0;
m_nCurTunnelIdx = 0;
m_bCall = false;
m_bPause = false;
g_Logic.m_UpdateDB = false;
g_Logic.m_SendBC = false;
g_Log.clearAll();
g_Log.addConfig(LOG_TYPE, "log_debug.txt");
g_Log.addConfig(LOG_TYPE_8, "log_msg.txt");
//g_Log.addConfig(LOG_TYPE_HTTP, "log_http.txt");
//g_Log.output(LOG_TYPE, "\r\n");
m_pGroupCall = NULL;
m_nGroupCall = 0;
m_pIPGroupFile = NULL;
m_nIPGroupFile = 0;
m_pBCYing = NULL;
m_nBCYing = 0;
m_vecCallEvent.reserve(300);
m_vecCallEvt.reserve(300);
m_vecNoBCData.reserve(50);
m_vecNoCallData.reserve(50);
m_vecBeatData.reserve(300);
m_vecOutData.reserve(50);
m_vecStausData.reserve(300);
m_vecLineData.reserve(50);
m_vecDeciveCMD.reserve(10);
}
void CSIPCallDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_STATIC_CALL2, m_PictureB);
DDX_Control(pDX, IDC_STATIC_CALL1, m_PictureA);
DDX_Control(pDX, IDC_BUTTON1, m_pBtnTunnel[0]);
DDX_Control(pDX, IDC_BUTTON2, m_pBtnTunnel[1]);
DDX_Control(pDX, IDC_BUTTON3, m_pBtnTunnel[2]);
DDX_Control(pDX, IDC_BUTTON4, m_pBtnTunnel[3]);
DDX_Control(pDX, IDC_BUTTON5, m_pBtnTunnel[4]);
DDX_Control(pDX, IDC_BUTTON6, m_pBtnTunnel[5]);
DDX_Control(pDX, IDC_BUTTON7, m_pBtnTunnel[6]);
DDX_Control(pDX, IDC_BUTTON8, m_pBtnTunnel[7]);
DDX_Control(pDX, IDC_BUTTON9, m_pBtnTunnel[8]);
DDX_Control(pDX, IDC_BUTTON10, m_pBtnTunnel[9]);
DDX_Control(pDX, IDC_PIC_PE_1, m_pIMG_PE_U[0]);
DDX_Control(pDX, IDC_PIC_PE_2, m_pIMG_PE_U[1]);
DDX_Control(pDX, IDC_PIC_PE_3, m_pIMG_PE_U[2]);
DDX_Control(pDX, IDC_PIC_PE_4, m_pIMG_PE_U[3]);
DDX_Control(pDX, IDC_PIC_PE_5, m_pIMG_PE_U[4]);
DDX_Control(pDX, IDC_PIC_PE_6, m_pIMG_PE_U[5]);
DDX_Control(pDX, IDC_PIC_PE_7, m_pIMG_PE_U[6]);
DDX_Control(pDX, IDC_PIC_PE_8, m_pIMG_PE_U[7]);
DDX_Control(pDX, IDC_PIC_PE_9, m_pIMG_PE_U[8]);
DDX_Control(pDX, IDC_PIC_PE_10, m_pIMG_PE_U[9]);
DDX_Control(pDX, IDC_PIC_PE_11, m_pIMG_PE_U[10]);
DDX_Control(pDX, IDC_PIC_PE_12, m_pIMG_PE_U[11]);
DDX_Control(pDX, IDC_PIC_PE_13, m_pIMG_PE_U[12]);
DDX_Control(pDX, IDC_PIC_PE_14, m_pIMG_PE_U[13]);
DDX_Control(pDX, IDC_PIC_PE_15, m_pIMG_PE_U[14]);
DDX_Control(pDX, IDC_PIC_PE_16, m_pIMG_PE_U[15]);
DDX_Control(pDX, IDC_PIC_PE_17, m_pIMG_PE_U[16]);
DDX_Control(pDX, IDC_PIC_PE_18, m_pIMG_PE_U[17]);
DDX_Control(pDX, IDC_PIC_PE_19, m_pIMG_PE_U[18]);
DDX_Control(pDX, IDC_PIC_PE_20, m_pIMG_PE_U[19]);
DDX_Control(pDX, IDC_PIC_PE_51, m_pIMG_PE_D[0]);
DDX_Control(pDX, IDC_PIC_PE_52, m_pIMG_PE_D[1]);
DDX_Control(pDX, IDC_PIC_PE_53, m_pIMG_PE_D[2]);
DDX_Control(pDX, IDC_PIC_PE_54, m_pIMG_PE_D[3]);
DDX_Control(pDX, IDC_PIC_PE_55, m_pIMG_PE_D[4]);
DDX_Control(pDX, IDC_PIC_PE_56, m_pIMG_PE_D[5]);
DDX_Control(pDX, IDC_PIC_PE_57, m_pIMG_PE_D[6]);
DDX_Control(pDX, IDC_PIC_PE_58, m_pIMG_PE_D[7]);
DDX_Control(pDX, IDC_PIC_PE_59, m_pIMG_PE_D[8]);
DDX_Control(pDX, IDC_PIC_PE_60, m_pIMG_PE_D[9]);
DDX_Control(pDX, IDC_PIC_PE_61, m_pIMG_PE_D[10]);
DDX_Control(pDX, IDC_PIC_PE_62, m_pIMG_PE_D[11]);
DDX_Control(pDX, IDC_PIC_PE_63, m_pIMG_PE_D[12]);
DDX_Control(pDX, IDC_PIC_PE_64, m_pIMG_PE_D[13]);
DDX_Control(pDX, IDC_PIC_PE_65, m_pIMG_PE_D[14]);
DDX_Control(pDX, IDC_PIC_PE_66, m_pIMG_PE_D[15]);
DDX_Control(pDX, IDC_PIC_PE_67, m_pIMG_PE_D[16]);
DDX_Control(pDX, IDC_PIC_PE_68, m_pIMG_PE_D[17]);
DDX_Control(pDX, IDC_PIC_PE_69, m_pIMG_PE_D[18]);
DDX_Control(pDX, IDC_PIC_PE_70, m_pIMG_PE_D[19]);
DDX_Control(pDX, IDC_PIC_ARROW_LEFT, m_PicArrowL);
DDX_Control(pDX, IDC_PIC_ARROW_RIGHT, m_PicArrowR);
DDX_Control(pDX, IDC_STATIC_IMAGE, m_pictureBK);
DDX_Control(pDX, IDC_STATIC_TUNNEL_TITLE, m_ctrlStaticTunnelTitle);
}
BEGIN_MESSAGE_MAP(CSIPCallDlg, CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
//}}AFX_MSG_MAP
ON_WM_DESTROY()
ON_COMMAND(ID_MENU1_SET, &CSIPCallDlg::OnSet)
ON_COMMAND(ID_MENU_CALL, &CSIPCallDlg::OnRecordCall)
ON_COMMAND(ID_MENU_MSG, &CSIPCallDlg::OnRecordMsg)
ON_COMMAND(ID_MENU_LOG, &CSIPCallDlg::OnRecordLog)
ON_COMMAND(ID_MENU_DB, &CSIPCallDlg::OnRecordDB)
ON_BN_CLICKED(IDC_BUTTON_NEXT, &CSIPCallDlg::OnBnClickedButtonNext)
ON_BN_CLICKED(IDC_BUTTON_PRE, &CSIPCallDlg::OnBnClickedButtonPre)
ON_BN_CLICKED(BTN_IMAGE_NEXT, &CSIPCallDlg::OnBnClickedButtonDeviceNext)
ON_BN_CLICKED(BTN_IMAGE_PRE, &CSIPCallDlg::OnBnClickedButtonDevicePre)
ON_BN_CLICKED(IDC_BUTTON1, &CSIPCallDlg::OnBnClickedButton1)
ON_BN_CLICKED(IDC_BUTTON2, &CSIPCallDlg::OnBnClickedButton2)
ON_BN_CLICKED(IDC_BUTTON3, &CSIPCallDlg::OnBnClickedButton3)
ON_BN_CLICKED(IDC_BUTTON4, &CSIPCallDlg::OnBnClickedButton4)
ON_BN_CLICKED(IDC_BUTTON5, &CSIPCallDlg::OnBnClickedButton5)
ON_BN_CLICKED(IDC_BUTTON6, &CSIPCallDlg::OnBnClickedButton6)
ON_BN_CLICKED(IDC_BUTTON7, &CSIPCallDlg::OnBnClickedButton7)
ON_BN_CLICKED(IDC_BUTTON8, &CSIPCallDlg::OnBnClickedButton8)
ON_BN_CLICKED(IDC_BUTTON9, &CSIPCallDlg::OnBnClickedButton9)
ON_BN_CLICKED(IDC_BUTTON10, &CSIPCallDlg::OnBnClickedButton10)
ON_BN_CLICKED(IDC_BTN_SEND_BC, &CSIPCallDlg::OnBnClickedBtnSendBc)
ON_BN_CLICKED(IDC_CHECK_SEND_BC, &CSIPCallDlg::OnBnClickedCheckSendBc)
ON_WM_TIMER()
ON_COMMAND_RANGE(BTN_CREATE_START, BTN_CREATE_END, OnCreateButtonClick)
ON_COMMAND(ID_MENU_ABOUT_INFO, &CSIPCallDlg::OnMenuAboutInfo)
ON_COMMAND(ID_MENU_HELP, &CSIPCallDlg::OnMenuHelp)
ON_BN_CLICKED(IDC_BTN_CONFIG, &CSIPCallDlg::OnBnClickedBtnConfig)
ON_BN_CLICKED(IDC_BTN_STOP, &CSIPCallDlg::OnBnClickedBtnStop)
ON_BN_CLICKED(IDC_BTN_PLAY, &CSIPCallDlg::OnBnClickedBtnPlay)
ON_UPDATE_COMMAND_UI(ID_MENU_USER, &CSIPCallDlg::OnUpdateMenuUser)
ON_COMMAND(ID_MENU_ONEKEYCLOSE, &CSIPCallDlg::OnMenuOnekeyclose)
ON_WM_CLOSE()
ON_COMMAND(ID_MENU_MAN_BEAT, &CSIPCallDlg::OnMenuManBeat)
ON_WM_CTLCOLOR()
ON_COMMAND(ID_MENU_VIDEO, &CSIPCallDlg::OnMenuVideo)
ON_BN_CLICKED(IDC_BTN_TTS, &CSIPCallDlg::OnBnClickedBtnTts)
ON_COMMAND(ID_MENU_MONITOR, &CSIPCallDlg::OnMenuMonitor)
ON_COMMAND(ID_MENU_MONITOR_CLOSE, &CSIPCallDlg::OnMenuMonitorClose)
ON_BN_CLICKED(IDC_CHECK_UP_ALL, &CSIPCallDlg::OnBnClickedCheckUpAll)
ON_BN_CLICKED(IDC_CHECK_DOWN_ALL, &CSIPCallDlg::OnBnClickedCheckDownAll)
ON_MESSAGE(RECV_MSG_CALL_REQ,&CSIPCallDlg::OnRecvMsgCallReqFromMasterSystem)
ON_MESSAGE(RECV_MSG_E1,&CSIPCallDlg::OnRecvMsgE1)
ON_MESSAGE(RECV_MSG_E2,&CSIPCallDlg::OnRecvMsgE2)
ON_MESSAGE(RECV_MSG_E3,&CSIPCallDlg::OnRecvMsgE3)
ON_MESSAGE(RECV_MSG_E4,&CSIPCallDlg::OnRecvMsgE4)
ON_MESSAGE(RECV_MSG_CALL,&CSIPCallDlg::OnRecvMsgCallFromDevice)
ON_MESSAGE(RECV_MSG_CALL_OK,&CSIPCallDlg::OnRecvMsgCallOnlineFromOM)
ON_MESSAGE(RECV_MSG_CALL_OFFLINE,&CSIPCallDlg::OnRecvMsgCallOfflineFromOM)
ON_MESSAGE(RECV_MSG_CALL_IDLE,&CSIPCallDlg::OnRecvMsgCallIdleFromOM)
ON_MESSAGE(RECV_MSG_CALL_RING,&CSIPCallDlg::OnRecvMsgCallRingFromOM)
ON_MESSAGE(RECV_MSG_CALL_RUN,&CSIPCallDlg::OnRecvMsgCallRunningFromOM)
ON_MESSAGE(RECV_MSG_CALL_HANGUP,&CSIPCallDlg::OnRecvMsgCallHungUpFromOM)
ON_MESSAGE(RECV_MSG_CALL_NOANSWER,&CSIPCallDlg::OnRecvMsgCallNoAnswerFromOM)
ON_MESSAGE(RECV_MSG_BC_CLOSE,&CSIPCallDlg::OnRecvMsgBCOption)
ON_MESSAGE(RECV_MSG_BEAT_OK,&CSIPCallDlg::OnRecvMsgHeartBeatReplyFromDevice)
ON_MESSAGE(RECV_MSG_DEVICESTATUS_MASTERSYSTEM_REQ,&CSIPCallDlg::OnRecvMsgDeviceStatusReqFromMasterSystem)
ON_MESSAGE(RECV_MSG_DEVICESTATUS_BRANCHSYSTEM_RESPONSE,&CSIPCallDlg::OnRecvMsgDeviceStatusResponseFromBranchSystem)
ON_MESSAGE(RECV_MSG_DEVICESTATUS_MASTERSYSTEM_ACK,&CSIPCallDlg::OnRecvMsgDeviceStatusAckFromMasterSystem)
ON_MESSAGE(RECV_MSG_CALL_STATUS,&CSIPCallDlg::OnRecvMsgCallStatusFromBranch)
ON_MESSAGE(RECV_MSG_BROADCAST_STATUS,&CSIPCallDlg::OnRecvMsgBroadcastStatusFromBranch)
ON_MESSAGE(RECV_MSG_BC_REQ,&CSIPCallDlg::OnRecvMsgBroadcastReqFromMaster)
ON_MESSAGE(NO_E1_ANSWER,&CSIPCallDlg::OnRecvNoE1Answer)
ON_MESSAGE(NO_E2_ANSWER,&CSIPCallDlg::OnRecvNoE2Answer)
ON_MESSAGE(NO_E3_ANSWER,&CSIPCallDlg::OnRecvNoE3Answer)
ON_MESSAGE(NO_E4_ANSWER,&CSIPCallDlg::OnRecvNoE4Answer)
ON_MESSAGE(NO_RING_EVENT,&CSIPCallDlg::OnRecvNoRingEvt)
ON_MESSAGE(RECV_BRANCH_OM_STATUS,&CSIPCallDlg::OnRecvBranchOMDown)
ON_MESSAGE(SIPGW_EXIT,&CSIPCallDlg::OnRecvSipgwExit)
ON_MESSAGE(AUDIO_RECORD_EXIT,&CSIPCallDlg::OnRecvAudioRecordAgentExit)
ON_MESSAGE(CALL_RECORD_EXIT,&CSIPCallDlg::OnRecvCallRecordAgentExit)
ON_COMMAND(ID_OpenAudioRecord, &CSIPCallDlg::OnOpenaudiorecord)
ON_COMMAND(ID_OpenCallRecord, &CSIPCallDlg::OnOpencallrecord)
ON_COMMAND(ID_CloseAudioRecord, &CSIPCallDlg::OnCloseaudiorecord)
ON_COMMAND(ID_CloseCallRecord, &CSIPCallDlg::OnClosecallrecord)
ON_MESSAGE(RECV_MSG_DEVICE_BEAT_REQ,&CSIPCallDlg::OnRecvMsgDeviceBeatReq)
ON_MESSAGE(NO_PACKETS,&CSIPCallDlg::OnRecvMsgNoPackets)
ON_MESSAGE(RECV_MSG_OUTER_BC_OPT_START,&CSIPCallDlg::OnRecvOuterBCStart)
ON_MESSAGE(RECV_MSG_OUTER_BC_OPT_CLOSE,&CSIPCallDlg::OnRecvOuterBCClose)
END_MESSAGE_MAP()
DWORD GetProcessidFromName(CString processName,CString &processPath)
{
PROCESSENTRY32 pe;
DWORD idx = 0;
HANDLE hSnapshot=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
pe.dwSize=sizeof(PROCESSENTRY32);
BOOL ret=Process32First( hSnapshot,&pe);
if(!ret){
return 0;
}
while(1)
{
pe.dwSize=sizeof(PROCESSENTRY32);
if(Process32Next(hSnapshot,&pe)==FALSE)
break;
if(processName.CompareNoCase(pe.szExeFile)==0)
{
//id=pe.th32ProcessID;
//获取当前进程所在路径
// mehandle=CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pe.th32ProcessID);
// me.dwSize=sizeof(MODULEENTRY32);
// Module32First(mehandle,&me);
// processPath=me.szExePath;
idx++;
}
}
CloseHandle(hSnapshot);
return idx;
}
UINT CheckSipgwEXE(LPVOID lpParam)
{
//CSIPCallDlg* SipObj = (CSIPCallDlg*)lpParam;
g_hSipgwExitEvent = CreateEvent(NULL,TRUE,FALSE,NULL);
while (!g_bExitApp)
{
CString strPath;
if(GetProcessidFromName(L"SRSipgw.exe", strPath)==0)
{
if(m_pAPP->m_hWnd){
SendMessage(m_pAPP->m_hWnd,SIPGW_EXIT,0,0);
Sleep(5000);
}
}
else
{
if(m_pAPP->m_hWnd){
SendMessage(m_pAPP->m_hWnd,SIPGW_EXIT,1,0);
Sleep(2000);
}
}
}
SetEvent(g_hSipgwExitEvent);
return 1;
}
UINT CheckAudioServerEXE(LPVOID lpParam)
{
//CSIPCallDlg* SipObj = (CSIPCallDlg*)lpParam;
g_hAudioRecordAgentEvent = CreateEvent(NULL,TRUE,FALSE,NULL);
while (!g_bExitApp)
{
CString strPath;
if(GetProcessidFromName(L"AudioServer.exe", strPath)==0)
{
if(m_pAPP->m_hWnd){
SendMessage(m_pAPP->m_hWnd,AUDIO_RECORD_EXIT,0,0);
Sleep(20000);
}
}
else
{
if(m_pAPP->m_hWnd){
SendMessage(m_pAPP->m_hWnd,AUDIO_RECORD_EXIT,1,0);
Sleep(10000);
}
}
}
SetEvent(g_hAudioRecordAgentEvent);
return 1;
}
UINT CheckCallRecordEXE(LPVOID lpParam)
{
g_hCallRecordAgentEvent = CreateEvent(NULL,TRUE,FALSE,NULL);
while (!g_bExitApp)
{
CString strPath;
if(GetProcessidFromName(L"pbxrecord.exe", strPath)==0)
{
if(m_pAPP->m_hWnd){
SendMessage(m_pAPP->m_hWnd,CALL_RECORD_EXIT,0,0);
Sleep(20000);
}
}
else
{
if(m_pAPP->m_hWnd){
SendMessage(m_pAPP->m_hWnd,CALL_RECORD_EXIT,1,0);
Sleep(10000);
}
}
}
SetEvent(g_hCallRecordAgentEvent);
return 1;
}
// CSIPCallDlg message handlers
BOOL CSIPCallDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// SEventInfo evt;
// m_http.DecodeEvent("xxx", evt);
CString strPath;
if (GetProcessidFromName(L"SIPCall.exe", strPath) > 1)
{
MessageBox(L"软件正在运行,请关闭后再打开!", L"提醒");
//SendMessage(WM_CLOSE);
//return FALSE;
exit(1);
}
if (GetProcessidFromName(L"SRSipgw.exe", strPath) == 0)
{
MessageBox(L"缺少代理网关 SRSipgw.exe, 请检查!", L"提醒");
//SendMessage(WM_CLOSE);
//return FALSE;
exit(1);
}
// TODO: Add extra initialization here
//使关闭按钮无效
//pSysMenu->EnableMenuItem(SC_CLOSE,MF_DISABLED);
BtnInit();
s_ExitOpt = false;
m_pAPP = this;
InitAPPPath();
if (IsReboot())
{
g_bOpenAPP = false;
ClearReboot();
}
else{
g_bOpenAPP = true;
}
// user
char szUser[256]= {0};
WideCharToMultiByte(CP_ACP, 0, g_szAPPPath + L"usr.dat", -1, szUser, 256, NULL, NULL);
g_User.ReadUser(szUser);
g_MSG.ReadIPData();
ReadNoBCFile();
ReadNoCallFile();
ReadDeviceLineFile();
ReadGroupFile();
ReadIPGroupFile();
ReadDevCmdFile();
CDlgLogin login;
login.DoModal(); //弹出登录窗口13
g_dataType = login.GetType();
//g_dataType = ENUM_TYPE_SUPER;
if (g_dataType == ENUM_TYPE_NONE){
//exit(1);
SendMessage(WM_CLOSE);
}
else{
//m_hbrush=CreateSolidBrush(RGB(0,0,0));
memset(m_szLoginName, 0, MAX_PATH * sizeof(char));
WideCharToMultiByte(CP_ACP, 0, login.GetLoginName(), -1, m_szLoginName, MAX_PATH, NULL, NULL);
m_MgrPic.LoadPic();
m_editFont1.CreatePointFont(70, L"宋体");
m_editFont_title.CreatePointFont(200, L"微软雅黑");
g_Config.ReadConfig();
//Logic
InitSocket(); //初始化创建3Socket
ReadDB();
// tip start
// 按钮提示
m_Mytip.Create(this);
m_Mytip.SetDelayTime(200); //设置延迟
m_Mytip.SetDelayTime(TTDT_AUTOPOP, 8000);
m_Mytip.SetTipTextColor( RGB(0,0,255) ); //设置提示文本的颜色
m_Mytip.SetTipBkColor( RGB(255,255,255)); //设置提示框的背景颜色
m_Mytip.Activate(TRUE); //设置是否启用提示
// tip end
m_nCurTunnelIdx = 0;
m_nPageDevice = 0;
int cx = GetSystemMetrics(SM_CXFULLSCREEN);
int cy = GetSystemMetrics(SM_CYFULLSCREEN);
CRect rt;
SystemParametersInfo(SPI_GETWORKAREA,0,&rt,0);
cy = rt.bottom;
MoveWindow(0, 0, cx, cy);
//软件左上角标题格式
CString strSoftTitle = L"";
strSoftTitle.Format(L"紧急电话广播系统V%s_%s", s_strSoftVer, s_strSoftDate);
SetWindowText(strSoftTitle);
//ShowWindow(SW_SHOWMAXIMIZED/*SW_MAXIMIZE*/);
//CRect rect;
//GetClientRect(&rect);
m_width = cx/*rect.right - rect.left*/;
m_height = cy/*rect.bottom - rect.top*/;
SetLayout();
if (m_nTunnelNum == 0)
{
if(g_dataType == ENUM_TYPE_SUPER){
MessageBox(L"数据库无数据,请先初始化数据!", L"提醒");
CDlgDB dlg;
dlg.DoModal();
}
else{
MessageBox(L"数据库无数据,请联系管理员初始化数据!", L"提醒");
}
SendMessage(WM_CLOSE);
}
SendMessage(SEND_MSG_BEAT, 1, 0); //Caution 100!!!
//SetTimer(TIMER_ID_CHECK, TIMER_INTER_300000, 0);
SetTimer(TIMER_ID_CHECK, TIMER_INTER_1800000, 0);
SetTimer(TIMER_ID_REFLASH, TIMER_INTER_1000, 0);
SetTimer(TIMER_ID_CALL, TIMER_INTER_1000, 0);
SetTimer(TIMER_ID_PLAY, TIMER_INTER_3000, 0);
//SetTimer(TIMER_ID_PC_BEAT_FAST, TIMER_INTER_3000, 0);
#if 0
ReflashCallThread();
#else
m_CallA.status = ENUM_DEVICE_STATUS_OK;
m_CallB.status = ENUM_DEVICE_STATUS_OK;
#endif
m_http.CreateTCPRecvThread();
if (g_dataType == ENUM_TYPE_SUPER)
{
}
else if (g_dataType == ENUM_TYPE_ADMIN)
{
AfxGetApp()->m_pMainWnd->GetMenu()->EnableMenuItem(ID_MENU1_SET,MF_GRAYED);
}
else if (g_dataType == ENUM_TYPE_USER)
{
AfxGetApp()->m_pMainWnd->GetMenu()->EnableMenuItem(ID_MENU1_SET,MF_GRAYED);
AfxGetApp()->m_pMainWnd->GetMenu()->EnableMenuItem(ID_MENU_ONEKEYCLOSE, MF_GRAYED);
}
if (g_Config.m_SystemConfig.nJT == 0)
{
m_Menu.RemoveMenu(ID_MENU_MONITOR, MF_BYCOMMAND);
m_Menu.RemoveMenu(ID_MENU_MONITOR_CLOSE, MF_BYCOMMAND);
}
// 检测版本
//CheckVersion();
// 初始化录音
g_Play.RecordInit();
AfxBeginThread(CheckSipgwEXE,NULL);
//AfxBeginThread(CheckUsingNetworkProc,NULL);
}
return TRUE; // return TRUE unless you set the focus to a control
}
void CSIPCallDlg::CheckVersion()
{
g_data.ReadLog(ENUM_SORT_ALL);
int nLogNum = 0;
g_data.GetRecordLog(nLogNum);
SYSTEMTIME tm;
GetLocalTime(&tm);
TCHAR windowText[512] = {0};
GetWindowText(windowText, 512);
if ((nLogNum > 10000) || (tm.wYear > 2016) || (tm.wYear == 2016 && tm.wMonth < 1))
{
MessageBox(L"环境变量为0x000000,需要设置,请关闭!", L"提醒");
OnResetApp();
}
}
void CSIPCallDlg::ReadDB()
{
m_DBLock.Lock();
g_data.ReadDB();
m_pTunnelInfo = g_data.GetData(m_nTunnelNum);
m_DBLock.Unlock();
}
void CSIPCallDlg::UpdateData()
{
m_DBLock.Lock();
g_data.DB2Data();
m_pTunnelInfo = g_data.GetData(m_nTunnelNum);
m_DBLock.Unlock();
DB2TunnelBtn();
CheckTunnelPreNext();
//InitSel(m_nCurTunnelIdx);
DB2DeviceBtn(m_nCurTunnelIdx);
CheckDevicePreNext();
}
void CSIPCallDlg::getCurDeviceNum(int curTunnelIdx, int& upNum, int& downNum)
{
upNum = downNum = 0;
if(m_pTunnelInfo == NULL || m_nTunnelNum == 0){
return;
}
if (curTunnelIdx < 0 || curTunnelIdx >= m_nTunnelNum)
{
return;
}
downNum = m_pTunnelInfo[curTunnelIdx].vecDeviceDown.size();
upNum = m_pTunnelInfo[curTunnelIdx].vecDeviceUp.size();
}
void CSIPCallDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CSIPCallDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
#if 1
CPaintDC dc(this);
HBITMAP m_hBitmap = NULL;
//m_hBitmap = ::LoadBitmap(::GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_BITMAP2));
m_hBitmap = m_MgrPic.GetBitmap(_T("texture\\bk.bmp"));
if (m_hBitmap)
{
BITMAP bm;
GetObject( m_hBitmap, sizeof(BITMAP), &bm);
CDC dcMem; //定义一个工具箱(设备上下文)
dcMem.CreateCompatibleDC(&dc);///建立关联DC
/*CBitmap *pbmpOld=*/dcMem.SelectObject(m_hBitmap); //保存原有CDC对象,并选入新CDC对象入DC
dc.SetStretchBltMode(STRETCH_HALFTONE/*COLORONCOLOR*/);//防止bmp图片失真
dc.StretchBlt(s_pic_bk_x, s_pic_bk_y , s_pic_bk_w, s_pic_bk_h , &dcMem,0,0, bm.bmWidth,bm.bmHeight,SRCCOPY);
wchar_t wName[128] = {0};
MultiByteToWideChar(CP_ACP, 0, m_pTunnelInfo[m_nCurTunnelIdx].Name, -1, wName, 128);
((CButton*)GetDlgItem(IDC_STATIC_TUNNEL_TITLE))->SetWindowText(wName);
// (个人建议把,rect.Width(),rect.Height()这两个数据 换成你的图片的大小,前提是图片足够大,这样图片不容易失真。关于图片失真,参考:http://blog.csdn.net/abidepan/article/details/7963929 )
//dcMem.SelectObject(pbmpOld);
//::DeleteObject(m_hBitmap);
dcMem.DeleteDC();
}
#endif
RepaintTunnelBtn();
CDialog::OnPaint();
}
}
// The system calls this function to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CSIPCallDlg::OnQueryDragIcon()
{
return static_cast<HCURSOR>(m_hIcon);
}
void CSIPCallDlg::SetLayout()
{
m_Menu.LoadMenu(IDR_MENU1);
SetMenu(&m_Menu);
for (int i = 0; i < BTN_NUM_TUNNEL; i++)
{
m_pBtnTunnel[i].SetFlat();
m_pBtnTunnel[i].SetAlign(CButtonST::ST_ALIGN_OVERLAP);
}
SetTitleLayout(); //标题布局
SetTunnelBtnLayout(); //隧道按键布局
SetDeviceLayout(); //设备布局
SetCallLayout(); //电话布局
DB2TunnelBtn();
CheckTunnelPreNext();
//InitSel(m_nCurTunnelIdx);
DB2DeviceBtn(m_nCurTunnelIdx);
CheckDevicePreNext();
Call2Btn();
}
void CSIPCallDlg::SetTitleLayout()
{
int padW = 10;
int padH = 2;
int XCoord = m_width / 4;
int YCoord = padH;
int btnInter = 10;
int w = m_width / 2;
CStatic* pWnd = (CStatic*)GetDlgItem(IDC_STATIC_TITLE);
pWnd->SetWindowPos( NULL, XCoord, YCoord, w, 30, SWP_NOZORDER );
TCHAR wzTitle[MAX_PATH] = {0};
MultiByteToWideChar(CP_ACP, 0, g_Config.m_SystemConfig.title, -1, wzTitle, MAX_PATH);
SetDlgItemText(IDC_STATIC_TITLE, wzTitle);
pWnd->SetFont(&m_editFont_title);
}
void CSIPCallDlg::SetTunnelNameLayout()
{
int padW = 10;
int padH = 5;
int XCoord = m_width / 4;
int YCoord = 280;
int btnInter = 10;
int w = m_width / 2;
CStatic* pWnd = (CStatic*)GetDlgItem(IDC_STATIC_TUNNEL_TITLE);
pWnd->SetWindowPos( NULL, XCoord, YCoord, w, 40, SWP_NOZORDER );
TCHAR wzTitle[MAX_PATH] = {0};
MultiByteToWideChar(CP_ACP, 0, g_Config.m_SystemConfig.title, -1, wzTitle, MAX_PATH);
SetDlgItemText(IDC_STATIC_TUNNEL_TITLE, wzTitle);
pWnd->SetFont(&m_editFont_title);
}
void CSIPCallDlg::SetTunnelBtnLayout()
{
//
int padW = 10;
int padH = 10;
int XCoord = padW;
int YCoord = LAYOUT_TOP_TUNNEL;
int btnInter = 10;
int w = m_width - 2 * padW;
CWnd *pWnd;
pWnd = GetDlgItem(IDC_STATIC_TUNNEL);
pWnd->SetWindowPos( NULL, XCoord, YCoord, w, 70, SWP_NOZORDER );
// PRE
int btnPreW = 40;
int btnH = 35;
pWnd = GetDlgItem(IDC_BUTTON_PRE);
int XCoordPre = XCoord + padW;
int YCoordPre = YCoord + 20;
pWnd->SetWindowPos( NULL, XCoordPre,YCoordPre, btnPreW, btnH, SWP_NOZORDER );
// tunnel button
int btnNum = BTN_NUM_TUNNEL;
int btnW = (m_width - 4 * padW - 2 * btnPreW - (btnNum + 1) * btnInter) / btnNum;
int XCoordBtn = XCoordPre + btnPreW + btnInter;
int YCoordBtn = YCoordPre;
for (int i = 0; i < btnNum; i++)
{
pWnd = GetDlgItem(IDC_BUTTON1 + i);
pWnd->SetWindowPos( NULL, XCoordBtn + (btnW + btnInter) * i, YCoordBtn, btnW, btnH, SWP_NOZORDER );
}
// NEXT
pWnd = GetDlgItem(IDC_BUTTON_NEXT);
pWnd->SetWindowPos( NULL, m_width - 2 * padW - btnPreW, YCoordPre, btnPreW, btnH, SWP_NOZORDER );
//CheckBtnPreNext();
}
void CSIPCallDlg::SetDeviceLayout()
{
//
int padW = 10;
int padH = 10;
int XCoord = padW;
int YCoord = LAYOUT_TOP_DEVICE;
int btnInter = 10;
int w = m_width - 2 * padW;
CWnd *pWnd;
pWnd = GetDlgItem(IDC_STATIC_CUR_TUNNEL);
pWnd->SetWindowPos( NULL, XCoord, YCoord, w, TOP_DEVICE_BOTTOM - LAYOUT_TOP_DEVICE, SWP_NOZORDER );
// PRE
int XCoordPre = XCoord + padW;
int YCoordPre = YCoord + 30;
int btnPreW = 30;
int btnH = 30;
CRect rectPre(XCoordPre, YCoordPre, XCoordPre + btnPreW, YCoordPre + 340);
m_pbtnImgPre = NewMyButton(BTN_IMAGE_PRE, rectPre, 0, L"<");
pWnd = GetDlgItem(BTN_IMAGE_PRE);
pWnd->SetWindowPos( NULL, XCoordPre,YCoordPre, btnPreW, 340, SWP_NOZORDER );
// call button
int btnNum = BTN_NUM_CALL;
int btnW = (m_width - 4 * padW - 2 * btnPreW - (btnNum + 1) * btnInter) / btnNum;
// 上电话
int XCoordBtn = XCoordPre + btnPreW + btnInter;
//int YCoordBtn = TOP_CALL_UP/*YCoordPre + 40*/;
for (int i = 0; i < btnNum; i++)
{
CRect rectCall(0, 0, 40, 40);
m_pbtnCall1[i] = NewMyButton(BTN_IMAGE_BASEID_1_0 + i, rectCall, 0);
pWnd = GetDlgItem(BTN_IMAGE_BASEID_1_0 + i);
pWnd->SetWindowPos( NULL, XCoordBtn + (btnW + btnInter) * i, TOP_CALL_UP, 40/*btnW*/, 40/*btnH*/, SWP_NOZORDER );
SetButtonBMP((CButton*)pWnd, _T("texture\\call4_40.bmp"));
}
// 上广播
XCoordBtn = XCoordPre + btnPreW + btnInter;
//YCoordBtn = TOP_BC_UP/*YCoordPre*//* + 50*/;
for (int i = 0; i < btnNum; i++)
{
CRect rectCall1(0, 0, 40, 20);
m_pbtnMsg1[i] = NewCheckBox(CHECK_BOX_BASEID_1 + i, rectCall1, 0);
m_pbtnMsg1[i]->SetWindowPos( NULL, XCoordBtn + (btnW + btnInter) * i, TOP_BC_UP, 40/*btnW*/, 20/*btnH*/, SWP_NOZORDER );
SetButtonBMP(m_pbtnMsg1[i], _T("texture\\m4_20.bmp"));
}
// 上标签
XCoordBtn = XCoordPre + btnPreW + btnInter;
for (int i = 0; i < btnNum; i++)
{
CRect rectCall(0, 0, 50, 20);
m_pStatic1[i] = NewStatic(BTN_STATIC_BASEID_1 + i, rectCall, 0);
pWnd = GetDlgItem(BTN_STATIC_BASEID_1 + i);
pWnd->SetWindowPos( NULL, XCoordBtn + (btnW + btnInter) * i, TOP_NAME_UP, 50, 20, SWP_NOZORDER );
CRect rectPE(0, 0, 40, 20);
pWnd = GetDlgItem(IDC_PIC_PE_1 + i);
pWnd->SetWindowPos( NULL, XCoordBtn + (btnW + btnInter) * i, TOP_PERSON_UP, 40, 20, SWP_NOZORDER );
CRect rectCall1(0, 0, 45, 15);
m_pStatic3[i] = NewStatic(BTN_STATIC_BASEID_11 + i, rectCall1, 1, L"");
pWnd = GetDlgItem(BTN_STATIC_BASEID_11 + i);
pWnd->SetWindowPos( NULL, XCoordBtn + (btnW + btnInter) * i, TOP_ERROR_UP, 45/*btnW*/, 15/*btnH*/, SWP_NOZORDER );
CRect rectCallKM(0, 0, 80, 20);
m_pStaticKM1[i] = NewStatic(BTN_STATIC_BASEID_KM1 + i, rectCallKM, 0);
pWnd = GetDlgItem(BTN_STATIC_BASEID_KM1 + i);
pWnd->SetWindowPos( NULL, XCoordBtn + (btnW + btnInter) * i, TOP_KM_UP, 80, 20, SWP_NOZORDER );
}
// send broadcast
//GetDlgItem(IDC_BTN_SEND_BC)->SetWindowPos( NULL,(m_width - 2 * padW) * 0.5, YCoordPre + 110, 100, 30, SWP_NOZORDER );
// send broadcast checkbox
if (true/*g_Config.m_SystemConfig.nMainSystem*/)
{
SetDlgItemText(IDC_CHECK_SEND_BC, L"全选广播");
GetDlgItem(IDC_CHECK_UP_ALL)->SetWindowPos( NULL,(m_width - 2 * padW) * 0.2,TOP_BUTTON_BOTTOM, 60, 40, SWP_NOZORDER );
GetDlgItem(IDC_CHECK_DOWN_ALL)->SetWindowPos( NULL,(m_width - 2 * padW) * 0.25,TOP_BUTTON_BOTTOM, 60, 40, SWP_NOZORDER );
GetDlgItem(IDC_CHECK_SEND_BC)->SetWindowPos( NULL,(m_width - 2 * padW) * 0.3,TOP_BUTTON_BOTTOM, 100, 40, SWP_NOZORDER );
GetDlgItem(IDC_BTN_PLAY)->SetWindowPos( NULL,(m_width - 2 * padW) * 0.4, TOP_BUTTON_BOTTOM, 100, 40, SWP_NOZORDER );
GetDlgItem(IDC_BTN_STOP)->SetWindowPos( NULL,(m_width - 2 * padW) * 0.5, TOP_BUTTON_BOTTOM, 100, 40, SWP_NOZORDER );
GetDlgItem(IDC_BTN_CONFIG)->SetWindowPos( NULL,(m_width - 2 * padW) * 0.6, TOP_BUTTON_BOTTOM, 100, 40, SWP_NOZORDER );
GetDlgItem(IDC_BTN_TTS)->SetWindowPos( NULL,(m_width - 2 * padW) * 0.7, TOP_BUTTON_BOTTOM, 100, 40, SWP_NOZORDER );
}
else{
GetDlgItem(IDC_CHECK_UP_ALL)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_CHECK_DOWN_ALL)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_CHECK_SEND_BC)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_BTN_PLAY)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_BTN_STOP)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_BTN_CONFIG)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_BTN_TTS)->ShowWindow(SW_HIDE);
}
//int offsetXia = 90;
// 下电话
XCoordBtn = XCoordPre + btnPreW + btnInter;
//YCoordBtn = YCoordPre + 190 + offsetXia;
for (int i = 0; i < btnNum; i++)
{
CRect rectCall(0, 0, 40, 40);
m_pbtnCall2[i] = NewMyButton(BTN_IMAGE_BASEID_2_0 + i, rectCall, 0);
pWnd = GetDlgItem(BTN_IMAGE_BASEID_2_0 + i);
pWnd->SetWindowPos( NULL, XCoordBtn + (btnW + btnInter) * i, TOP_CALL_DOWN, 40/*btnW*/, 40/*btnH*/, SWP_NOZORDER );
SetButtonBMP((CButton*)pWnd, _T("texture\\call4_40.bmp"));
}
// 下广播
XCoordBtn = XCoordPre + btnPreW + btnInter;
//YCoordBtn = YCoordPre + 150 + offsetXia;
for (int i = 0; i < btnNum; i++)
{
CRect rectCall2(0, 0, 40, 20);
m_pbtnMsg2[i] = NewCheckBox(CHECK_BOX_BASEID_2 + i, rectCall2, 0);
m_pbtnMsg2[i]->SetWindowPos( NULL, XCoordBtn + (btnW + btnInter) * i, TOP_BC_DOWN, 40/*btnW*/, 20/*btnH*/, SWP_NOZORDER );
SetButtonBMP(m_pbtnMsg2[i], _T("texture\\m4_20.bmp"));
}
// 下标签
XCoordBtn = XCoordPre + btnPreW + btnInter;
//YCoordBtn = YCoordPre + 235 + offsetXia;
for (int i = 0; i < btnNum; i++)
{
CRect rectCall(0, 0, 50, 20);