12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287 |
- // UPhoneBoxDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "UPhoneBox.h"
- #include "UPhoneBoxDlg.h"
- #include "setbusytonedlg.h"
- #include "SetVolumeDlg.h"
- #include <afxtempl.h>
- #include "Lzari.h"
- #include "NotFindDlg.h"
- #include "outsourcingDlg.h"
- #include "MyLock.h"
- #include "WorkerDlg.h"
- #include "Client2Dlg.h"
- #include <tlhelp32.h>
- #include "Booking.h"
- #include "AddOldClient.h"
- #include "AddOldClient2.h"
- #include "PhoneComing.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- extern CString g_ip;
- #define NEW_DEVICE 18666
- //#define TEST_WINDOW 1
- BOOL g_bok = 0;
- CArray<CStringArray, CStringArray>g_cominfoarray;
- BOOL g_bAutoRun = 0;
- #define WM_ICON_NOTIFY WM_USER+12
- CString g_recordpath[10];
- CUPhoneBoxDlg *g_pMainWnd = NULL;
- #define RECOED_DIR "recorder-dir\\"
- CUPhoneBoxDlg *pusb = NULL;
- extern CFont g_listctrlfont;
- BOOL g_bCallOut[10] = { 1 };
- HWND g_hwnd[10] = { NULL };
- CArray<int, int>yearposarray[10];
- CStringArray idarray[10];
- CString g_phone[10];
- BOOL g_bChildVersion = 0;
- BOOL g_bNewBooking = 0;
- #define WNDNUM 100
- Booking g_dlgbooking[WNDNUM];
- outsourcingDlg g_dlgoutsourcing[WNDNUM];
- NotFindDlg g_dlgnotfind[WNDNUM];
- Client2Dlg g_dlgclient2[WNDNUM];
- WorkerDlg g_dlgWorkerDlg[WNDNUM];
- AddOldClient g_dlgOldClient[WNDNUM];
- AddOldClient2 g_dlgOldClient2[WNDNUM];
- PhoneComing g_dlgphonecoming[2];
- typedef struct
- {
- int idpos;
- char phone[30];
- char str1[100];
- char str2[100];
- char str3[100];
- char str4[100];
- char str5[500];
- }CLIENTINFO;
- DWORD g_tick = 0;
- /////////////////////////////////////////////////////////////////////////////
- // CAboutDlg dialog used for App About IDM_CLOSE
- CArray<CStringArray, CStringArray>g_arraydata[10][10];//年,代码
- #pragma comment(lib,"phonic_ubox.lib")
- int g_nYearpos = -1;
- BOOL g_bReturned2 = 0;
- #define DISCONNECT_TIMER (WM_USER + 101)
- #define LOGINFAILED_TIMER (WM_USER + 102)
- void DeleteSubFiles(CString strDir)
- {
- try
- {
- strDir.TrimRight("\\");
- CFileFind tempFind;
- CString tempFileFind;
- tempFileFind.Format("%s\\*.*", strDir);
- BOOL IsFinded = (BOOL)tempFind.FindFile(tempFileFind);
- while (IsFinded)
- {
- IsFinded = (BOOL)tempFind.FindNextFile();
- if (!tempFind.IsDots())
- {
- if (!tempFind.IsDirectory())
- {
- CString foundFileName;
- foundFileName.Format("%s", tempFind.GetFileName());
- CString tempFileName;
- tempFileName.Format("%s\\%s", strDir, foundFileName);
- DeleteFile(tempFileName);
- }
- }
- }
- tempFind.Close();
- }
- catch (...)
- {
- }
- }
- /////////////////////////////////////////////////////////////////////////////
- static void HandleClientNetEvent2(IN SOCKET hSocket, IN ETransportEvent eEvent,
- IN void *pDataBuf, IN unsigned long nDataLen,
- IN int nError, IN void *pContext)
- {
- if (nError != TRANSPORT_OK) return;
- CUPhoneBoxDlg *pDlg = (CUPhoneBoxDlg *)pContext;
- if (NULL == pDlg) return;
- pDlg->ProcessNetEvent(eEvent, pDataBuf, nDataLen);
- }
- void CALLBACK ProcPhonicCallBack(
- UBOX_HANDLE uboxHnd //设备句柄
- , int eventID //事件,参考UBOX_EVENT的定义
- , unsigned long param1 //下面几个参数不同的事件,其含义不同
- , unsigned long param2
- , unsigned long param3
- , unsigned long param4
- );
- class CAboutDlg : public CDialog
- {
- public:
- CAboutDlg();
- // Dialog Data
- //{{AFX_DATA(CAboutDlg)
- enum {
- IDD = IDD_ABOUTBOX
- };
- //}}AFX_DATA
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CAboutDlg)
- protected:
- virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
- //}}AFX_VIRTUAL
- // Implementation
- protected:
- //{{AFX_MSG(CAboutDlg)
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
- };
- CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
- {
- //{{AFX_DATA_INIT(CAboutDlg)
- //}}AFX_DATA_INIT
- }
- void CAboutDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CAboutDlg)
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
- //{{AFX_MSG_MAP(CAboutDlg)
- // No message handlers
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CUPhoneBoxDlg dialog
- CUBoxLine* CUPhoneBoxDlg::get_line_by_ID(size_t lineID_)
- {
- CUBoxLine* pLine = NULL;
- for (size_t lineID = 0; lineID < MAX_DEVICE; lineID++)
- {
- if (ubox_device[lineID].line_id() == lineID_)
- {
- pLine = static_cast<CUBoxLine*>(&ubox_device[lineID]);
- break;
- }
- }
- return pLine;
- }
- CUBoxLine* CUPhoneBoxDlg::get_line_by_handle(UBOX_HANDLE handle)
- {
- CUBoxLine* pLine = NULL;
- for (size_t lineID = 0; lineID < MAX_DEVICE; lineID++)
- {
- if (ubox_device[lineID].line_handel() == handle)
- {
- pLine = static_cast<CUBoxLine*>(&ubox_device[lineID]);
- break;
- }
- }
- return pLine;
- }
- CUPhoneBoxDlg::CUPhoneBoxDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CUPhoneBoxDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CUPhoneBoxDlg)
- //}}AFX_DATA_INIT
- // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
- m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
- m_hIcon2 = AfxGetApp()->LoadIcon(IDI_ICON1);
- g_listctrlfont.CreatePointFont(110, _T("System"));
- CString version = _T("Version 1.0");
- g_bAutoRun = AfxGetApp()->GetProfileInt(version, "brun", 0);
- }
- void CUPhoneBoxDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CUPhoneBoxDlg)
- DDX_Control(pDX, IDC_DISSTATE, m_list);
- DDX_Control(pDX, IDC_DISINFOR, m_dis);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CUPhoneBoxDlg, CDialog)
- //{{AFX_MSG_MAP(CUPhoneBoxDlg)
- ON_WM_SYSCOMMAND()
- ON_WM_PAINT()
- ON_WM_QUERYDRAGICON()
- ON_COMMAND(IDM_CLOSEAGC, OnCloseagc)
- ON_COMMAND(IDM_DIALPHONENUM, OnDialphonenum)
- ON_COMMAND(IDM_GETHANGTHRESHOLD, OnGethangthreshold)
- ON_COMMAND(IDM_GETHARDWAREVERSION, OnGethardwareversion)
- ON_COMMAND(IDM_GETPRODUCTNAME, OnGetproductname)
- ON_COMMAND(IDM_GETUSERNUM, OnGetusernum)
- ON_COMMAND(IDM_OPENBUZZER, OnOpenbuzzer)
- ON_COMMAND(IDM_OPENCONFIGUREMODE, OnOpenconfiguremode)
- ON_COMMAND(IDM_OPENMSGSWITCH, OnOpenmsgswitch)
- ON_COMMAND(IDM_PAUSEPLAY, OnPauseplay)
- ON_COMMAND(IDM_PLAYFILE, OnPlayfile)
- ON_COMMAND(IDM_READEEPROM, OnReadeeprom)
- ON_COMMAND(IDM_READEEPROMEX, OnReadeepromex)
- ON_COMMAND(IDM_READLINEVOLTAGE, OnReadlinevoltage)
- ON_COMMAND(IDM_RECORDFILE, OnRecordfile)
- ON_COMMAND(IDM_RECORDSTREAM, OnRecordstream)
- ON_COMMAND(IDM_SETHANGTHRESHOLD, OnSethangthreshold)
- ON_COMMAND(IDM_SETHOOKOFFTHRESHOLD, OnSethookoffthreshold)
- ON_COMMAND(IDM_SOFTHANGUP, OnSofthangup)
- ON_COMMAND(IDM_SOFTHOOKOFF, OnSofthookoff)
- ON_COMMAND(IDM_STOPPLAY, OnStopplay)
- ON_COMMAND(IDM_STOPREADLINEVOLTAGE, OnStopreadlinevoltage)
- ON_COMMAND(IDM_STOPRECORD, OnStoprecord)
- ON_COMMAND(IDM_WRITEEEPROM, OnWriteeeprom)
- ON_COMMAND(IDM_SETBUSYTONE, OnSetBusyTone)
- ON_COMMAND(IMD_GETHOOKOFFTHRESHOLD, OnGethookoffthreshold)
- ON_NOTIFY(NM_DBLCLK, IDC_DISSTATE, OnDblclkOpt)
- ON_WM_DESTROY()
- ON_COMMAND(IDM_RESTART, OnRestart)
- ON_COMMAND(IDM_SET_VOLUME, OnSetVolume)
- ON_WM_TIMER()
- ON_COMMAND(IDM_CLOSE, OnClose)
- ON_COMMAND(IDM_AUTORUN, OnAutorun)
- //}}AFX_MSG_MAP
- ON_MESSAGE(WM_ICON_NOTIFY, OnTrayNotification)
- ON_MESSAGE(WM_USER + 200, OnNewClient)
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CUPhoneBoxDlg message handlers
- int GetDlgPos(int type)
- {
- if (type == 0)
- {
- for (int i = 0; i < WNDNUM; i++)
- {
- if (g_dlgbooking[i].GetSafeHwnd() == NULL)return i;
- }
- return -1;
- }
- else if (type == 1)
- {
- for (int i = 0; i < WNDNUM; i++)
- {
- if (g_dlgoutsourcing[i].GetSafeHwnd() == NULL)return i;
- }
- return -1;
- }
- else if (type == 2)
- {
- for (int i = 0; i < WNDNUM; i++)
- {
- if (g_dlgnotfind[i].GetSafeHwnd() == NULL)return i;
- }
- return -1;
- }
- else if (type == 3)
- {
- for (int i = 0; i < WNDNUM; i++)
- {
- if (g_dlgclient2[i].GetSafeHwnd() == NULL)return i;
- }
- return -1;
- }
- else if (type == 4)
- {
- for (int i = 0; i < WNDNUM; i++)
- {
- if (g_dlgWorkerDlg[i].GetSafeHwnd() == NULL)return i;
- }
- return -1;
- }
- else if (type == 5)
- {
- if (g_bChildVersion)
- {
- for (int i = 0; i < WNDNUM; i++)
- {
- if (g_dlgOldClient2[i].GetSafeHwnd() == NULL)return i;
- }
- }
- else
- {
- for (int i = 0; i < WNDNUM; i++)
- {
- if (g_dlgOldClient[i].GetSafeHwnd() == NULL)return i;
- }
- }
- return -1;
- }
- }
- LRESULT CUPhoneBoxDlg::OnTrayNotification(WPARAM wParam, LPARAM lParam)
- {
- return m_TrayIcon.OnTrayNotification(wParam, lParam);
- }
- LRESULT CUPhoneBoxDlg::OnNewClient(WPARAM wParam, LPARAM lParam)
- {
- CLIENTINFO *pClientInfo = (CLIENTINFO*)wParam;
- g_dlgphonecoming[pClientInfo->idpos].CheckTimer(); // 来电对话框;
- if (lParam == 0) // 订单顾客详情;
- {
- int pos = GetDlgPos(1);
- if (pos == -1)
- {
- delete pClientInfo;
- return 0;
- }
- g_dlgoutsourcing[pos].m_linepos = pClientInfo->idpos;
- g_dlgoutsourcing[pos].m_phone = pClientInfo->phone;
- delete pClientInfo;
- g_dlgoutsourcing[pos].Create(IDD_DLGoutsourcingdlg, g_pMainWnd);
- g_dlgoutsourcing[pos].ShowWindow(1);
- }
- else if (lParam == 1) // 未知来电;
- {
- int pos = GetDlgPos(2);
- if (pos == -1)
- {
- delete pClientInfo;
- return 0;
- }
- g_dlgnotfind[pos].m_linepos = pClientInfo->idpos;
- g_dlgnotfind[pos].m_phone = pClientInfo->phone;
- delete pClientInfo;
- g_dlgnotfind[pos].Create(IDD_DLGNotFind, g_pMainWnd);
- g_dlgnotfind[pos].ShowWindow(1);
- }
- else if (lParam == 2) // 意向客户;
- {
- int pos = GetDlgPos(3);
- if (pos == -1)
- {
- delete pClientInfo;
- return 0;
- }
- g_dlgclient2[pos].m_linepos = pClientInfo->idpos;
- g_dlgclient2[pos].m_phone = pClientInfo->phone;
- g_dlgclient2[pos].m_name = pClientInfo->str1;
- g_dlgclient2[pos].m_sex = pClientInfo->str2;
- g_dlgclient2[pos].m_addr = pClientInfo->str3;
- g_dlgclient2[pos].m_qq = pClientInfo->str4;
- g_dlgclient2[pos].m_bz = pClientInfo->str5;
- delete pClientInfo;
- g_dlgclient2[pos].Create(IDD_DLGClient2, g_pMainWnd);
- g_dlgclient2[pos].ShowWindow(1);
- }
- else if (lParam == 3) // 员工电话;
- {
- int pos = GetDlgPos(4);
- if (pos == -1)
- {
- delete pClientInfo;
- return 0;
- }
- g_dlgWorkerDlg[pos].m_linepos = pClientInfo->idpos;
- g_dlgWorkerDlg[pos].m_phone = pClientInfo->phone;
- g_dlgWorkerDlg[pos].m_name = pClientInfo->str1;
- g_dlgWorkerDlg[pos].m_sex = pClientInfo->str2;
- g_dlgWorkerDlg[pos].m_bm = pClientInfo->str3;
- delete pClientInfo;
- g_dlgWorkerDlg[pos].Create(IDD_DLGWorker, g_pMainWnd);
- g_dlgWorkerDlg[pos].ShowWindow(1);
- }
- else if (lParam == 4) // 添加儿童或婚纱顾客信息;
- {
- int pos = GetDlgPos(5);
- if (pos == -1)
- {
- delete pClientInfo;
- return 0;
- }
- if (g_bChildVersion) // 儿童版本;
- {
- g_dlgOldClient2[pos].m_linepos = pClientInfo->idpos;
- g_dlgOldClient2[pos].m_phone = pClientInfo->phone;
- delete pClientInfo;
- g_dlgOldClient2[pos].Create(IDD_DLGAddOldClient2, g_pMainWnd);
- g_dlgOldClient2[pos].ShowWindow(1);
- }
- else // 婚纱版本;
- {
- g_dlgOldClient[pos].m_linepos = pClientInfo->idpos;
- g_dlgOldClient[pos].m_phone = pClientInfo->phone;
- delete pClientInfo;
- g_dlgOldClient[pos].Create(IDD_DLGAddOldClient, g_pMainWnd);
- g_dlgOldClient[pos].ShowWindow(1);
- }
- }
- }
- BOOL CUPhoneBoxDlg::OnInitDialog()
- {
- SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_HIDEWINDOW);
- ModifyStyleEx(WS_EX_APPWINDOW, WS_EX_TOOLWINDOW);
- CDialog::OnInitDialog();
- g_tick = ::GetTickCount();
- g_pMainWnd = this;
- g_dlgphonecoming[0].Create(IDD_DLGPhoneComing, g_pMainWnd);
- g_dlgphonecoming[1].Create(IDD_DLGPhoneComing, g_pMainWnd);
- // 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
- // TODO: Add extra initialization here
- m_font.CreateFont(16, 0, 0, 0, FW_NORMAL, 0, 0, 0,
- DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS,
- DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial");
- m_list.SetFont(&m_font);
- /*-----------------------------------------------------------*/
- m_list.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);
- m_list.SetBkColor(RGB(247, 247, 255));
- m_list.SetTextColor(RGB(0, 0, 255));
- m_list.SetTextBkColor(RGB(247, 247, 255));
- m_list.InsertColumn(0, "LineID", LVCFMT_LEFT, 60);
- m_list.InsertColumn(1, "productname", LVCFMT_LEFT, 120);
- m_list.InsertColumn(2, "State", LVCFMT_LEFT, 100);
- m_list.InsertColumn(3, "Key", LVCFMT_LEFT, 120);
- m_list.InsertColumn(4, "CallerNum", LVCFMT_LEFT, 120);
- m_list.InsertColumn(5, "other", LVCFMT_LEFT, 120);
- WriteLogin("打开来电精灵!");
- ubox_open_logfile(0);
- ((CButton *)GetDlgItem(IDC_AUDORECORD))->SetCheck(TRUE);
- if (ubox_open(::ProcPhonicCallBack, UBOX_WORK_MODE(0)))
- {
- WriteLogin(" 打开来电精灵失败! ");
- m_dis.InsertString(m_dis.GetCount(), "open device error");
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- pusb = this;
- char s_szName[MAX_PATH];
- ::GetModuleFileName(NULL, s_szName, MAX_PATH);
- strPath = s_szName;
- size_t dotPos = strPath.ReverseFind('\\');
- if (dotPos != -1)
- {
- strPath.Delete(dotPos, strPath.GetLength() - dotPos);
- }
- DeleteSubFiles(strPath + "\\" + RECOED_DIR);
- SetTimer(1, 10, NULL); // 10ms间隔执行;
- RefreshData();
- SetTimer(5, 30 * 60 * 1000, NULL); // 30分钟间隔执行;
- return TRUE;
- }
- void CUPhoneBoxDlg::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 CUPhoneBoxDlg::OnPaint()
- {
- if (IsIconic())
- {
- CPaintDC dc(this); // device context for painting
- SendMessage(WM_ICONERASEBKGND, (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
- {
- CDialog::OnPaint();
- }
- }
- // The system calls this to obtain the cursor to display while the user drags
- // the minimized window.
- HCURSOR CUPhoneBoxDlg::OnQueryDragIcon()
- {
- return (HCURSOR)m_hIcon;
- }
- void CUPhoneBoxDlg::OnCloseagc()
- {
- // TODO: Add your command handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_ID(m_iClickItemID);
- if (pLine)
- {
- UBOX_HANDLE hdl = pLine->line_handel();
- if (pLine->get_agc())
- {
- pLine->set_agc(false);
- ubox_close_agc(hdl, false); //open agc
- }
- else
- {
- pLine->set_agc(true);
- ubox_close_agc(hdl, true); //close agc
- }
- }
- }
- void CUPhoneBoxDlg::OnDialphonenum()
- {
- // TODO: Add your command handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_ID(m_iClickItemID);
- if (pLine)
- {
- UBOX_HANDLE hdl = pLine->line_handel();
- if (pLine->SendDtmfDlg.DoModal() == IDOK)
- {
- int res = ubox_get_product_ID(hdl);
- if ((res == 1) || (res == 4))
- {
- ubox_soft_hook_off(hdl);
- Sleep(1000);
- }
- if (ubox_send_dtmf(hdl, pLine->SendDtmfDlg.m_phonenum) != 0)
- m_dis.InsertString(m_dis.GetCount(), "dial num failed");
- }
- }
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- void CUPhoneBoxDlg::OnGethangthreshold()
- {
- // TODO: Add your command handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_ID(m_iClickItemID);
- if (pLine)
- {
- char buff[100];
- UBOX_HANDLE hdl = pLine->line_handel();
- int res = ubox_get_hang_threshold(hdl);
- if (res > 0)
- {
- sprintf(buff, "Hang threshold:%dV", res);
- m_dis.InsertString(m_dis.GetCount(), buff);
- }
- else
- {
- if (res == -6)
- m_dis.InsertString(m_dis.GetCount(), "this function work in configure mode");
- else
- m_dis.InsertString(m_dis.GetCount(), "get hook off threshold failed");
- }
- }
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- void CUPhoneBoxDlg::OnGethardwareversion()
- {
- // TODO: Add your command handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_ID(m_iClickItemID);
- if (pLine)
- {
- char buff[100];
- UBOX_HANDLE hdl = pLine->line_handel();
- float ver;
- int res = ubox_get_device_versionnum(hdl, ver);
- if (res == 0)
- {
- sprintf(buff, "hardware ver:V%2.1f", ver);
- m_dis.InsertString(m_dis.GetCount(), buff);
- }
- else
- m_dis.InsertString(m_dis.GetCount(), "get hardware ver failed");
- }
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- void CUPhoneBoxDlg::OnGetproductname()
- {
- // TODO: Add your command handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_ID(m_iClickItemID);
- if (pLine)
- {
- UBOX_HANDLE hdl = pLine->line_handel();
- int res = ubox_get_product_ID(hdl);
- if (res > 0)
- {
- CString str;
- switch (res)
- {
- case 1:
- str = "FI3102A";
- break;
- case 2:
- str = "FI3002B";
- break;
- case 3:
- str = "FI3001B";
- break;
- case 4:
- str = "FI3101A";
- break;
- default:
- str = "unkown product";
- }
- m_dis.InsertString(m_dis.GetCount(), str);
- }
- else
- m_dis.InsertString(m_dis.GetCount(), "get product id failed");
- }
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- void CUPhoneBoxDlg::OnGetusernum()
- {
- // TODO: Add your command handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_ID(m_iClickItemID);
- int res;
- if (pLine)
- {
- UBOX_HANDLE hdl = pLine->line_handel();
- unsigned char num[10];
- res = ubox_get_usernum(hdl, num, 10);
- if (res > 0)
- {
- int i;
- CString str = "USer num:";
- for (i = 0; i < res; i++)
- str += num[i];
- m_dis.InsertString(m_dis.GetCount(), str);
- }
- else
- m_dis.InsertString(m_dis.GetCount(), "get user num failed");
- }
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- void CUPhoneBoxDlg::OnOpenbuzzer()
- {
- // TODO: Add your command handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_ID(m_iClickItemID);
- if (pLine)
- {
- UBOX_HANDLE hdl = pLine->line_handel();
- if (pLine->get_buzzerSwitch())
- {
- pLine->set_buzzerSwitch(false);
- ubox_open_buzzer_switch(hdl, false); //close buzzer
- }
- else
- {
- pLine->set_buzzerSwitch(true);
- ubox_open_buzzer_switch(hdl, true); //open buzzer
- }
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- }
- void CUPhoneBoxDlg::OnOpenconfiguremode()
- {
- // TODO: Add your command handler code here
- ubox_close();
- m_list.DeleteAllItems();
- int i;
- for (i = 0; i < MAX_DEVICE; i++)
- ubox_device[i].handl_plug_out();
- if (ubox_open(::ProcPhonicCallBack, UBOX_WORK_MODE(2)) == 0) //
- {
- m_dis.InsertString(m_dis.GetCount(), "use configure mode open device ok");
- }
- else
- m_dis.InsertString(m_dis.GetCount(), "use configure mode open device failed");
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- void CUPhoneBoxDlg::OnOpenmsgswitch()
- {
- // TODO: Add your command handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_ID(m_iClickItemID);
- if (pLine)
- {
- UBOX_HANDLE hdl = pLine->line_handel();
- if (pLine->get_MessageSwitch())
- {
- pLine->set_MessageSwitch(false);
- ubox_set_message_param(hdl, false); //close buzzer
- }
- else
- {
- pLine->set_MessageSwitch(true);
- ubox_set_message_param(hdl, true); //open buzzer
- }
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- }
- void CUPhoneBoxDlg::OnPauseplay()
- {
- // TODO: Add your command handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_ID(m_iClickItemID);
- if (pLine)
- {
- int res;
- UBOX_HANDLE hdl = pLine->line_handel();
- if (pLine->bplaypause)
- {
- pLine->bplaypause = false;
- res = ubox_play_pause(hdl);
- }
- else
- {
- pLine->bplaypause = true;
- res = ubox_play_pause(hdl);
- }
- if (res == 0)
- {
- m_dis.InsertString(m_dis.GetCount(), "play pause,click this menu continued playing file");
- }
- else
- m_dis.InsertString(m_dis.GetCount(), "set play pause failed");
- }
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- void CUPhoneBoxDlg::OnPlayfile()
- {
- // TODO: Add your command handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_ID(m_iClickItemID);
- int res;
- if (pLine)
- {
- UBOX_HANDLE hdl = pLine->line_handel();
- CFileDialog dlg(true);
- if (dlg.DoModal() == IDOK)
- {
- res = ubox_play_file(hdl, dlg.GetPathName());
- if (res != 0)
- m_dis.InsertString(m_dis.GetCount(), "play file failed");
- }
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- }
- void CUPhoneBoxDlg::OnReadeeprom()
- {
- // TODO: Add your command handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_ID(m_iClickItemID);
- int res;
- if (pLine)
- {
- UBOX_HANDLE hdl = pLine->line_handel();
- unsigned char data[8];
- res = ubox_read_eeprom(hdl, 0, data, 8);
- if (res != 0)
- m_dis.InsertString(m_dis.GetCount(), "read eeprom data failed");
- else
- {
- m_dis.InsertString(m_dis.GetCount(), "Read rom data from addr 0-7:");
- char buff[100];
- sprintf(buff, "0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x", data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);
- m_dis.InsertString(m_dis.GetCount(), buff);
- }
- }
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- void CUPhoneBoxDlg::OnReadeepromex()
- {
- // TODO: Add your command handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_ID(m_iClickItemID);
- int res;
- if (pLine)
- {
- UBOX_HANDLE hdl = pLine->line_handel();
- unsigned char data[8];
- res = ubox_read_eepromEx(hdl, 0, data, 8);
- if (res != 0)
- m_dis.InsertString(m_dis.GetCount(), "read eeprom data failed");
- else
- {
- m_dis.InsertString(m_dis.GetCount(), "Read eepromdata from addr 0-7:");
- char buff[100];
- sprintf(buff, "0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x", data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);
- m_dis.InsertString(m_dis.GetCount(), buff);
- }
- }
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- void CUPhoneBoxDlg::OnReadlinevoltage()
- {
- // TODO: Add your command handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_ID(m_iClickItemID);
- int res;
- if (pLine)
- {
- UBOX_HANDLE hdl = pLine->line_handel();
- res = ubox_start_read_line_voltage(hdl);
- if (res != 0)
- m_dis.InsertString(m_dis.GetCount(), "Start read line Voltage failed");
- }
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- void CUPhoneBoxDlg::OnRecordfile()//摘机开始录音;
- {
- // TODO: Add your command handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_ID(m_iClickItemID);
- int res;
- if (pLine)
- {
- UBOX_HANDLE hdl = pLine->line_handel();
- CString sFilter =
- "Wave Files(*.wav)|*.wav";
- CFileDialog dlgOpen(FALSE, "WAV", 0, OFN_HIDEREADONLY,
- (LPCTSTR)sFilter, NULL);
- if (dlgOpen.DoModal() == IDOK)
- {
- res = ubox_record_file(hdl, (LPCTSTR)(dlgOpen.GetPathName()), CODER_MP3);
- if (res != 0)
- {
- m_dis.InsertString(m_dis.GetCount(), "record file failed");
- }
- }
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- }
- void CUPhoneBoxDlg::OnRecordstream()
- {
- // TODO: Add your command handler code here
- CUBoxLine* pLine = get_line_by_ID(m_iClickItemID);
- if (pLine)
- {
- UBOX_HANDLE hdl = pLine->line_handel();
- CString sFilter =
- "Wave Files(*.wav)|*.wav";
- CFileDialog dlgOpen(FALSE, "WAV", 0, OFN_HIDEREADONLY,
- (LPCTSTR)sFilter, NULL);
- if (dlgOpen.DoModal() == IDOK)
- {
- pLine->fpstream = fopen((LPCTSTR)(dlgOpen.GetPathName()), "wb+");
- if (!pLine->fpstream)
- m_dis.InsertString(m_dis.GetCount(), "create file failed");
- else
- {
- WORD fmt = WAVE_FORMAT_ALAW; //WAVE_FORMAT_MULAW WAVE_FORMAT_PCM
- WaveFileHeader pcmWavHeader(0, fmt);
- int res = fwrite((const char*)&pcmWavHeader, sizeof(pcmWavHeader), 1, pLine->fpstream);
- if (res != 1)
- {
- m_dis.InsertString(m_dis.GetCount(), "write file head failed");
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- }
- if (ubox_record_stream(hdl, CODER_ALAW) != 0)
- {
- m_dis.InsertString(m_dis.GetCount(), "stream record failed");
- if (pLine->fpstream)
- {
- fclose(pLine->fpstream);
- pLine->fpstream = NULL;
- }
- }
- }
- }
- }
- void CUPhoneBoxDlg::OnSethangthreshold()
- {
- // TODO: Add your command handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_ID(m_iClickItemID);
- if (pLine)
- {
- UBOX_HANDLE hdl = pLine->line_handel();
- int value_d = atoi(pLine->threshold.m_hangTh.GetBuffer(pLine->threshold.m_hangTh.GetLength()));
- if (pLine->threshold.DoModal() == IDOK)
- {
- if (ubox_set_hang_threshold(hdl, value_d) != 0)
- m_dis.InsertString(m_dis.GetCount(), "set hookoff threshold faild");
- }
- pLine->threshold.m_hangTh.ReleaseBuffer();
- }
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- void CUPhoneBoxDlg::OnSethookoffthreshold()
- {
- // TODO: Add your command handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_ID(m_iClickItemID);
- //setthreshold threshold;
- if (pLine)
- {
- UBOX_HANDLE hdl = pLine->line_handel();
- int value_d = atoi(pLine->threshold.m_hookoffTh.GetBuffer(pLine->threshold.m_hookoffTh.GetLength()));
- if (pLine->threshold.DoModal() == IDOK)
- {
- if (ubox_set_hookoff_threshold(hdl, value_d) != 0)
- m_dis.InsertString(m_dis.GetCount(), "set hookoff threshold faild");
- }
- pLine->threshold.m_hookoffTh.ReleaseBuffer();
- }
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- void CUPhoneBoxDlg::OnSofthangup()
- {
- // TODO: Add your command handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_ID(m_iClickItemID);
- if (pLine)
- {
- UBOX_HANDLE hdl = pLine->line_handel();
- if (ubox_soft_hook_on(hdl) != 0)
- {
- // MessageBox("soft hookon failed!","提示",MB_OK);
- m_dis.InsertString(m_dis.GetCount(), "soft hookon failed!");
- }
- }
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- void CUPhoneBoxDlg::OnSofthookoff()
- {
- // TODO: Add your command handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_ID(m_iClickItemID);
- if (pLine)
- {
- UBOX_HANDLE hdl = pLine->line_handel();
- if (ubox_soft_hook_off(hdl) != 0)
- {
- m_dis.InsertString(m_dis.GetCount(), "soft hook off failed");
- }
- }
- }
- void CUPhoneBoxDlg::OnStopplay()
- {
- // TODO: Add your command handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_ID(m_iClickItemID);
- int res;
- if (pLine)
- {
- UBOX_HANDLE hdl = pLine->line_handel();
- res = ubox_stop_play(hdl);
- if (res != 0)
- m_dis.InsertString(m_dis.GetCount(), "stop play file failed");
- }
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- void CUPhoneBoxDlg::OnStopreadlinevoltage()
- {
- // TODO: Add your command handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_ID(m_iClickItemID);
- int res;
- if (pLine)
- {
- UBOX_HANDLE hdl = pLine->line_handel();
- res = ubox_stop_read_line_voltage(hdl);
- if (res != 0)
- m_dis.InsertString(m_dis.GetCount(), "stop read line voltage failed");
- }
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- void CUPhoneBoxDlg::OnStoprecord()
- {
- // TODO: Add your command handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_ID(m_iClickItemID);
- int res;
- if (pLine)
- {
- UBOX_HANDLE hdl = pLine->line_handel();
- res = ubox_stop_record(hdl);
- if (res != 0)
- m_dis.InsertString(m_dis.GetCount(), "stop recorder file failed");
- if (pLine->fpstream)
- {
- WORD fmt = WAVE_FORMAT_ALAW; //WAVE_FORMAT_MULAW WAVE_FORMAT_PCM
- fseek(pLine->fpstream, 0, SEEK_END);
- long filesize = ftell(pLine->fpstream);
- fseek(pLine->fpstream, 0, SEEK_SET);
- WaveFileHeader pcmWavHeader(filesize - sizeof(WaveFileHeader), fmt);
- int res = fwrite((const char*)&pcmWavHeader, sizeof(pcmWavHeader), 1, pLine->fpstream);
- if (res != 1)
- {
- m_dis.InsertString(m_dis.GetCount(), "write file head failed");
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- fclose(pLine->fpstream);
- pLine->fpstream = NULL;
- }
- }
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- void CUPhoneBoxDlg::OnWriteeeprom()
- {
- // TODO: Add your command handler code here
- // TODO: Add your command handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_ID(m_iClickItemID);
- int res;
- if (pLine)
- {
- UBOX_HANDLE hdl = pLine->line_handel();
- unsigned char data[8] = { 170, 2, 3, 4, 98, 6, 7, 255 }; //1->0x1 255->0xFF data[i]<256;
- res = ubox_write_eeprom(hdl, 0, data, 8); //data [0,255]
- if (res != 0)
- m_dis.InsertString(m_dis.GetCount(), "read eepromex data failed");
- else
- {
- m_dis.InsertString(m_dis.GetCount(), "write data ok");
- }
- }
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- void CUPhoneBoxDlg::OnSetBusyTone()
- {
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_ID(m_iClickItemID);
- if (pLine)
- {
- long hdl = pLine->line_handel();
- CSetBusyToneDlg Dlg;
- if (Dlg.DoModal() == IDOK)
- {
- tagBusyInfo busyinfo;
- busyinfo.busy_dual_frequency = Dlg.m_bDualTone ? 1 : 0;
- busyinfo.busy_frequency0 = Dlg.m_lFrequency0;
- busyinfo.busy_frequency1 = Dlg.m_Frequencey1;
- busyinfo.busy_on = Dlg.m_lBusyOn / 10;
- busyinfo.busy_off = Dlg.m_lBusyOff / 10;
- busyinfo.busy_on_off_error = Dlg.m_lTimeError / 10;
- busyinfo.busy_enery_gate = Dlg.m_lBusyEnergy;
- busyinfo.busy_period_count = Dlg.m_lBusyCount;
- ubox_set_busy_tone(hdl, busyinfo);
- }
- }
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- void CUPhoneBoxDlg::OnSetVolume()
- {
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_ID(m_iClickItemID);
- if (pLine)
- {
- long hdl = pLine->line_handel();
- CSetVolumeDlg dlg;
- if (dlg.DoModal() == IDOK)
- {
- ubox_set_Speakervolume(hdl, dlg.m_lSpkVol);
- ubox_set_volume(hdl, dlg.m_lMicVol);
- }
- }
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- void CUPhoneBoxDlg::OnGethookoffthreshold()
- {
- // TODO: Add your command handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_ID(m_iClickItemID);
- if (pLine)
- {
- char buff[100];
- UBOX_HANDLE hdl = pLine->line_handel();
- int res = ubox_get_hookoff_threshold(hdl);
- if (res > 0)
- {
- sprintf(buff, "hookoff threshold:%dV", res);
- m_dis.InsertString(m_dis.GetCount(), buff);
- }
- else
- {
- if (res == -6)
- m_dis.InsertString(m_dis.GetCount(), "this function work in configure mode");
- else
- m_dis.InsertString(m_dis.GetCount(), "get hook off threshold failed");
- }
- }
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- void CUPhoneBoxDlg::OnDblclkOpt(NMHDR* pNMHDR, LRESULT* pResult)
- {
- // TODO: Add your control notification handler code here
- m_iClickItemID = m_list.GetSelectionMark();
- PopOpt(m_iClickItemID);
- *pResult = 0;
- }
- void CUPhoneBoxDlg::PopOpt(int index)
- {
- // ClientToScreen (&(m_ClickPoint));
- CMenu TMenu;
- CMenu * pMenu;
- //CWnd
- RECT rect;
- m_list.GetWindowRect(&rect);
- if (TMenu.LoadMenu(IDR_MENU_OPT))
- {
- pMenu = TMenu.GetSubMenu(0);
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_ID(index);
- if (pMenu&& pLine)
- {
- if (pLine->get_agc())
- pMenu->CheckMenuItem(IDM_CLOSEAGC, MF_CHECKED);
- else
- pMenu->CheckMenuItem(IDM_CLOSEAGC, MF_UNCHECKED);
- if (pLine->get_buzzerSwitch())
- pMenu->CheckMenuItem(IDM_OPENBUZZER, MF_CHECKED);
- else
- pMenu->CheckMenuItem(IDM_OPENBUZZER, MF_UNCHECKED);
- if (pLine->get_MessageSwitch())
- pMenu->CheckMenuItem(IDM_OPENMSGSWITCH, MF_CHECKED);
- else
- pMenu->CheckMenuItem(IDM_OPENMSGSWITCH, MF_UNCHECKED);
- if (pLine->bplaypause)
- pMenu->CheckMenuItem(IDM_PAUSEPLAY, MF_CHECKED);
- else
- pMenu->CheckMenuItem(IDM_PAUSEPLAY, MF_UNCHECKED);
- pMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON,
- 100 + rect.left, /*m_ClickPoint.y*/100,
- this, NULL);
- }
- }
- }
- void CUPhoneBoxDlg::OnDestroy()
- {
- g_listctrlfont.DeleteObject();
- ubox_close();
- OnDisconnect();
- g_dlgphonecoming[0].DestroyWindow();
- g_dlgphonecoming[1].DestroyWindow();
- CDialog::OnDestroy();
- // TODO: Add your message handler code here
- }
- void CUPhoneBoxDlg::OnPLugInPhonicusb(UBOX_HANDLE uboxHandle)
- {
- // TODO: Add your control notification handler code here
- char str[50];
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_handle(INVALID_UBOX_HANDLE);
- if (pLine)
- {
- sprintf(str, "%d", m_list.GetItemCount() + 1);
- pLine->handl_plug_in(uboxHandle, m_list.GetItemCount());
- int nn = m_list.InsertItem(m_list.GetItemCount(), str);
- m_list.SetItemText(m_list.GetItemCount() - 1, 2, "Plug In");
- int res = ubox_get_product_ID(uboxHandle);
- if (res > 0)
- {
- CString str;
- switch (res)
- {
- case 1:
- str = "FI3102A";
- break;
- case 2:
- str = "FI3002B";
- break;
- case 3:
- str = "FI3001B";
- break;
- case 4:
- str = "FI3101A";
- break;
- default:
- str = "unkown product";
- return;
- }
- m_list.SetItemText(m_list.GetItemCount() - 1, 1, str);
- BYTE buf[16];
- memset(buf, 0, 16);
- ubox_get_usernum(uboxHandle, buf, 16);
- CString clientno = buf;
- clientno.TrimLeft();
- clientno.TrimRight();
- #ifdef NEW_DEVICE
- if (clientno.GetLength() < 8)
- {
- AfxMessageBox("硬件版本错误,请及时与经销商联系更换,对您造成的不便请谅解!电话:4006-067068 18665281860");
- return;
- }
- if (clientno.Left(8) == "02065722")
- g_bok = 1;
- else
- AfxMessageBox("硬件版本错误,请及时与经销商联系更换,对您造成的不便请谅解!电话:4006-067068 18665281860");
- #else
- g_bok = 1;
- #endif
- if (g_bok)
- m_TrayIcon.SetIcon(m_hIcon2);
- WriteLogin("设备连接OK");
- }
- }
- }
- void CUPhoneBoxDlg::OnCallIdPhonicusb(UBOX_HANDLE uboxHandle, char* callid)
- {
- // TODO: Add your control notification handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_handle(uboxHandle);
- if (pLine)
- {
- int lineID = pLine->line_id();
- CString phone = callid;
- if (phone.GetLength() > 2)
- {
- if (phone.Left(2) == "01")
- {
- if (phone.Left(3) != "010")phone.TrimLeft("0");
- }
- }
- m_list.SetItemText(lineID, 4, phone);
- g_bCallOut[lineID] = 0;
- CString strMsg = _T("");
- strMsg.Format(_T("来电线路:%d,%d, 来电号码:%s"),lineID,uboxHandle,phone);
- WriteLogin(strMsg);
- #if _DEBUG
- TRACE("来电号码:");
- TRACE(phone);
- TRACE("\n");
- #endif
- ShowClient(lineID, phone);
- }
- }
- void CUPhoneBoxDlg::OnCallOutFinishPhonicusb(UBOX_HANDLE uboxHandle)
- {
- // TODO: Add your control notification handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_handle(uboxHandle);
- if (pLine)
- {
- int lineID = pLine->line_id();
- m_list.SetItemText(lineID, 5, "CallOutFinish");
- }
- }
- //CODER_MP3
- void CUPhoneBoxDlg::OnDeviceAlarmPhonicusb(UBOX_HANDLE uboxHandle)
- {
- // TODO: Add your control notification handler code here
- // MessageBox("device alarm,please reboot software,or plug out USB device!","prompt",MB_OK);
- }
- void CUPhoneBoxDlg::OnDeviceErrorPhonicusb(UBOX_HANDLE uboxHandle)
- {
- // TODO: Add your control notification handler code here
- // MessageBox("device error,please reboot software,or plug out USB device!","prompt",MB_OK);
- }
- void GetRealNo(CString &str)
- {
- char c = '0';
- for (int i = 0; i<str.GetLength(); i++)
- {
- c = str.GetAt(i);
- if (c>'9' || c<'0')
- break;
- }
- if (c>'9' || c < '0')
- {
- int pos = str.Find(c);
- if (pos != -1)str = str.Left(pos);
- }
- /* int pos=str.Find ("*");
- if(pos!=-1)
- str=str.Left (pos);
- pos=str.Find ("#");
- if(pos!=-1)
- str=str.Left (pos);*/
- if (str.Left(1) == "1" && str.GetLength()>11)
- str = str.Left(11);
- }
- void CUPhoneBoxDlg::OnDtmfKeyPhonicusb(UBOX_HANDLE uboxHandle, char dtmfCode)
- {
- // TODO: Add your control notification handler code here clear_dtmf_key
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_handle(uboxHandle);
- if (pLine)
- {
- int lineID = pLine->line_id();
- pLine->set_dtmf_key(dtmfCode);
- CString str = pLine->get_dtmfky();
- m_list.SetItemText(lineID, 3, str);
- GetRealNo(str);
- if (str.GetLength() > 2)
- {
- if (str.Left(2) == "01")
- {
- if (str.Left(3) != "010")str.TrimLeft("0");
- }
- }
- g_phone[lineID] = str;
- }
- }
- void CUPhoneBoxDlg::OnHangIngPhonicusb(UBOX_HANDLE uboxHandle)
- {
- // TODO: Add your control notification handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_handle(uboxHandle);
- if (pLine)
- {
- int lineID = pLine->line_id();
- m_list.SetItemText(lineID, 2, "Hang");
- }
- }
- void CUPhoneBoxDlg::OnHangUpPhonicusb(UBOX_HANDLE uboxHandle)
- {
- // TODO: Add your control notification handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_handle(uboxHandle);
- if (pLine)
- {
- int lineID = pLine->line_id();
- m_list.SetItemText(lineID, 2, "Hangup");
- pLine->clear_dtmf_key();
- // if((((CButton *)GetDlgItem(IDC_AUDORECORD))->GetState()) &&pLine->brecord)
- if (pLine->brecord)
- {
- pLine->brecord = false;
- ubox_stop_record(uboxHandle);
- }
- ExitWindow(lineID, 1);
- }
- m_dis.InsertString(m_dis.GetCount(), "hang up");
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- void CUPhoneBoxDlg::OnHookOffPhonicusb(UBOX_HANDLE uboxHandle)
- {
- // TODO: Add your control notification handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_handle(uboxHandle);
- if (pLine)
- {
- int lineID = pLine->line_id();
- m_list.SetItemText(lineID, 2, "hookoff");
- // if((((CButton *)GetDlgItem(IDC_AUDORECORD))->GetState()) &&!pLine->brecord)
- if (!pLine->brecord)
- {
- pLine->brecord = true;
- autoRecordFile(uboxHandle);
- }
- }
- m_dis.InsertString(m_dis.GetCount(), "hook off");
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- void CUPhoneBoxDlg::OnLineIdlePhonicusb(UBOX_HANDLE uboxHandle)
- {
- // TODO: Add your control notification handler code here
- }
- void CUPhoneBoxDlg::OnLineVoltagePhonicusb(UBOX_HANDLE uboxHandle, long voltage)
- {
- // TODO: Add your control notification handler code here
- char buff[100];
- sprintf(buff, "line voltage:%d V", voltage);
- m_dis.InsertString(m_dis.GetCount(), buff);
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- void CUPhoneBoxDlg::OnPlayEndPhonicusb(UBOX_HANDLE uboxHandle)
- {
- // TODO: Add your control notification handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_handle(uboxHandle);
- if (pLine)
- {
- int lineID = pLine->line_id();
- m_list.SetItemText(lineID, 5, "play end");
- }
- }
- void CUPhoneBoxDlg::OnPlayErrorPhonicusb(UBOX_HANDLE uboxHandle)
- {
- // TODO: Add your control notification handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_handle(uboxHandle);
- if (pLine)
- {
- int lineID = pLine->line_id();
- m_list.SetItemText(lineID, 5, "play error");
- }
- }
- void CUPhoneBoxDlg::OnPlugOutPhonicusb(UBOX_HANDLE uboxHandle)
- {
- // TODO: Add your control notification handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_handle(uboxHandle);
- if (pLine)
- {
- int lineID = pLine->line_id();
- m_list.SetItemText(lineID, 2, "plug out");
- pLine->handl_plug_out();
- m_TrayIcon.SetIcon(m_hIcon);
- }
- }
- void CUPhoneBoxDlg::OnPolarityPhonicusb(UBOX_HANDLE uboxHandle, long lineSign)
- {
- // TODO: Add your control notification handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_handle(uboxHandle);
- CString str;
- if (lineSign)
- str = "polarity - ";
- else
- str = "polarity + ";
- if (pLine)
- {
- int lineID = pLine->line_id();
- m_list.SetItemText(lineID, 5, str);
- }
- m_dis.InsertString(m_dis.GetCount(), str);
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- void CUPhoneBoxDlg::OnRingPhonicusb(UBOX_HANDLE uboxHandle)
- {
- // TODO: Add your control notification handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_handle(uboxHandle);
- if (pLine)
- {
- int lineID = pLine->line_id();
- m_dis.InsertString(m_dis.GetCount(), "ring");
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- m_list.SetItemText(lineID, 2, "ring");
- if (!pLine->brecord)
- {
- pLine->brecord = true;
- autoRecordFile(uboxHandle);
- }
- }
- }
- void CUPhoneBoxDlg::OnRingCancelPhonicusb(UBOX_HANDLE uboxHandle)
- {
- // TODO: Add your control notification handler code here UBOX_EVENT_STREAM_VOICE
- #if _DEBUG
- TRACE("振铃取消\n");
- #endif
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_handle(uboxHandle);
- if (pLine)
- {
- int lineID = pLine->line_id();
- m_list.SetItemText(lineID, 2, "Miss call");
- if (pLine->brecord)
- {
- pLine->brecord = false;
- ubox_stop_record(uboxHandle);
- }
- ExitWindow(lineID, 0);
- }
- }
- void CUPhoneBoxDlg::OnRingStopPhonicusb(UBOX_HANDLE uboxHandle)
- {
- // TODO: Add your control notification handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_handle(uboxHandle);
- if (pLine)
- {
- int lineID = pLine->line_id();
- m_list.SetItemText(lineID, 2, "ring stop");
- }
- }
- void CUPhoneBoxDlg::OnStreamVoicePhonicusb(UBOX_HANDLE uboxHandle, char* pVoice, long len)
- {
- // TODO: Add your control notification handler code here ubox_record_file
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_handle(uboxHandle);
- if (pLine)
- {
- if (pLine->fpstream)
- {
- int res = fwrite(pVoice, sizeof(char), len, pLine->fpstream);
- if (res != len)
- {
- m_dis.InsertString(m_dis.GetCount(), "stream data write file failed");
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- }
- }
- }
- void CUPhoneBoxDlg::OnToneBusyPhonicusb(UBOX_HANDLE uboxHandle)
- {
- // TODO: Add your control notification handler code here
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_handle(uboxHandle);
- if (pLine)
- {
- int lineID = pLine->line_id();
- m_list.SetItemText(lineID, 5, "tone busy");
- int res = ubox_get_product_ID(uboxHandle);
- if ((res == 1) || (res == 4))
- ubox_soft_hook_on(uboxHandle);
- }
- m_dis.InsertString(m_dis.GetCount(), "tone busy");
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- void CUPhoneBoxDlg::autoRecordFile(UBOX_HANDLE hdl)
- {
- char filename[MAX_PATH * 2];
- SYSTEMTIME nowTime;
- ::GetLocalTime(&nowTime);
- sprintf(filename, "%s\\%sline-%d-%04d-%02d-%02d-%02d-%02d-%02d-%03d.mp3",
- strPath, RECOED_DIR,
- hdl, nowTime.wYear, nowTime.wMonth, nowTime.wDay,
- nowTime.wHour, nowTime.wMinute, nowTime.wSecond,
- nowTime.wMilliseconds);
- try
- {
- if (ubox_record_file(hdl, filename, CODER_MP3) != 0)
- {
- m_dis.InsertString(m_dis.GetCount(), "auto record file faild");
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- else
- {
- CUBoxLine* pLine = NULL;
- pLine = get_line_by_handle(hdl);
- if (pLine)
- {
- int lineID = pLine->line_id();
- g_recordpath[lineID] = filename;
- }
- }
- }
- catch (...)
- {
- WriteLogin("保存录音文件时出错");
- }
- }
- void CALLBACK ProcPhonicCallBack(
- UBOX_HANDLE uboxHnd //设备句柄
- , int eventID //事件,参考UBOX_EVENT的定义
- , unsigned long param1 //下面几个参数不同的事件,其含义不同
- , unsigned long param2
- , unsigned long param3
- , unsigned long param4
- )
- {
- if (pusb)
- {
- pusb->handle_event(uboxHnd, eventID, param1, param2, param3, param4);
- }
- }
- void CUPhoneBoxDlg::handle_event(
- UBOX_HANDLE uboxHnd
- , int eventID //事件,参考UBOX_EVENT的定义
- , unsigned long param1 //下面几个参数不同的事件,其含义不同
- , unsigned long param2
- , unsigned long param3
- , unsigned long param4)
- {
- //CString ss;
- //ss.Format("线路句柄:%d,事件ID:%d", uboxHnd,eventID);
- //WriteLogin(ss);
- switch (eventID)
- {
- case UBOX_EVENT_DEVICE_PLUG_OUT: //检测到设备拔出,
- {
- OnPlugOutPhonicusb(uboxHnd);
- CString strMsg = _T("");
- strMsg.Format(_T("检测到设备拔出,线路句柄:%d"),uboxHnd);
- WriteLogin(strMsg);
- #if _DEBUG
- TRACE("检测到设备拔出\n");
- #endif
- }
- break;
- case UBOX_EVENT_LINE_RESET: //复位:摘机->挂机,振铃->停振 硬件LED灭 已经将该事件分为两个挂机和停振事件
- {
- CString strMsg = _T("");
- strMsg.Format(_T("复位:摘机->挂机,振铃->停振,线路句柄:%d"),uboxHnd);
- WriteLogin(strMsg);
- #if _DEBUG
- TRACE("复位:摘机->挂机,振铃->停振\n");
- #endif
- }
- break;
- case UBOX_EVENT_LINE_RINGING: //振铃,硬件LED亮 11
- {
- OnRingPhonicusb(uboxHnd);
- CString strMsg = _T("");
- strMsg.Format(_T("振铃,线路句柄:%d"),uboxHnd);
- WriteLogin(strMsg);
- #if _DEBUG
- TRACE("振铃\n");
- #endif
- }
- break;
- case UBOX_EVENT_LINE_HOOK_OFF: //摘机,硬件LED亮
- {
- OnHookOffPhonicusb(uboxHnd);
- CString strMsg = _T("");
- strMsg.Format(_T("摘机,线路句柄:%d"),uboxHnd);
- WriteLogin(strMsg);
- #if _DEBUG
- TRACE("摘机\n");
- #endif
- }
- break;
- case UBOX_EVENT_LINE_HANG: //检测到线路悬空 ,默认线路电压小于3V,认为线路悬空,硬件LED闪烁
- {
- OnHangIngPhonicusb(uboxHnd);
- CString strMsg = _T("");
- strMsg.Format(_T("检测到线路悬空,线路句柄:%d"),uboxHnd);
- WriteLogin(strMsg);
- #if _DEBUG
- TRACE("检测到线路悬空\n");
- #endif
- }
- break;
- case UBOX_EVENT_STREAM_VOICE: //流式录音事件,param1是录音数据地址,需要转换,unsigned char* pvoice= (unsigned char*)param1
- {
- OnStreamVoicePhonicusb(uboxHnd, (char*)param1, param2);
- CString strMsg = _T("");
- strMsg.Format(_T("流式录音事件,线路句柄:%d"),uboxHnd);
- WriteLogin(strMsg);
- #if _DEBUG
- TRACE("流式录音事件\n");
- #endif
- }
- break;
- case UBOX_EVENT_CALLER_ID: //param1是号码地址 param2是时间地址 param3是姓名地址 param4没有用
- {
- OnCallIdPhonicusb(uboxHnd, (char*)param1);
- //CString strMsg = _T("");
- // strMsg.Format(_T("来电事件:%d,%s"),uboxHnd,(char*)param1);
- // WriteLogin("来电事件");
- #if _DEBUG
- TRACE("来电事件\n");
- #endif
- }
- break;
- case UBOX_EVENT_DTMF_DOWN: //按键事件,param1是按键键值
- {
- OnDtmfKeyPhonicusb(uboxHnd, (char)param1);
- CString strMsg = _T("");
- strMsg.Format(_T("按键事件,线路句柄:%d"),uboxHnd);
- WriteLogin(strMsg);
- #if _DEBUG
- TRACE("按键事件\n");
- #endif
- }
- break;
- case UBOX_EVENT_DTMF_UP:
- break;
- case UBOX_EVENT_ALARM: //报警,param1参照UBOX_ALARM的定义,设备工作不正常,软件退出,检查设备驱动程序是否安装好
- {
- OnDeviceAlarmPhonicusb(uboxHnd);
- CString strMsg = _T("");
- strMsg.Format(_T("报警事件,线路句柄:%d"),uboxHnd);
- WriteLogin(strMsg);
- #if _DEBUG
- TRACE("报警事件\n");
- #endif
- }
- break;
- case UBOX_EVENT_RING_CANCEL: //振铃取消,当末次振铃停止超过6秒,则触发此事件,
- {
- OnRingCancelPhonicusb(uboxHnd);
- CString strMsg = _T("");
- strMsg.Format(_T("振铃取消,线路句柄:%d"),uboxHnd);
- WriteLogin(strMsg);
- #if _DEBUG
- TRACE("振铃取消\n");
- #endif
- }
- break;
- case UBOX_EVENT_LINE_VOLTAGE: //线路电压事件,param1是线路电压值,param1不会出现等于0的电压。
- {
- OnLineVoltagePhonicusb(uboxHnd, param1);
- CString strMsg = _T("");
- strMsg.Format(_T("线路电压事件,线路句柄:%d"),uboxHnd);
- WriteLogin(strMsg);
- #if _DEBUG
- TRACE("线路电压事件\n");
- #endif
- }
- break;
- case UBOX_EVENT_DEVICE_PLUG_IN: //检测到设备插入,回调函数中param1、param2、param3、param4未使用,
- {
- OnPLugInPhonicusb(uboxHnd);
- CString strMsg = _T("");
- strMsg.Format(_T("检测到设备插入,线路句柄:%d"),uboxHnd);
- WriteLogin(strMsg);
- #if _DEBUG
- TRACE("检测到设备插入\n");
- #endif
- }
- break;
- case UBOX_EVENT_DEVICE_ERROR: //设备错误,需要软件重新启动,不然接收不到主叫号码
- {
- OnDeviceErrorPhonicusb(uboxHnd);
- CString strMsg = _T("");
- strMsg.Format(_T("设备错误,线路句柄:%d"),uboxHnd);
- WriteLogin(strMsg);
- #if _DEBUG
- TRACE("设备错误\n");
- #endif
- }
- break;
- case UBOX_EVENT_DEVICE_PLAY_END: //放音完毕
- {
- OnPlayEndPhonicusb(uboxHnd);
- CString strMsg = _T("");
- strMsg.Format(_T("放音完毕,线路句柄:%d"),uboxHnd);
- WriteLogin(strMsg);
- #if _DEBUG
- TRACE("放音完毕\n");
- #endif
- }
- break;
- case UBOX_EVENT_DEVICE_PLAY_ERROR: //放音异常
- {
- OnPlayErrorPhonicusb(uboxHnd);
- CString strMsg = _T("");
- strMsg.Format(_T("放音异常,线路句柄:%d"),uboxHnd);
- WriteLogin(strMsg);
- #if _DEBUG
- TRACE("放音异常\n");
- #endif
- }
- break;
- case UBOX_EVENT_DEVICE_BUSY_TONE: //检测到忙音,对方挂机
- {
- OnToneBusyPhonicusb(uboxHnd);
- CString strMsg = _T("");
- strMsg.Format(_T("检测到忙音,对方挂机,线路句柄:%d"),uboxHnd);
- WriteLogin(strMsg);
- #if _DEBUG
- TRACE("检测到忙音,对方挂机\n");
- #endif
- }
- break;
- case UBOX_EVENT_CALLOUTFINISH: //呼出完成,表示拨号结束
- {
- OnCallOutFinishPhonicusb(uboxHnd);
- CString strMsg = _T("");
- strMsg.Format(_T("呼出完成,表示拨号结束,线路句柄:%d"),uboxHnd);
- WriteLogin(strMsg);
- #if _DEBUG
- TRACE("呼出完成,表示拨号结束\n");
- #endif
- }
- break;
- case UBOX_EVENT_POLARITY: //检测到极性反转
- {
- OnPolarityPhonicusb(uboxHnd, param1);
- CString strMsg = _T("");
- strMsg.Format(_T("检测到极性反转,线路句柄:%d"),uboxHnd);
- WriteLogin(strMsg);
- #if _DEBUG
- TRACE("检测到极性反转\n");
- #endif
- }
- break;
- case UBOX_EVENT_LINE_HOOK_UP: //挂机
- {
- OnHangUpPhonicusb(uboxHnd);
- CString strMsg = _T("");
- strMsg.Format(_T("挂机,线路句柄:%d"),uboxHnd);
- WriteLogin(strMsg);
- #if _DEBUG
- TRACE("挂机\n");
- #endif
- }
- break;
- case UBOX_EVENT_LINE_RING_STOP: //停振 31
- {
- OnRingStopPhonicusb(uboxHnd);
- CString strMsg = _T("");
- strMsg.Format(_T("停振,线路句柄:%d"),uboxHnd);
- WriteLogin(strMsg);
- #if _DEBUG
- TRACE("停振\n");
- #endif
- }
- default:
- break;
- }
- }
- void CUPhoneBoxDlg::OnRestart()
- {
- // TODO: Add your command handler code here
- ::ubox_close();
- int i;
- for (i = 0; i < MAX_DEVICE; i++)
- ubox_device[i].handl_plug_out();
- m_list.DeleteAllItems();
- if (ubox_open(::ProcPhonicCallBack, UBOX_WORK_MODE(0)))
- {
- m_dis.InsertString(m_dis.GetCount(), "open device error");
- m_dis.SetCurSel(m_dis.GetCount() - 1);
- }
- }
- DWORD CUPhoneBoxDlg::GetConnectionID()
- {
- return m_dwConnectionID;
- }
- void CUPhoneBoxDlg::SetConnectionID(DWORD dwConnection)
- {
- m_dwConnectionID = dwConnection;
- }
- void CUPhoneBoxDlg::ProcessChatMessageRequest2(CString sql)
- {
- if (nNeedConn2)
- {
- if (OnConnect() == 0)
- {
- return;
- }
- else
- nNeedConn2 = 0;
- int aa = 100;
- while (m_dwConnectionID == INVALID_SOCKET)
- {
- ::Sleep(50);
- aa--;
- if (aa == 0)break;
- }
- }
- const char *szDataBuf = sql.GetBuffer(0);
- sql.ReleaseBuffer();
- ProcessChatMessageRequest((void*)szDataBuf, strlen(szDataBuf) + 1);
- }
- void CUPhoneBoxDlg::ProcessChatMessageRequest2(BYTE code)
- {
- if (nNeedConn2)
- {
- if (OnConnect() == 0)
- {
- return;
- }
- else
- nNeedConn2 = 0;
- int aa = 100;
- while (m_dwConnectionID == INVALID_SOCKET)
- {
- ::Sleep(50);
- aa--;
- if (aa == 0)break;
- }
- }
- ProcessChatMessageRequest(&code, sizeof(BYTE));
- }
- void CUPhoneBoxDlg::ProcessChatMessageRequest2(BYTE *pData, int length)
- {
- ProcessChatMessageRequest((void*)pData, length);
- }
- BOOL CUPhoneBoxDlg::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)
- {
- g_bReturned2 = 0;
- DWORD dwFromUserID = GetConnectionID();
- WORD wMessageId = (MSG_CHATMESSAGE_REQ + 0X3FFF);
- DWORD dwDataLen = sizeof(TCHAT_MESSAGE_STRU) + nDataLen;
- BYTE *pSendData = new BYTE[dwDataLen];
- TCHAT_MESSAGE_STRU *pChatMessage = (TCHAT_MESSAGE_STRU*)pSendData;
- memset(pChatMessage, 0x00, dwDataLen);
- g_sendhead.length[98] = 987123768;
- g_sendhead.length[99] = g_nYearpos;
- memcpy(pSendData, &g_sendhead, sizeof(g_sendhead));
- pChatMessage->tCommonMsg.dwConnectionID = GetConnectionID();
- pChatMessage->tCommonMsg.wMessageId = wMessageId;
- pChatMessage->dwFromUserID = dwFromUserID;
- pChatMessage->dwToUserID = 15;
- pChatMessage->wMessageLen = nDataLen;
- memcpy(pChatMessage->byFileContent, szDataBuf, nDataLen);
- TMessageHeader tHeader = { 0 };
- tHeader.wMessageId = wMessageId;
- tHeader.dwDataLen = dwDataLen;
- BOOL bRet = 0;
- unsigned long ulSendLen = m_tClientTunnel.net_Send(&tHeader, (void *)pChatMessage, dwDataLen);
- if (ulSendLen != SOCKET_ERROR)
- {
- bRet = 1;
- }
- delete[] pSendData;
- return bRet;
- }
- BOOL CUPhoneBoxDlg::OnConnect()
- {
- OnDisconnect();
- CString strServerAddress = g_ip;
- char *szServerAddress = strServerAddress.GetBuffer(0);
- strServerAddress.ReleaseBuffer();
- /*for Client, IP and Port can be 0,
- and for Server, IP is LocalIP, and Port is Listening Port*/
- int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
- 0,
- HandleClientNetEvent2,
- this);
- if (TRANSPORT_OK != nResult)
- {
- return 0;
- }
- DWORD dwRemoteIPValue = inet_addr(szServerAddress);
- nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, g_dwCSPort);
- if (TRANSPORT_OK != nResult)
- {
- m_tClientTunnel.net_CloseSocket();
- return 0;
- }
- return ProcessLoginRequest();
- }
- void CUPhoneBoxDlg::ProcessNetEvent(int nEventType, void *pRecvMsg, DWORD dwDataLen)
- {
- if (Transport_ReadEv == nEventType)
- {
- if (NULL == pRecvMsg) return;
- TMessageHeader* pHeader = (TMessageHeader *)pRecvMsg;
- char *pDataBuf = (char *)pRecvMsg + MESSAGE_HEADER_LEN;
- WORD dwMessageID = pHeader->wMessageId;
- switch (dwMessageID)
- {
- //case MSG_LOGIN_RESP:
- case (MSG_LOGIN_RESP + 0X2FFF) :
- {
- LOGIN_RESULT_STRU tLoginResult = { 0 };
- memcpy(&tLoginResult, pDataBuf, sizeof(LOGIN_RESULT_STRU));
- ProcessLoginResponse(&tLoginResult);
- break;
- }
- case MSG_USERINFO_RESP:
- {
- TUSERLIST_INFO_STRU tUserListInfo = { 0 };
- memcpy(&tUserListInfo, pDataBuf, sizeof(TUSERLIST_INFO_STRU));
- // ProcessUserListInfoResponse(&tUserListInfo);
- break;
- }
- case MSG_LOGOUT_RESP:
- {
- TUSERLIST_INFO_STRU tUserListInfo = { 0 };
- memcpy(&tUserListInfo, pDataBuf, sizeof(TUSERLIST_INFO_STRU));
- // ProcessLogoutResponse(&tUserListInfo);
- break;
- }
- //case MSG_CHATMESSAGE_RESP:
- case (MSG_CHATMESSAGE_RESP + 0X4FFF) :
- {
- TCHAT_MESSAGE_STRU *pChatMessage = (TCHAT_MESSAGE_STRU *)pDataBuf;
- ProcessChatMessageResponse((void *)pChatMessage);
- break;
- }
- default:
- {
- break;
- }
- }
- }
- else if (Transport_CloseEv == nEventType)
- {
- SetTimer(DISCONNECT_TIMER, 0, NULL);
- }
- ///////
- }
- void CUPhoneBoxDlg::OnDisconnect()
- {
- m_tClientTunnel.net_CloseSocket();
- SetConnectionID(INVALID_SOCKET);
- }
- void CUPhoneBoxDlg::ProcessLoginResponse(void *pLoginResult)
- {
- if (NULL == pLoginResult) return;
- LOGIN_RESULT_STRU *ptLoginResult = (LOGIN_RESULT_STRU *)pLoginResult;
- DWORD dwConnectionID = ptLoginResult->tCommonMsg.dwConnectionID;
- SetConnectionID(dwConnectionID);
- BYTE byResult = ptLoginResult->byResult;
- if (LOGIN_RESULT_SUC == byResult)
- {
- }
- else
- {
- SetTimer(LOGINFAILED_TIMER, 0, NULL);
- }
- CString strCommentInfo("");
- strCommentInfo.Format("%s. 用户代号: %ld",
- ((LOGIN_RESULT_SUC == byResult) ? "登录成功" :
- (LOGIN_RESULT_MULTI == byResult) ? "重复登录" :
- (LOGIN_RESULT_NAMERROR == byResult) ? "名字不存在" :
- (LOGIN_RESULT_PWERROR == byResult) ? "密码错误" : "登录失败"),
- dwConnectionID);
- // MessageBox((CString)strCommentInfo);
- }
- CString newGUID()
- {
- CString str;
- GUID guid;
- CoInitialize(NULL);
- if (S_OK == ::CoCreateGuid(&guid))
- {
- str.Format(
- "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
- guid.Data1,
- guid.Data2,
- guid.Data3,
- guid.Data4[0], guid.Data4[1],
- guid.Data4[2], guid.Data4[3],
- guid.Data4[4], guid.Data4[5],
- guid.Data4[6], guid.Data4[7]);
- }
- CoUninitialize();
- return str.Left(28);
- }
- BOOL CUPhoneBoxDlg::ProcessLoginRequest()
- {
- WORD wMessageId = (MSG_LOGIN_REQ + 0X1FFF);
- TLOGIN_STRU tLogonInfo = { 0 };
- tLogonInfo.tCommonMsg.dwConnectionID = GetConnectionID();
- tLogonInfo.tCommonMsg.wMessageId = wMessageId;
- CString strUserName = newGUID();
- strUserName.TrimLeft();
- strUserName.TrimRight();
- strcpy(tLogonInfo.tUserInfo.szUserName, strUserName);
- strUserName.TrimLeft();
- strUserName.TrimRight();
- strcpy(tLogonInfo.tUserInfo.szUserName, strUserName);
- DWORD dwDataLen = sizeof(TLOGIN_STRU);
- TMessageHeader tHeader = { 0 };
- tHeader.wMessageId = wMessageId;
- tHeader.dwDataLen = dwDataLen;
- unsigned long ulSendLen = m_tClientTunnel.net_Send(&tHeader, (void *)&tLogonInfo, dwDataLen);
- if (ulSendLen == SOCKET_ERROR)
- {
- return 0;
- }
- return 1;
- }
- DWORD g_ncount2 = 0;
- CArray<CStringArray, CStringArray>g_List1array;
- DWORD g_nLeng = 0;
- BYTE *g_pData = NULL;
- void CUPhoneBoxDlg::ProcessChatMessageResponse(void *pResponse)
- {
- if (NULL == pResponse) return;
- TCHAT_MESSAGE_STRU *pChatMessage = (TCHAT_MESSAGE_STRU *)pResponse;
- int nMessageLen = pChatMessage->wMessageLen;
- // if(nMessageLen==0)
- // return;
- if (g_pData)delete[]g_pData; g_pData = NULL;
- g_pData = new BYTE[nMessageLen];
- memcpy(g_pData, pChatMessage->byFileContent, nMessageLen);
- memcpy(&g_sendhead, pChatMessage, sizeof(g_sendhead));
- g_nLeng = nMessageLen;
- if (nMessageLen <= sizeof(DWORD))
- {
- memcpy(&g_ncount2, pChatMessage->byFileContent, sizeof(DWORD));
- }
- g_bReturned2 = 1;
- }
- DWORD FindAppProcessID(CString path)
- {
- try
- {
- HANDLE handle = ::CreateToolhelp32Snapshot(TH32CS_SNAPALL, 0);
- PROCESSENTRY32 Info;
- Info.dwSize = sizeof(PROCESSENTRY32);
- path.MakeLower();
- if (::Process32First(handle, &Info))
- {
- do
- {
- CString ss = Info.szExeFile;
- ss.MakeLower();
- if (ss.Find(path) != -1 || (!ss.CompareNoCase(path)))
- {
- ::CloseHandle(handle);
- return Info.th32ProcessID;
- }
- } while (::Process32Next(handle, &Info));
- ::CloseHandle(handle);
- }
- return -1;
- }
- catch (...)
- {
- }
- }
- void CUPhoneBoxDlg::OnClose()
- {
- DWORD id = FindAppProcessID("AutoRunUPhoneBox.exe");
- if (id != -1)
- {
- HANDLE ProcessHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, id);
- if (ProcessHandle)TerminateProcess(ProcessHandle, 0);
- }
- CDialog::OnCancel();
- }
- void CUPhoneBoxDlg::OnAutorun() // 设置自动运行(注册表里设置启动项);
- {
- // TODO: Add your command handler code here
- g_bAutoRun = !g_bAutoRun;
- CString version = _T("Version 1.0");
- AfxGetApp()->WriteProfileInt(version, "brun", g_bAutoRun);
- TCHAR szKey[MAX_PATH];
- HKEY hKey = 0;
- DWORD disp = 0;
- lstrcpy(szKey, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
- if (g_bAutoRun)
- {
- int lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, NULL, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &disp);
- if (lResult == ERROR_SUCCESS)
- {
- TCHAR szDir[MAX_PATH];
- ::GetModuleFileName(NULL, szDir, MAX_PATH);
- lResult = RegSetValueEx(hKey, "YLGLMSGSERVER", 0, REG_SZ, (const unsigned char*)szDir, lstrlen(szDir));
- RegCloseKey(hKey);
- }
- }
- else
- {
- int lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &disp);
- if (lResult == ERROR_SUCCESS)
- {
- RegDeleteValue(hKey, "YLGLMSGSERVER");
- RegDeleteKey(hKey, "YLGLMSGSERVER");
- RegCloseKey(hKey);
- }
- }
- }
- void DataToArray(CArray<CStringArray, CStringArray>*List1array)
- {
- List1array->RemoveAll();
- if (g_nLeng == 0)return;
- if (g_sendhead.code[0])
- {
- BYTE *lpszOut = NULL;
- int nOutSize = 0;
- CLzariEx Lzari;
- Lzari.UnCompress(g_pData, g_nLeng, (const BYTE*&)lpszOut, nOutSize);
- CMemFile memfile;
- memfile.Attach(lpszOut, nOutSize);
- Lzari.Release();
- CArchive ar(&memfile, CArchive::load);
- List1array->SetSize(g_sendhead.count[0]);
- for (int ii = 0; ii < List1array->GetSize(); ii++)
- {
- List1array->ElementAt(ii).Serialize(ar);
- }
- ar.Close();
- memfile.Detach();
- }
- else
- {
- CMemFile memfile;
- memfile.Attach(g_pData, g_nLeng);
- CArchive ar(&memfile, CArchive::load);
- List1array->SetSize(g_sendhead.count[0]);
- for (int ii = 0; ii < List1array->GetSize(); ii++)
- {
- List1array->ElementAt(ii).Serialize(ar);
- }
- ar.Close();
- memfile.Detach();
- }
- }
- void DataToArray(CArray<CStringArray, CStringArray>*List1array, CArray<CStringArray, CStringArray>*List2array, CArray<CStringArray, CStringArray>*List3array)
- {
- CArray<CStringArray, CStringArray>*parray[3] = { List1array, List2array, List3array };
- DWORD bytereads = 0;
- for (int i = 0; i < 3; i++)
- {
- parray[i]->RemoveAll(); if (g_sendhead.length[i] == 0)continue;
- if (g_sendhead.code[i])
- {
- BYTE *lpszOut = NULL;
- int nOutSize = 0;
- CLzariEx Lzari;
- Lzari.UnCompress(g_pData + bytereads, g_sendhead.length[i], (const BYTE*&)lpszOut, nOutSize);
- CMemFile memfile;
- memfile.Attach(lpszOut, nOutSize);
- Lzari.Release();
- bytereads += g_sendhead.length[i];
- CArchive ar(&memfile, CArchive::load);
- parray[i]->SetSize(g_sendhead.count[i]);
- for (int ii = 0; ii < parray[i]->GetSize(); ii++)
- {
- parray[i]->ElementAt(ii).Serialize(ar);
- }
- ar.Close();
- memfile.Detach();
- }
- else
- {
- CMemFile memfile;
- memfile.Attach(g_pData + bytereads, g_sendhead.length[i]);
- bytereads += g_sendhead.length[i];
- CArchive ar(&memfile, CArchive::load);
- parray[i]->SetSize(g_sendhead.count[i]);
- for (int ii = 0; ii < parray[i]->GetSize(); ii++)
- {
- parray[i]->ElementAt(ii).Serialize(ar);
- }
- ar.Close();
- memfile.Detach();
- }
- }
- }
- void DataToArray(CArray<CStringArray, CStringArray>*List1array, CArray<CStringArray, CStringArray>*List2array, CArray<CStringArray, CStringArray>*List3array, CArray<CStringArray, CStringArray>*List4array, CArray<CStringArray, CStringArray>*List5array)
- {
- CArray<CStringArray, CStringArray>*parray[5] = { List1array, List2array, List3array, List4array, List5array };
- DWORD bytereads = 0;
- for (int i = 0; i < 5; i++)
- {
- parray[i]->RemoveAll(); if (g_sendhead.length[i] == 0)continue;
- if (g_sendhead.code[i])
- {
- BYTE *lpszOut = NULL;
- int nOutSize = 0;
- CLzariEx Lzari;
- Lzari.UnCompress(g_pData + bytereads, g_sendhead.length[i], (const BYTE*&)lpszOut, nOutSize);
- CMemFile memfile;
- memfile.Attach(lpszOut, nOutSize);
- Lzari.Release();
- bytereads += g_sendhead.length[i];
- CArchive ar(&memfile, CArchive::load);
- parray[i]->SetSize(g_sendhead.count[i]);
- for (int ii = 0; ii < parray[i]->GetSize(); ii++)
- {
- parray[i]->ElementAt(ii).Serialize(ar);
- }
- ar.Close();
- memfile.Detach();
- }
- else
- {
- CMemFile memfile;
- memfile.Attach(g_pData + bytereads, g_sendhead.length[i]);
- bytereads += g_sendhead.length[i];
- CArchive ar(&memfile, CArchive::load);
- parray[i]->SetSize(g_sendhead.count[i]);
- for (int ii = 0; ii < parray[i]->GetSize(); ii++)
- {
- parray[i]->ElementAt(ii).Serialize(ar);
- }
- ar.Close();
- memfile.Detach();
- }
- }
- }
- BOOL FindArray(CStringArray &array, CString str)
- {
- for (int i = 0; i < array.GetSize(); i++)
- {
- if (array.ElementAt(i) == str)return 1;
- }
- return 0;
- }
- BOOL nNeedConn2 = 1;//数据库服务器
- // 获取数据库数据; yearpos = 0 表示的是db数据库;
- void GetListData(BYTE code, CArray<CStringArray, CStringArray>*pListarray1, CString filter, int yearpos, int mode)
- {
- pListarray1->RemoveAll();
- int arraypos = 0;
- switch (code)
- {
- case 80:
- arraypos = 0;
- break;
- case 90:
- arraypos = 1;
- break;
- case 11:
- arraypos = 2;
- break;
- case 138:
- arraypos = 3;
- break;
- case 24:
- arraypos = 4;
- break;
- case 181:
- arraypos = 5;
- break;
- case 65:
- arraypos = 6;
- break;
- case 56:
- arraypos = 7;
- break;
- case 179:
- arraypos = 8;
- break;
- case 53:
- arraypos = 9;
- break;
- }
- CArray<CStringArray, CStringArray>*pListarraySrc = &(g_arraydata[yearpos][arraypos]);
- if (pListarraySrc == NULL)return;
- int size = 0;
- for (int i = 0; i < pListarraySrc->GetSize(); i++)
- {
- if (filter != "")
- {
- if (code == 80)
- {
- if (pListarraySrc->ElementAt(i).ElementAt(4).Find(filter) == -1)continue;
- }
- else if (code == 90)
- {
- if (pListarraySrc->ElementAt(i).ElementAt(3).Find(filter) == -1)continue;
- }
- else if (code == 11)
- {
- if (mode == 0)
- {
- if (pListarraySrc->ElementAt(i).ElementAt(61).Find(filter) == -1 && pListarraySrc->ElementAt(i).ElementAt(62).Find(filter) == -1)continue;
- }
- else if (mode == 1)
- {
- if (pListarraySrc->ElementAt(i).ElementAt(0) != filter)continue;
- }
- }
- else if (code == 138)
- {
- if (pListarraySrc->ElementAt(i).ElementAt(3).Find(filter) == -1 && pListarraySrc->ElementAt(i).ElementAt(4).Find(filter) == -1)continue;
- }
- else if (code == 56)
- {
- if (pListarraySrc->ElementAt(i).ElementAt(22) != filter)continue;
- if (pListarraySrc->ElementAt(i).ElementAt(20) == "5")continue;
- if (pListarraySrc->ElementAt(i).ElementAt(0) == "入册")continue;
- if (pListarraySrc->ElementAt(i).ElementAt(0) == "入底")continue;
- }
- else if (code == 181)
- {
- if (pListarraySrc->ElementAt(i).ElementAt(0) != filter)continue;
- }
- else if (code == 65)
- {
- CString m_phone, datetime;
- int pos = filter.Find("\r\n");
- if (pos == -1)return;
- m_phone = filter.Left(pos);
- datetime = filter.Right(filter.GetLength() - pos - 2);
- if (pListarraySrc->ElementAt(i).ElementAt(0).Find(m_phone) == -1)continue;
- if (pListarraySrc->ElementAt(i).ElementAt(2).Find(datetime) == -1)continue;
- }
- else if (code == 179)
- {
- //if(pListarraySrc->ElementAt(i).ElementAt(0)!=filter)continue;
- }
- else if (code == 53)
- {
- if (pListarraySrc->ElementAt(i).ElementAt(2) != filter)continue;
- }
- pListarray1->SetSize(size + 1, 1);
- pListarray1->ElementAt(size).Copy(pListarraySrc->ElementAt(i));
- size++;
- }
- else
- {
- pListarray1->SetSize(size + 1, 1);
- pListarray1->ElementAt(size).Copy(pListarraySrc->ElementAt(i));
- size++;
- }
- }
- }
- UINT ShowClientThread(DWORD wParam)
- {
- if (g_bok == 0)return 0;
- if (::GetTickCount() - g_tick < 1000) return 0;
- g_tick = ::GetTickCount();
- CUPhoneBoxDlg *pdlg = g_pMainWnd;
- int idpos = int(wParam);
- yearposarray[idpos].RemoveAll();
- idarray[idpos].RemoveAll();
- CArray<CStringArray, CStringArray>Listarray1;
- CArray<CStringArray, CStringArray>Listarray2;
- CArray<CStringArray, CStringArray>Listarray3;//意向客户
- CArray<CStringArray, CStringArray>Listarray4;//老客户
- CString phone = g_phone[idpos];
- CString addareaphone = "%" + phone;
- int i;
- CString str, filter, sql;
- BYTE *pData;
- int failcount = 0;
- ll: if (failcount>3)return 0;
- GetListData(80, &Listarray2, phone, 0, 0);
- GetListData(90, &Listarray3, phone, 0, 0);
- GetListData(11, &Listarray1, phone, 0, 0);
- GetListData(138, &Listarray4, phone, 0, 0);
- GetListData(24, &g_cominfoarray, "", 0, 0);
- if (g_cominfoarray.ElementAt(0).ElementAt(46) == "2" || g_cominfoarray.ElementAt(0).ElementAt(46) == "3" || g_cominfoarray.ElementAt(0).ElementAt(46) == "6" || g_cominfoarray.ElementAt(0).ElementAt(46) == "7")
- g_bChildVersion = 1;
- if (atoi(g_cominfoarray.ElementAt(0).ElementAt(117)))//新摄控本
- g_bNewBooking = 1;
- for (int n = 0; n < Listarray1.GetSize(); n++)
- {
- if (FindArray(idarray[idpos], Listarray1.ElementAt(n).ElementAt(0)))
- {
- break;
- }
- idarray[idpos].Add(Listarray1.ElementAt(n).ElementAt(0));
- yearposarray[idpos].Add(g_nYearpos);
- }
- //}
- if (Listarray2.GetSize() == 0 && Listarray3.GetSize() == 0 && Listarray1.GetSize() == 0 && Listarray4.GetSize() == 0)
- {
- for (int aa = 0; aa < 2; aa++)
- {
- g_nYearpos = aa;
- GetListData(11, &Listarray1, phone, g_nYearpos + 1, 0);
- BOOL bExist = 0;
- for (int n = 0; n < Listarray1.GetSize(); n++)
- {
- if (FindArray(idarray[idpos], Listarray1.ElementAt(n).ElementAt(0)))
- {
- bExist = 1;
- break;
- }
- idarray[idpos].Add(Listarray1.ElementAt(n).ElementAt(0));
- yearposarray[idpos].Add(g_nYearpos);
- }
- if (bExist)break;
- }
- }
- else if (Listarray2.GetSize())
- {
- CLIENTINFO *p = new CLIENTINFO;
- memset(p, 0, sizeof(p));
- p->idpos = idpos;
- strcpy(p->phone, phone);
- strcpy(p->str1, Listarray2.ElementAt(0).ElementAt(1));
- strcpy(p->str2, Listarray2.ElementAt(0).ElementAt(3));
- strcpy(p->str3, Listarray2.ElementAt(0).ElementAt(2));
- g_pMainWnd->PostMessage(WM_USER + 200, (DWORD)p, 3);
- return 0;
- }
- else if (Listarray3.GetSize())//意向客户
- {
- CLIENTINFO *p = new CLIENTINFO;
- memset(p, 0, sizeof(p));
- p->idpos = idpos;
- strcpy(p->phone, phone);
- strcpy(p->str1, Listarray3.ElementAt(0).ElementAt(1));
- strcpy(p->str2, Listarray3.ElementAt(0).ElementAt(2));
- strcpy(p->str3, Listarray3.ElementAt(0).ElementAt(5));
- strcpy(p->str4, Listarray3.ElementAt(0).ElementAt(4));
- strcpy(p->str5, Listarray3.ElementAt(0).ElementAt(8));
- g_pMainWnd->PostMessage(WM_USER + 200, (DWORD)p, 2);
- return 0;
- }
- else if (Listarray4.GetSize())//老客户
- {
- CLIENTINFO *p = new CLIENTINFO;
- memset(p, 0, sizeof(p));
- p->idpos = idpos;
- strcpy(p->phone, phone);
- g_pMainWnd->PostMessage(WM_USER + 200, (DWORD)p, 4);
- return 0;
- }
- if (idarray[idpos].GetSize() == 0)
- {
- CLIENTINFO *p = new CLIENTINFO;
- memset(p, 0, sizeof(p));
- p->idpos = idpos;
- strcpy(p->phone, phone);
- g_pMainWnd->PostMessage(WM_USER + 200, (DWORD)p, 1);
- return 0;
- }
- CLIENTINFO *p = new CLIENTINFO;
- memset(p, 0, sizeof(p));
- p->idpos = idpos;
- strcpy(p->phone, phone);
- g_pMainWnd->PostMessage(WM_USER + 200, (DWORD)p, 0);
- return 0;
- }
- UINT SaveThread(DWORD wParam)
- {
- if (g_bok == 0)return 0;
- CUPhoneBoxDlg *pdlg = g_pMainWnd;
- int idpos = int(wParam);
- CString phone = g_phone[idpos];
- if (phone.GetLength() < 3)return 1;
- CString m_frompath = g_recordpath[idpos]; g_recordpath[idpos].Empty();
- if (::PathFileExists(m_frompath) == 0)return 1;
- CString m_savepath;
- g_phone[idpos] = "";
- yearposarray[idpos].RemoveAll();
- idarray[idpos].RemoveAll();
- CArray<CStringArray, CStringArray>Listarray1;
- CArray<CStringArray, CStringArray>Listarray2;
- CArray<CStringArray, CStringArray>Listarray3;
- CArray<CStringArray, CStringArray>Listarray4;
- int i;
- CString str, filter, sql;
- BYTE *pData;
- int failcount = 0;
- ll: if (failcount > 3)return 0;
- GetListData(80, &Listarray2, phone, 0, 0);
- GetListData(90, &Listarray3, phone, 0, 0);
- GetListData(138, &Listarray4, phone, 0, 0);
- if (Listarray2.GetSize() == 0 && Listarray3.GetSize() == 0 && Listarray4.GetSize() == 0)
- {
- for (int aa = -1; aa < 3; aa++)
- {
- g_nYearpos = aa;
- GetListData(11, &Listarray1, phone, g_nYearpos + 1, 0);
- BOOL bExist = 0;
- for (int n = 0; n < Listarray1.GetSize(); n++)
- {
- if (FindArray(idarray[idpos], Listarray1.ElementAt(n).ElementAt(0)))
- {
- bExist = 1;
- break;
- }
- idarray[idpos].Add(Listarray1.ElementAt(n).ElementAt(0));
- yearposarray[idpos].Add(g_nYearpos);
- }
- if (bExist)break;
- if (idarray[idpos].GetSize())break;//只选一条
- }
- }
- else if (Listarray2.GetSize())
- {
- CString name = Listarray2.ElementAt(0).ElementAt(1);
- CString datetime = CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S");
- CString sql;
- sql.Format("insert into [employeephonerecordout]([name],[phoneno],[datetime])values(\
- '%s','%s','%s')", name, phone, datetime);
- g_sendhead.bsql = 1;
- g_nYearpos = -1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);
- for (i = 0; i < 20; i++)
- {
- if (g_bReturned2)break;
- ::Sleep(500);
- }
- if (i >= 20)
- {
- return 1;
- }
- datetime.Replace(":", "");
- ::CreateDirectory("\\\\" + g_server2 + "\\电话录音(管理软件)$\\员工电话(拨出)", NULL);
- ::CreateDirectory("\\\\" + g_server2 + "\\电话录音(管理软件)$\\员工电话(拨出)\\" + name, NULL);
- m_savepath = "\\\\" + g_server2 + "\\电话录音(管理软件)$\\员工电话(拨出)\\" + name + "\\" + datetime + ".mp3";
- try
- {
- if (::PathFileExists(m_frompath))
- {
- ::CopyFile(m_frompath, m_savepath, 0);
- }
- ::DeleteFile(m_frompath);
- }
- catch (...)
- {
- WriteLogin("保存录音文件时出错1");
- }
- return 0;
- }
- else if (Listarray3.GetSize())
- {
- CString name = Listarray3.ElementAt(0).ElementAt(1);
- CString datetime = CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S");
- CString sql;
- sql.Format("insert into [client2phonerecordout]([name],[phoneno],[datetime])values(\
- '%s','%s','%s')", name, phone, datetime);
- g_sendhead.bsql = 1;
- g_nYearpos = -1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);
- for (i = 0; i < 20; i++)
- {
- if (g_bReturned2)break;
- ::Sleep(500);
- }
- if (i >= 20)
- {
- return 1;
- }
- datetime.Replace(":", "");
- ::CreateDirectory("\\\\" + g_server2 + "\\电话录音(管理软件)$\\意向客户(拨出)", NULL);
- ::CreateDirectory("\\\\" + g_server2 + "\\电话录音(管理软件)$\\意向客户(拨出)\\" + phone, NULL);
- m_savepath = "\\\\" + g_server2 + "\\电话录音(管理软件)$\\意向客户(拨出)\\" + phone + "\\" + datetime + ".mp3";
- try
- {
- if (::PathFileExists(m_frompath))
- {
- ::CopyFile(m_frompath, m_savepath, 0);
- }
- ::DeleteFile(m_frompath);
- }
- catch (...)
- {
- WriteLogin("保存录音文件时出错1");
- }
- return 0;
- }
- else if (Listarray4.GetSize())
- {
- CString name = Listarray4.ElementAt(0).ElementAt(1);
- name += ",";
- name += Listarray4.ElementAt(0).ElementAt(2);
- name.TrimRight(",");
- CString datetime = CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S");
- CString sql;
- sql.Format("insert into [client3phonerecordout]([name],[phoneno],[datetime])values(\
- '%s','%s','%s')", name, phone, datetime);
- g_sendhead.bsql = 1;
- g_nYearpos = -1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);
- for (i = 0; i < 20; i++)
- {
- if (g_bReturned2)break;
- ::Sleep(500);
- }
- if (i >= 20)
- {
- return 1;
- }
- datetime.Replace(":", "");
- ::CreateDirectory("\\\\" + g_server2 + "\\电话录音(管理软件)$\\老客户(拨出)", NULL);
- ::CreateDirectory("\\\\" + g_server2 + "\\电话录音(管理软件)$\\老客户(拨出)\\" + phone, NULL);
- m_savepath = "\\\\" + g_server2 + "\\电话录音(管理软件)$\\老客户(拨出)\\" + phone + "\\" + datetime + ".mp3";
- try
- {
- if (::PathFileExists(m_frompath))
- {
- ::CopyFile(m_frompath, m_savepath, 0);
- }
- ::DeleteFile(m_frompath);
- }
- catch (...)
- {
- WriteLogin("保存录音文件时出错1");
- }
- return 0;
- }
- if (idarray[idpos].GetSize() == 0)
- {
- CString datetime = CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S");
- CString sql;
- sql.Format("insert into [unknownphonerecordout]([phoneno],[datetime])values('%s','%s')", phone, datetime);
- g_sendhead.bsql = 1;
- g_nYearpos = -1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);
- for (i = 0; i < 20; i++)
- {
- if (g_bReturned2)break;
- ::Sleep(500);
- }
- if (i >= 20)
- {
- return 1;
- }
- datetime.Replace(":", "");
- ::CreateDirectory("\\\\" + g_server2 + "\\电话录音(管理软件)$\\未知电话(拨出)", NULL);
- ::CreateDirectory("\\\\" + g_server2 + "\\电话录音(管理软件)$\\未知电话(拨出)\\" + phone, NULL);
- m_savepath = "\\\\" + g_server2 + "\\电话录音(管理软件)$\\未知电话(拨出)\\" + phone + "\\" + datetime + ".mp3";
- try
- {
- if (::PathFileExists(m_frompath))
- {
- ::CopyFile(m_frompath, m_savepath, 0);
- }
- ::DeleteFile(m_frompath);
- }
- catch (...)
- {
- WriteLogin("保存录音文件时出错1");
- }
- return 0;
- }
- ///////订单客户
- CString m_id = idarray[idpos].ElementAt(0);
- g_nYearpos = yearposarray[idpos].ElementAt(0);
- GetListData(181, &Listarray1, m_id, g_nYearpos + 1, 0);
- if (Listarray1.GetSize())
- {
- CString m_name1 = Listarray1.ElementAt(0).ElementAt(1);
- CString m_name2 = Listarray1.ElementAt(0).ElementAt(2);
- CString name;
- if (!m_name1.IsEmpty())
- name = m_name1 + ",";
- name += m_name2;
- name.TrimRight(",");
- CString datetime = CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S");
- CString sql;
- sql.Format("insert into [phonerecordout]([name],[phoneno],[datetime])values(\
- '%s','%s','%s')", name, phone, datetime);
- g_sendhead.bsql = 1;
- g_nYearpos = -1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);
- for (i = 0; i < 20; i++)
- {
- if (g_bReturned2)break;
- ::Sleep(500);
- }
- if (i >= 20)
- {
- return 1;
- }
- datetime.Replace(":", "");
- ::CreateDirectory("\\\\" + g_server2 + "\\电话录音(管理软件)$\\客户电话(拨出)", NULL);
- ::CreateDirectory("\\\\" + g_server2 + "\\电话录音(管理软件)$\\客户电话(拨出)\\" + phone, NULL);
- m_savepath = "\\\\" + g_server2 + "\\电话录音(管理软件)$\\客户电话(拨出)\\" + phone + "\\" + datetime + ".mp3";
- try
- {
- if (::PathFileExists(m_frompath))
- {
- ::CopyFile(m_frompath, m_savepath, 0);
- }
- ::DeleteFile(m_frompath);
- }
- catch (...)
- {
- WriteLogin("保存录音文件时出错1");
- }
- return 0;
- }
- return 0;
- }
- void CUPhoneBoxDlg::ShowClient(int lineid, CString phone) // 显示客户详情;
- {
- g_dlgphonecoming[lineid].SetText(lineid, phone);
- g_dlgphonecoming[lineid].ShowWindow(SW_SHOW);
- MyLock lock("CUPhoneBoxDlgShowClient");
- if (phone.IsEmpty())return;
- if (g_phone[lineid] == phone)return;
- g_phone[lineid] = phone;
- if (g_hwnd[lineid])
- {
- #if _DEBUG
- TRACE("显示客户详情,关闭前一线路对话框\n");
- #endif
- ::PostMessage(g_hwnd[lineid], WM_USER + 111, 0, 0);
- }
- AfxBeginThread((AFX_THREADPROC)ShowClientThread, (LPVOID)lineid);
- }
- void CUPhoneBoxDlg::ExitWindow(int lineID, BOOL bSave)
- {
- WriteLogin("ExitWindow");
- g_dlgphonecoming[lineID].ShowWindow(SW_HIDE);
- if (g_bCallOut[lineID])//打出
- {
- if (bSave)
- AfxBeginThread((AFX_THREADPROC)SaveThread, (LPVOID)lineID);
- }
- else//打入
- {
- if (g_hwnd[lineID])
- {
- #if _DEBUG
- TRACE("关闭前对话框并保存\n");
- #endif
- ::PostMessage(g_hwnd[lineID], WM_USER + 111, bSave, 0);
- }
- g_phone[lineID] = "";
- }
- g_bCallOut[lineID] = 1;
- }
- extern CString g_id;
- extern CString g_name1;
- extern CString g_name2;
- void CUPhoneBoxDlg::OnTimer(UINT nIDEvent)
- {
- // TODO: Add your message handler code here and/or call default
- if (DISCONNECT_TIMER == nIDEvent)
- {
- KillTimer(nIDEvent);
- OnDisconnect();
- }
- else if (LOGINFAILED_TIMER == nIDEvent)
- {
- KillTimer(nIDEvent);
- OnDisconnect();
- }
- else if (1 == nIDEvent)
- {
- KillTimer(1);
- m_TrayIcon.Create(this, WM_ICON_NOTIFY, "客户来电显示系统", m_hIcon, IDR_MENUtray); //构造
- // ShowWindow(SW_HIDE); // 隐藏窗口
- #ifdef TEST_WINDOW
- SetTimer(2, 8000, NULL);
- #endif
- }
- else if (2 == nIDEvent)
- {
- KillTimer(2);
- g_bok = 1;
- g_bCallOut[0] = 0;
- ShowClient(0, "18665281860");//18665281860/18666532220
- SetTimer(3, 15000, NULL);
- }
- else if (3 == nIDEvent)
- {
- KillTimer(3);
- ExitWindow(0, 1);
- }
- else if (4 == nIDEvent)
- {
- KillTimer(4);
- ClientBooking(g_id, g_name1, g_name2);
- }
- else if (5 == nIDEvent)
- {
- RefreshData();
- }
- }
- void CUPhoneBoxDlg::ClientBooking(CString id, CString name1, CString name2)
- {
- int pos = GetDlgPos(0);
- if (pos == -1)return;
- g_dlgbooking[pos].m_id = id;
- g_dlgbooking[pos].m_name1 = name1;
- g_dlgbooking[pos].m_name2 = name2;
- g_dlgbooking[pos].Create(146, g_pMainWnd);
- g_dlgbooking[pos].ShowWindow(1);
- }
- void CUPhoneBoxDlg::ShowAllWindow()
- {
- }
- BOOL CheckExist(CString m_phone)
- {
- if (m_phone.IsEmpty())return 1;
- if (m_phone.Left(1) != "1")return 1;
- if (m_phone.GetLength() != 11)return 1;
- CString datetime = CTime::GetCurrentTime().Format("%Y%m%d");
- CArray<CStringArray, CStringArray>Listarray1;
- //
- datetime = datetime + "%";
- g_nYearpos = -1;
- CString filter = "phones='" + m_phone + "' and timestamp like '" + datetime + "'";
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 65;
- g_sendhead.tabcount = 1;
- g_bReturned2 = 0;
- g_pMainWnd->ProcessChatMessageRequest2(filter);
- int i;
- for ( i = 0; i < 20; i++)
- {
- if (g_bReturned2)break;
- ::Sleep(500);
- }
- if (i >= 20)
- {
- nNeedConn2 = 1;
- return 1;
- }
- DataToArray(&Listarray1);
- //
- // GetListData(65, &Listarray1, m_phone+"\r\n"+datetime, 0, 0);
- if (Listarray1.GetSize())return 1;
- return 0;
- }
- //g_headerpath
- /*
- g_sendhead.code[0]=80;
- g_sendhead.code[1]=90;
- g_sendhead.code[2]=11;
- g_sendhead.code[3]=138;
- g_sendhead.code[4]=24;
- g_sendhead.code[0]=181;
- g_sendhead.code[0]=65;
- g_sendhead.code[0]=56;
- */
- void CUPhoneBoxDlg::ReleaseData()
- {
- for (int i = 0; i < 10; i++)
- {
- for (int j = 0; j < 10; j++)
- {
- g_arraydata[i][j].RemoveAll();
- }
- }
- }
- DWORD g_length = 0;
- BOOL g_bfirst = 1;
- void CUPhoneBoxDlg::RefreshData()//从文件里获取用户数据;
- {
- int filecount = 1;
- if (g_bfirst)
- {
- filecount = 10;
- g_bfirst = 0;
- }
- CString dir = "\\\\" + g_server2 + "\\电话录音(管理软件)$";//未判断这个共享目录是否能打开;
- #if 0
- if (::PathFileExists(dir) == FALSE)
- {
- WriteLogin("共享目录:电话录音(管理软件)$ 不存在!");
- }
- #endif
- CString path1, path2;
- int i;
- for ( i = 0; i < filecount; i++)
- {
- path1.Format("%s\\uphonedata%d.dat", dir, i);//服务端文件;
- path2.Format("%s\\uphonedata%dtemp.dat", g_mainpath, i);//客户端文件;
- ::DeleteFile(path2);
- ::CopyFile(path1, path2, 0);//将path1 拷贝到 path2;
- }
- for (i = 0; i < filecount; i++)
- {
- path1.Format("%s\\uphonedata%dtemp.dat", g_mainpath, i);
- path2.Format("%s\\uphonedata%d.dat", g_mainpath, i);
- if (::PathFileExists(path1))
- {
- ::DeleteFile(path2);
- ::CopyFile(path1, path2, 0);
- }
- }
- CFile fp;
- path2.Format("%s\\uphonedata%d.dat", g_mainpath, 0);
- if (fp.Open(path2, CFile::modeRead) == 0)
- {
- return;
- }
- if (g_length == fp.GetLength())
- {
- fp.Close();
- return;
- }
- g_length = fp.GetLength();
- fp.Close();
- ReleaseData();
-
- for (i = 0; i < filecount; i++)
- {
- path2.Format("%s\\uphonedata%d.dat", g_mainpath, i);
- if (fp.Open(path2, CFile::modeRead))
- {
- BYTE code;
- DWORD length, arraysize;
- for (int j = 0; j < 10; j++)
- {
- fp.Read(&code, sizeof(BYTE));
- fp.Read(&length, sizeof(DWORD));
- fp.Read(&arraysize, sizeof(DWORD));
- if (length == 0 || arraysize == 0)
- continue;
- BYTE *pData = new BYTE[length];
- fp.Read(pData, length);
- CArray<CStringArray, CStringArray>*List1array = &(g_arraydata[i][j]);
- List1array->RemoveAll();
- if (code)
- {
- BYTE *lpszOut = NULL;
- int nOutSize = 0;
- CLzariEx Lzari;
- Lzari.UnCompress(pData, length, (const BYTE*&)lpszOut, nOutSize);
- CMemFile memfile;
- memfile.Attach(lpszOut, nOutSize);
- CArchive ar(&memfile, CArchive::load);
- List1array->SetSize(arraysize);
- for (int ii = 0; ii < List1array->GetSize(); ii++)
- {
- List1array->ElementAt(ii).Serialize(ar);
- }
- ar.Close();
- memfile.Detach();
- Lzari.Release();
- }
- else
- {
- CMemFile memfile;
- memfile.Attach(pData, length);
- CArchive ar(&memfile, CArchive::load);
- List1array->SetSize(arraysize);
- for (int ii = 0; ii < List1array->GetSize(); ii++)
- {
- List1array->ElementAt(ii).Serialize(ar);
- }
- ar.Close();
- memfile.Detach();
- }
- delete[]pData;
- }
- fp.Close();
- }
- else
- break;
- }
- }
|