1 // ------------------------------------------------
6 // Windows front end GUI, PeerCast core is not dependant on any of this.
7 // Its very messy at the moment, but then again Windows UI always is.
8 // I really don`t like programming win32 UI.. I want my borland back..
10 // (c) 2002 peercast.org
11 // ------------------------------------------------
12 // This program is free software; you can redistribute it and/or modify
13 // it under the terms of the GNU General Public License as published by
14 // the Free Software Foundation; either version 2 of the License, or
15 // (at your option) any later version.
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 // ------------------------------------------------
29 #include "win32/wsys.h"
31 #include "win32/wsocket.h"
38 #include "chkMemoryLeak.h"
39 #define DEBUG_NEW new(__FILE__, __LINE__)
44 bool shownChannels=false;
52 const char *statusStr;
79 unsigned int numRelays;
80 unsigned int totalRelays;
81 unsigned int totalListeners;
83 char ver_ex_prefix[2];
89 unsigned int lastSkipTime;
90 unsigned int lastSkipCount;
93 ListData *list_top = NULL;
94 ServentData *servent_top = NULL;
96 // --------------------------------------------------
97 // for PCRaw (connection list) start
98 WNDPROC wndOldListBox = NULL, wndOldConnListBox = NULL;
99 bool sleep_skip = false;
101 LRESULT CALLBACK ListBoxProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
107 int index = SendMessage(hwnd, LB_ITEMFROMPOINT, 0, lParam);
110 SendMessage(hwnd, LB_SETCURSEL, (DWORD)-1, 0L);
116 case WM_LBUTTONDBLCLK:
118 int index = SendMessage(hwnd, LB_ITEMFROMPOINT, 0, lParam);
121 SendMessage(guiWnd, WM_COMMAND, IDC_BUTTON8, NULL);
129 MENUITEMINFO info, separator;
133 int index = SendMessage(hwnd, LB_ITEMFROMPOINT, 0, lParam);
136 SendMessage(hwnd, LB_SETCURSEL, (DWORD)index, 1L);
140 SendMessage(hwnd, LB_SETCURSEL, (DWORD)-1, 0L);
145 hMenu = CreatePopupMenu();
147 memset(&separator, 0, sizeof(MENUITEMINFO));
148 separator.cbSize = sizeof(MENUITEMINFO);
149 separator.fMask = MIIM_ID | MIIM_TYPE;
150 separator.fType = MFT_SEPARATOR;
151 separator.wID = 8000;
153 memset(&info, 0, sizeof(MENUITEMINFO));
154 info.cbSize = sizeof(MENUITEMINFO);
155 info.fMask = MIIM_ID | MIIM_TYPE;
156 info.fType = MFT_STRING;
159 info.dwTypeData = "
\90Ø
\92f(&X)";
160 InsertMenuItem(hMenu, -1, true, &info);
162 InsertMenuItem(hMenu, -1, true, &separator);
165 info.dwTypeData = "
\8dÄ
\90¶(&P)";
166 InsertMenuItem(hMenu, -1, true, &info);
168 InsertMenuItem(hMenu, -1, true, &separator);
171 info.dwTypeData = "
\8dÄ
\90Ú
\91±(&R)";
172 InsertMenuItem(hMenu, -1, true, &info);
175 info.dwTypeData = "
\83L
\81[
\83v(&K)";
176 InsertMenuItem(hMenu, -1, true, &info);
178 InsertMenuItem(hMenu, -1, true, &separator);
181 info.dwTypeData = "
\91I
\91ð
\89ð
\8f\9c(&D)";
182 InsertMenuItem(hMenu, -1, true, &info);
185 dwID = TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RETURNCMD, pos.x, pos.y, 0, hwnd, NULL);
192 SendMessage(guiWnd, WM_COMMAND, IDC_BUTTON8, NULL);
196 SendMessage(guiWnd, WM_COMMAND, IDC_BUTTON5, NULL);
200 SendMessage(guiWnd, WM_COMMAND, IDC_BUTTON3, NULL);
204 SendMessage(guiWnd, WM_COMMAND, IDC_BUTTON9, NULL);
208 SendMessage(hwnd, LB_SETCURSEL, (DWORD)-1, 0L);
221 return CallWindowProc(wndOldListBox, hwnd, message, wParam, lParam);
224 LRESULT CALLBACK ConnListBoxProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
230 int index = SendMessage(hwnd, LB_ITEMFROMPOINT, 0, lParam);
233 SendMessage(hwnd, LB_SETCURSEL, (DWORD)-1, 0L);
245 int index = SendMessage(hwnd, LB_ITEMFROMPOINT, 0, lParam);
248 SendMessage(hwnd, LB_SETCURSEL, (DWORD)index, 1L);
252 SendMessage(hwnd, LB_SETCURSEL, (DWORD)-1, 0L);
256 hMenu = CreatePopupMenu();
258 memset(&info, 0, sizeof(MENUITEMINFO));
259 info.cbSize = sizeof(MENUITEMINFO);
260 info.fMask = MIIM_ID | MIIM_TYPE;
261 info.fType = MFT_STRING;
264 info.dwTypeData = "
\90Ø
\92f(&X)";
265 InsertMenuItem(hMenu, -1, true, &info);
268 dwID = TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RETURNCMD, pos.x, pos.y, 0, hwnd, NULL);
275 SendMessage(guiWnd, WM_COMMAND, IDC_BUTTON6, NULL);
283 return CallWindowProc(wndOldConnListBox, hwnd, message, wParam, lParam);
285 // for PCRaw (connection list) end
286 // --------------------------------------------------
287 int logID,statusID,hitID,chanID;
289 // --------------------------------------------------
290 bool getButtonState(int id)
292 return SendDlgItemMessage(guiWnd, id,BM_GETCHECK, 0, 0) == BST_CHECKED;
295 // --------------------------------------------------
296 void enableControl(int id, bool on)
298 EnableWindow(GetDlgItem(guiWnd,id),on);
301 // --------------------------------------------------
302 void enableEdit(int id, bool on)
304 SendDlgItemMessage(guiWnd, id,WM_ENABLE, on, 0);
305 SendDlgItemMessage(guiWnd, id,EM_SETREADONLY, !on, 0);
307 // --------------------------------------------------
308 int getEditInt(int id)
311 SendDlgItemMessage(guiWnd, id,WM_GETTEXT, 128, (LONG)str);
314 // --------------------------------------------------
315 char * getEditStr(int id)
317 static char str[128];
318 SendDlgItemMessage(guiWnd, id,WM_GETTEXT, 128, (LONG)str);
321 // --------------------------------------------------
322 void setEditStr(int id, char *str)
324 SendDlgItemMessage(guiWnd, id,WM_SETTEXT, 0, (LONG)str);
326 // --------------------------------------------------
327 void setEditInt(int id, int v)
331 SendDlgItemMessage(guiWnd, id,WM_SETTEXT, 0, (LONG)str);
334 // --------------------------------------------------
335 void *getListBoxSelData(int id)
337 int sel = SendDlgItemMessage(guiWnd, id,LB_GETCURSEL, 0, 0);
339 return (void *)SendDlgItemMessage(guiWnd, id,LB_GETITEMDATA, sel, 0);
343 Channel *getListBoxChannel(){
344 int sel = SendDlgItemMessage(guiWnd, chanID ,LB_GETCURSEL, 0, 0);
346 ListData *ld = list_top;
351 return chanMgr->findChannelByChannelID(ld->channel_id);
360 Servent *getListBoxServent(){
361 int sel = SendDlgItemMessage(guiWnd, statusID ,LB_GETCURSEL, 0, 0);
363 ServentData *sd = servent_top;
368 return servMgr->findServentByServentID(sd->servent_id);
377 // --------------------------------------------------
378 void setButtonState(int id, bool on)
380 SendDlgItemMessage(guiWnd, id,BM_SETCHECK, on, 0);
381 SendMessage(guiWnd,WM_COMMAND,id,0);
383 // --------------------------------------------------
384 void ADDLOG(const char *str,int id,bool sel,void *data, LogBuffer::TYPE type)
390 int num = SendDlgItemMessage(guiWnd, id,LB_GETCOUNT, 0, 0);
393 SendDlgItemMessage(guiWnd, id, LB_DELETESTRING, 0, 0);
396 sjis = str; //JP-Patch
397 sjis.convertTo(String::T_SJIS); //JP-Patch
398 //int idx = SendDlgItemMessage(guiWnd, id, LB_ADDSTRING, 0, (LONG)(LPSTR)str);
399 int idx = SendDlgItemMessage(guiWnd, id, LB_ADDSTRING, 0, (LONG)(LPSTR)sjis.cstr());
400 SendDlgItemMessage(guiWnd, id, LB_SETITEMDATA, idx, (LONG)data);
403 SendDlgItemMessage(guiWnd, id, LB_SETCURSEL, num, 0);
407 if (type != LogBuffer::T_NONE)
410 OutputDebugString(str);
411 OutputDebugString("\n");
418 // --------------------------------------------------
419 void ADDLOG2(const char *fmt,va_list ap,int id,bool sel,void *data, LogBuffer::TYPE type)
422 vsprintf(str,fmt,ap);
424 ADDLOG(str,id,sel,data,type);
427 // --------------------------------------------------
428 void ADDCHAN(void *d, const char *fmt,...)
432 ADDLOG2(fmt,ap,chanID,false,d,LogBuffer::T_NONE);
435 // --------------------------------------------------
436 void ADDHIT(void *d, const char *fmt,...)
440 ADDLOG2(fmt,ap,hitID,false,d,LogBuffer::T_NONE);
443 // --------------------------------------------------
444 void ADDCONN(void *d, const char *fmt,...)
448 ADDLOG2(fmt,ap,statusID,false,d,LogBuffer::T_NONE);
455 // --------------------------------------------------
456 THREAD_PROC showConnections(ThreadInfo *thread)
459 while (thread->active)
462 /* sel = SendDlgItemMessage(guiWnd, statusID,LB_GETCURSEL, 0, 0);
463 top = SendDlgItemMessage(guiWnd, statusID,LB_GETTOPINDEX, 0, 0);
465 SendDlgItemMessage(guiWnd, statusID, LB_RESETCONTENT, 0, 0);
466 Servent *s = servMgr->servents;
469 if (s->type != Servent::T_NONE)
471 Host h = s->getHost();
473 unsigned int ip = h.ip;
474 unsigned short port = h.port;
480 unsigned int tnum = 0;
483 tnum = sys->getTime()-s->lastConnect;
485 if ((s->type == Servent::T_RELAY) || (s->type == Servent::T_DIRECT))
487 ADDCONN(s,"%s-%s-%d%c - %s - %d - %s ",
488 s->getTypeStr(),s->getStatusStr(),tnum,tdef,
490 s->syncPos,s->agent.cstr()
493 if (s->status == Servent::S_CONNECTED)
495 ADDCONN(s,"%s-%s-%d%c - %s - %d/%d",
496 s->getTypeStr(),s->getStatusStr(),tnum,tdef,
498 s->gnuStream.packetsIn,s->gnuStream.packetsOut);
500 ADDCONN(s,"%s-%s-%d%c - %s",
501 s->getTypeStr(),s->getStatusStr(),tnum,tdef,
513 SendDlgItemMessage(guiWnd, statusID,LB_SETCURSEL, sel, 0);
515 SendDlgItemMessage(guiWnd, statusID,LB_SETTOPINDEX, top, 0);*/
520 sel = SendDlgItemMessage(guiWnd, statusID,LB_GETCURSEL, 0, 0);
521 top = SendDlgItemMessage(guiWnd, statusID,LB_GETTOPINDEX, 0, 0);
523 ServentData *sd = servent_top;
531 Servent *s = servMgr->servents;
533 Channel *sel_ch = getListBoxChannel(); // for PCRaw (connection list)
537 bool foundFlg = false;
539 bool infoFlg = false;
541 bool firewalled = false;
542 unsigned int numRelays = 0;
543 unsigned int totalRelays = 0;
544 unsigned int totalListeners = 0;
546 char ver_ex_prefix[2] = {' ', ' '};
547 int ver_ex_number = 0;
551 // for PCRaw (connection list) start
552 if(sel_ch && !sel_ch->info.id.isSame(s->chanID))
557 // for PCRaw (connection list) end
559 if (s->type != Servent::T_NONE){
561 chanMgr->hitlistlock.on();
563 chl = chanMgr->findHitListByID(s->chanID);
565 ChanHit *hit = chl->hit;
567 if (hit->servent_id == s->servent_id){
568 if ((hit->numHops == 1)/* && (hit->host.ip == s->getHost().ip)*/){
571 firewalled = hit->firewalled;
572 numRelays = hit->numRelays;
573 vp_ver = hit->version_vp;
574 ver_ex_prefix[0] = hit->version_ex_prefix[0];
575 ver_ex_prefix[1] = hit->version_ex_prefix[1];
576 ver_ex_number = hit->version_ex_number;
578 totalRelays += hit->numRelays;
579 totalListeners += hit->numListeners;
584 chanMgr->hitlistlock.off();
589 if (sd->servent_id == s->servent_id){
591 if (s->thread.finish) break;
594 sd->status = s->status;
595 sd->agent = s->agent;
596 sd->h = s->getHost();
597 sd->syncpos = s->syncPos;
598 sd->tnum = (s->lastConnect) ? sys->getTime()-s->lastConnect : 0;
599 sd->typeStr = s->getTypeStr();
600 sd->statusStr = s->getStatusStr();
601 sd->infoFlg = infoFlg;
603 sd->firewalled = firewalled;
604 sd->numRelays = numRelays;
605 sd->totalRelays = totalRelays;
606 sd->totalListeners = totalListeners;
608 sd->lastSkipTime = s->lastSkipTime;
609 sd->lastSkipCount = s->lastSkipCount;
610 sd->ver_ex_prefix[0] = ver_ex_prefix[0];
611 sd->ver_ex_prefix[1] = ver_ex_prefix[1];
612 sd->ver_ex_number = ver_ex_number;
617 if (!foundFlg && (s->type != Servent::T_NONE) && !s->thread.finish){
618 ServentData *newData = new ServentData();
619 newData->next = servent_top;
620 servent_top = newData;
622 newData->servent_id = s->servent_id;
623 newData->type = s->type;
624 newData->status = s->status;
625 newData->agent = s->agent;
626 newData->h = s->getHost();
627 newData->syncpos = s->syncPos;
628 newData->tnum = (s->lastConnect) ? sys->getTime()-s->lastConnect : 0;
629 newData->typeStr = s->getTypeStr();
630 newData->statusStr = s->getStatusStr();
631 newData->infoFlg = infoFlg;
632 newData->relay = relay;
633 newData->firewalled = firewalled;
634 newData->numRelays = numRelays;
635 newData->totalRelays = totalRelays;
636 newData->totalListeners = totalListeners;
637 newData->vp_ver = vp_ver;
638 newData->lastSkipTime = s->lastSkipTime;
639 newData->lastSkipCount = s->lastSkipCount;
640 newData->ver_ex_prefix[0] = ver_ex_prefix[0];
641 newData->ver_ex_prefix[1] = ver_ex_prefix[1];
642 newData->ver_ex_number = ver_ex_number;
644 int idx = SendDlgItemMessage(guiWnd, statusID, LB_ADDSTRING, 0, (LONG)"");
645 SendDlgItemMessage(guiWnd, statusID, LB_SETITEMDATA, idx, (LONG)(newData->servent_id));
655 ServentData *prev = NULL;
658 // idxs = new int[sd_count];
661 if (!sd->flg || (sd->type == Servent::T_NONE)){
662 ServentData *next = sd->next;
670 PostMessage(GetDlgItem(guiWnd, statusID), LB_DELETESTRING, idx, 0);
671 // SendDlgItemMessage(guiWnd, statusID, LB_DELETESTRING, idx, 0);
682 if ((sel >= 0) && (diff != 0)){
683 PostMessage(GetDlgItem(guiWnd, statusID), LB_SETCURSEL, sel+diff, 0);
686 PostMessage(GetDlgItem(guiWnd, statusID), LB_SETTOPINDEX, top, 0);
688 InvalidateRect(GetDlgItem(guiWnd, statusID), NULL, FALSE);
693 // sel = SendDlgItemMessage(guiWnd, chanID,LB_GETCURSEL, 0, 0);
694 // top = SendDlgItemMessage(guiWnd, chanID,LB_GETTOPINDEX, 0, 0);
695 // SendDlgItemMessage(guiWnd, chanID, LB_RESETCONTENT, 0, 0);
697 ListData *ld = list_top;
703 Channel *c = chanMgr->channel;
708 bool foundFlg = false;
711 sjis.convertTo(String::T_SJIS);
717 if (ld->channel_id == c->channel_id){
719 if (c->thread.finish) break;
721 strncpy(ld->name, sjis, 20);
723 ld->bitRate = c->info.bitrate;
724 ld->status = c->status;
725 ld->statusStr = c->getStatusStr();
726 ld->totalListeners = c->totalListeners();
727 ld->totalRelays = c->totalRelays();
728 ld->localListeners = c->localListeners();
729 ld->localRelays = c->localRelays();
730 ld->stayConnected = c->stayConnected;
731 ld->chDisp = c->chDisp;
732 ld->bTracker = c->sourceHost.tracker;
737 if (!foundFlg && !c->thread.finish){
738 ListData *newData = new ListData();
739 newData->next = list_top;
742 newData->channel_id = c->channel_id;
743 strncpy(newData->name, sjis, 20);
744 newData->name[20] = '\0';
745 newData->bitRate = c->info.bitrate;
746 newData->status = c->status;
747 newData->statusStr = c->getStatusStr();
748 newData->totalListeners = c->totalListeners();
749 newData->totalRelays = c->totalRelays();
750 newData->localListeners = c->localListeners();
751 newData->localRelays = c->localRelays();
752 newData->stayConnected = c->stayConnected;
753 newData->chDisp = c->chDisp;
754 newData->bTracker = c->sourceHost.tracker;
756 int idx = SendDlgItemMessage(guiWnd, chanID, LB_ADDSTRING, 0, (LONG)"");
757 SendDlgItemMessage(guiWnd, chanID, LB_SETITEMDATA, idx, (LONG)(newData->channel_id));
764 ListData *prev = NULL;
767 ListData *next = ld->next;
775 SendDlgItemMessage(guiWnd, chanID, LB_DELETESTRING, idx, 0);
784 InvalidateRect(GetDlgItem(guiWnd, chanID), NULL, FALSE);
786 /* String sjis; //JP-Patch
787 sjis = c->getName(); //JP-Patch
788 sjis.convertTo(String::T_SJIS); //JP-Patch
789 strncpy(cname,sjis.cstr(),16); //JP-Patch
790 //strncpy(cname,c->getName(),16);
792 //int sec = ((c->currSPacket*c->bitrate*SPacket::DATA_LEN)/8)/(c->bitrate*1024);
793 //int k = ((c->currSPacket*SPacket::DATA_LEN))/(1024);
794 //ADDCHAN(c,"%d. %s - %d KB/s - %du - %dk",num,cname,c->bitrate,c->listeners,k);
795 //ADDCHAN(c,"%d. %s - %d kb/s - %s",c->index,cname,c->getBitrate(),c->getStatusStr());
796 ADDCHAN(c,"%s - %d kb/s - %s - %d/%d-[%d/%d] - %s",cname,c->getBitrate(),c->getStatusStr(),
797 c->totalListeners(),c->totalRelays(),c->localListeners(),c->localRelays(),c->stayConnected?"Yes":"No"); //JP-Patch
802 // SendDlgItemMessage(guiWnd, chanID,LB_SETCURSEL, sel, 0);
804 // SendDlgItemMessage(guiWnd, chanID,LB_SETTOPINDEX, top, 0);
809 bool update = ((sys->getTime() - chanMgr->lastHit) < 3)||(!shownChannels);
813 shownChannels = true;
815 sel = SendDlgItemMessage(guiWnd, hitID,LB_GETCURSEL, 0, 0);
816 top = SendDlgItemMessage(guiWnd, hitID,LB_GETTOPINDEX, 0, 0);
817 SendDlgItemMessage(guiWnd, hitID, LB_RESETCONTENT, 0, 0);
819 chanMgr->hitlistlock.on();
821 ChanHitList *chl = chanMgr->hitlist;
827 if (chl->info.match(chanMgr->searchInfo))
829 strncpy(cname,chl->info.name.cstr(),16);
831 ADDHIT(chl,"%s - %d kb/s - %d/%d",cname,chl->info.bitrate,chl->numListeners(),chl->numHits());
836 chanMgr->hitlistlock.off();
840 SendDlgItemMessage(guiWnd, hitID,LB_SETCURSEL, sel, 0);
842 SendDlgItemMessage(guiWnd, hitID,LB_SETTOPINDEX, top, 0);
849 switch (servMgr->getFirewall())
852 SendDlgItemMessage(guiWnd, IDC_EDIT4,WM_SETTEXT, 0, (LONG)"Firewalled");
854 case ServMgr::FW_UNKNOWN:
855 SendDlgItemMessage(guiWnd, IDC_EDIT4,WM_SETTEXT, 0, (LONG)"Unknown");
857 case ServMgr::FW_OFF:
858 SendDlgItemMessage(guiWnd, IDC_EDIT4,WM_SETTEXT, 0, (LONG)"Normal");
863 // sleep for 1 second .. check every 1/10th for shutdown
866 if(sleep_skip) // for PCRaw (connection list)
878 ListData *ld = list_top;
889 ServentData *sd = servent_top;
905 // --------------------------------------------------
913 char *sendStr = "GET / HTTP/1.1\n\n";
916 sock.open("taiyo",80);
917 sock.write(sendStr,strlen(sendStr));
919 LOG("Connected: %s",tmp);
920 }catch(IOException &e)
928 // ---------------------------------
929 void APICALL MyPeercastApp ::printLog(LogBuffer::TYPE t, const char *str)
931 ADDLOG(str,logID,true,NULL,t);
932 if (logFile.isOpen())
934 logFile.writeLine(str);
940 // --------------------------------------------------
941 static void setControls(bool fromGUI)
945 setEditInt(IDC_EDIT1,servMgr->serverHost.port);
946 setEditStr(IDC_EDIT3,servMgr->password);
947 setEditStr(IDC_EDIT9,chanMgr->broadcastMsg.cstr());
948 setEditInt(IDC_MAXRELAYS,servMgr->maxRelays);
950 setButtonState(IDC_CHECK11,chanMgr->broadcastMsg[0]!=0);
952 setButtonState(IDC_LOGDEBUG,(servMgr->showLog&(1<<LogBuffer::T_DEBUG))!=0);
953 setButtonState(IDC_LOGERRORS,(servMgr->showLog&(1<<LogBuffer::T_ERROR))!=0);
954 setButtonState(IDC_LOGNETWORK,(servMgr->showLog&(1<<LogBuffer::T_NETWORK))!=0);
955 setButtonState(IDC_LOGCHANNELS,(servMgr->showLog&(1<<LogBuffer::T_CHANNEL))!=0);
957 setButtonState(IDC_CHECK9,servMgr->pauseLog);
961 setButtonState(IDC_CHECK1,servMgr->autoServe);
965 // --------------------------------------------------
966 void APICALL MyPeercastApp::updateSettings()
971 void MoveControl(HWND hWnd, int cx, int cy, int y, HDWP& hDwp){
975 GetWindowRect(hWnd, &rc2);
978 ScreenToClient(guiWnd, &pos);
979 hDwp = DeferWindowPos(hDwp, hWnd, HWND_TOP,
980 pos.x,cy-y-(rc2.bottom-rc2.top),rc2.right-rc2.left,rc2.bottom-rc2.top,SWP_SHOWWINDOW);
983 void MoveControl2(HWND hWnd, int cx, int cy, int y, HDWP& hDwp){
987 GetWindowRect(hWnd, &rc);
990 ScreenToClient(guiWnd, &pos);
991 hDwp = DeferWindowPos(hDwp, hWnd, HWND_TOP,
992 pos.x,pos.y,rc.right-rc.left,cy-y,SWP_SHOWWINDOW);
995 // --------------------------------------------------
996 void MoveControls(LPARAM lParam){
998 //IDC_LIST1 3,291,291,43
999 /* CONTROL "
\97L
\8cø",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
1000 WS_TABSTOP,9,29,60,20,WS_EX_TRANSPARENT
1001 EDITTEXT IDC_EDIT1,127,18,47,12,ES_AUTOHSCROLL
1002 RTEXT "
\83|
\81[
\83g :",IDC_STATIC,107,20,18,8
1003 GROUPBOX "",IDC_STATIC,3,4,291,49
1004 PUSHBUTTON "
\90Ø
\92f",IDC_BUTTON5,67,65,43,13
1005 EDITTEXT IDC_EDIT3,127,34,47,12,ES_PASSWORD | ES_AUTOHSCROLL
1006 RTEXT "
\83p
\83X
\83\8f\81[
\83h :",IDC_STATIC,89,36,36,8
1007 PUSHBUTTON "
\8dÄ
\90¶",IDC_BUTTON8,10,65,22,13
1008 PUSHBUTTON "
\8dÄ
\90Ú
\91±",IDC_BUTTON3,41,65,24,13
1009 RTEXT "
\8dÅ
\91å
\83\8a\83\8c\81[
\90\94 :",IDC_STATIC,203,20,40,8
1010 EDITTEXT IDC_MAXRELAYS,248,18,40,14,ES_AUTOHSCROLL | ES_NUMBER
1011 PUSHBUTTON "
\83L
\81[
\83v",IDC_BUTTON9,112,65,24,13
1012 LTEXT "Peercast-VP",IDC_STATIC,21,14,39,8*/
1015 GROUPBOX "
\83\8a\83\8c\81[",IDC_GROUPBOX_RELAY,3,54,291,132
1016 LISTBOX IDC_LIST3,3,81,291,102,LBS_OWNERDRAWFIXED |
1017 LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
1018 CONTROL "DJ",IDC_CHECK11,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
1019 WS_TABSTOP,5,190,23,12
1020 EDITTEXT IDC_EDIT9,33,189,261,14,ES_AUTOHSCROLL
1021 LTEXT "
\83R
\83l
\83N
\83V
\83\87\83\93",IDC_STATIC_CONNECTION,3,214,40,8
1022 PUSHBUTTON "
\90Ø
\92f",IDC_BUTTON6,47,209,43,13
1023 LISTBOX IDC_LIST2,3,224,291,53,LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
1025 LTEXT "
\83\8d\83O",IDC_STATIC_LOG,3,282,13,8
1026 PUSHBUTTON "
\83N
\83\8a\83A",IDC_BUTTON1,35,279,25,11
1027 CONTROL "
\92â
\8e~",IDC_CHECK9,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
1028 WS_TABSTOP,60,279,30,11
1029 CONTROL "
\83f
\83o
\83b
\83O",IDC_LOGDEBUG,"Button",BS_AUTOCHECKBOX |
1030 BS_PUSHLIKE | WS_TABSTOP,127,279,32,11
1031 CONTROL "
\83G
\83\89\81[",IDC_LOGERRORS,"Button",BS_AUTOCHECKBOX |
1032 BS_PUSHLIKE | WS_TABSTOP,159,279,25,11
1033 CONTROL "
\83l
\83b
\83g
\83\8f\81[
\83N",IDC_LOGNETWORK,"Button",BS_AUTOCHECKBOX |
1034 BS_PUSHLIKE | WS_TABSTOP,185,279,35,11
1035 CONTROL "
\83`
\83\83\83\93\83l
\83\8b",IDC_LOGCHANNELS,"Button",BS_AUTOCHECKBOX |
1036 BS_PUSHLIKE | WS_TABSTOP,221,279,35,11
1037 LISTBOX IDC_LIST1,3,291,291,43,LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
1040 hDwp = BeginDeferWindowPos(15);
1041 int cx = LOWORD(lParam);
1042 int cy = HIWORD(lParam);
1044 MoveControl2(GetDlgItem(guiWnd, IDC_GROUPBOX_RELAY), cx, cy, 343, hDwp);
1045 MoveControl2(GetDlgItem(guiWnd, IDC_LIST3), cx, cy, 385, hDwp);
1047 MoveControl(GetDlgItem(guiWnd, IDC_EDIT9), cx, cy, 233, hDwp);
1048 MoveControl(GetDlgItem(guiWnd, IDC_CHECK11), cx, cy, 232, hDwp);
1049 MoveControl(GetDlgItem(guiWnd, IDC_STATIC_CONNECTION), cx, cy, 209, hDwp);
1050 MoveControl(GetDlgItem(guiWnd, IDC_BUTTON6), cx, cy, 208, hDwp);
1051 MoveControl(GetDlgItem(guiWnd, IDC_LIST2), cx, cy, 94, hDwp);
1052 MoveControl(GetDlgItem(guiWnd, IDC_STATIC_LOG), cx, cy, 72, hDwp);
1053 MoveControl(GetDlgItem(guiWnd, IDC_CHECK9), cx, cy, 71, hDwp);
1054 MoveControl(GetDlgItem(guiWnd, IDC_BUTTON1), cx, cy, 71, hDwp);
1055 MoveControl(GetDlgItem(guiWnd, IDC_LOGDEBUG), cx, cy, 71, hDwp);
1056 MoveControl(GetDlgItem(guiWnd, IDC_LOGNETWORK), cx, cy, 71, hDwp);
1057 MoveControl(GetDlgItem(guiWnd, IDC_LOGERRORS), cx, cy, 71, hDwp);
1058 MoveControl(GetDlgItem(guiWnd, IDC_LOGCHANNELS), cx, cy, 71, hDwp);
1059 MoveControl(GetDlgItem(guiWnd, IDC_LIST1), cx, cy, 3, hDwp);
1061 EndDeferWindowPos(hDwp);
1064 WINDOWPLACEMENT winPlace;
1065 bool guiFlg = false;
1067 // --------------------------------------------------
1068 LRESULT CALLBACK GUIProc (HWND hwnd, UINT message,
1069 WPARAM wParam, LPARAM lParam)
1074 LRESULT from; //
\95Ï
\8a·
\8c³
1075 LRESULT to; //
\95Ï
\8a·
\90æ
1079 { HTLEFT, HTBORDER }, //
\8d¶
\92[
\82Ì
\8d¶
\89E
\96î
\88ó
\81¨
\96î
\88ó
\82È
\82µ
1080 { HTRIGHT, HTBORDER }, //
\89E
\92[
\82Ì
\8d¶
\89E
\96î
\88ó
\81¨
\96î
\88ó
\82È
\82µ
1081 { HTTOPLEFT, HTTOP }, //
\8d¶
\8fã
\8b÷
\82Ì
\8eÎ
\82ß
\96î
\88ó
\81¨
\8fc
\96î
\88ó
1082 { HTTOPRIGHT, HTTOP }, //
\89E
\8fã
\8b÷
\82Ì
\8eÎ
\82ß
\96î
\88ó
\81¨
\8fc
\96î
\88ó
1083 { HTBOTTOMLEFT, HTBOTTOM }, //
\8d¶
\89º
\8b÷
\82Ì
\8eÎ
\82ß
\96î
\88ó
\81¨
\8fc
\96î
\88ó
1084 { HTBOTTOMRIGHT, HTBOTTOM }, //
\89E
\89º
\8b÷
\82Ì
\8eÎ
\82ß
\96î
\88ó
\81¨
\8fc
\96î
\88ó
1086 { HTBOTTOM, HTBOTTOM }
1090 bool rectflg = false;
1097 shownChannels = false;
1098 logID = IDC_LIST1; // log
1099 statusID = IDC_LIST2; // status
1100 hitID = IDC_LIST4; // hit
1101 chanID = IDC_LIST3; // channels
1103 enableControl(IDC_BUTTON8,false);
1104 enableControl(IDC_BUTTON11,false);
1105 enableControl(IDC_BUTTON10,false);
1107 peercastApp->updateSettings();
1109 if (servMgr->autoServe)
1110 setButtonState(IDC_CHECK1,true);
1111 if (servMgr->autoConnect)
1112 setButtonState(IDC_CHECK2,true);
1115 guiThread.func = showConnections;
1116 if (!sys->startThread(&guiThread))
1118 MessageBox(hwnd,"Unable to start GUI","PeerCast",MB_OK|MB_ICONERROR);
1119 PostMessage(hwnd,WM_DESTROY,0,0);
1123 SetWindowPlacement(hwnd, &winPlace);
1126 { // for PCRaw (connection list)
1129 hwndList = GetDlgItem(guiWnd, chanID);
1130 wndOldListBox = (WNDPROC)GetWindowLong(hwndList, GWL_WNDPROC);
1131 SetWindowLong(hwndList, GWL_WNDPROC, (DWORD)ListBoxProc);
1133 hwndList = GetDlgItem(guiWnd, statusID);
1134 wndOldConnListBox = (WNDPROC)GetWindowLong(hwndList, GWL_WNDPROC);
1135 SetWindowLong(hwndList, GWL_WNDPROC, (DWORD)ConnListBoxProc);
1143 case IDC_CHECK1: // start server
1144 if (getButtonState(IDC_CHECK1))
1146 //SendDlgItemMessage(hwnd, IDC_CHECK1,WM_SETTEXT, 0, (LPARAM)"Deactivate");
1148 SendDlgItemMessage(hwnd, IDC_EDIT3,WM_GETTEXT, 64, (LONG)servMgr->password);
1150 servMgr->serverHost.port = (unsigned short)getEditInt(IDC_EDIT1);
1151 servMgr->setMaxRelays(getEditInt(IDC_MAXRELAYS));
1154 enableControl(IDC_EDIT1,false);
1155 enableControl(IDC_EDIT3,false);
1156 enableControl(IDC_MAXRELAYS,false);
1157 enableControl(IDC_BUTTON8,true);
1158 enableControl(IDC_BUTTON11,true);
1159 enableControl(IDC_BUTTON10,true);
1162 servMgr->autoServe = true;
1164 setEditStr(IDC_CHECK1,"Enabled");
1168 //SendDlgItemMessage(hwnd, IDC_CHECK1,WM_SETTEXT, 0, (LPARAM)"Activate");
1170 servMgr->autoServe = false;
1172 enableControl(IDC_EDIT1,true);
1173 enableControl(IDC_EDIT3,true);
1174 enableControl(IDC_MAXRELAYS,true);
1175 enableControl(IDC_BUTTON8,false);
1176 enableControl(IDC_BUTTON11,false);
1177 enableControl(IDC_BUTTON10,false);
1179 setEditStr(IDC_CHECK1,"Disabled");
1185 case IDC_CHECK11: // DJ message
1186 if (getButtonState(IDC_CHECK11))
1188 enableControl(IDC_EDIT9,false);
1189 SendDlgItemMessage(hwnd, IDC_EDIT9,WM_GETTEXT, 128, (LONG)chanMgr->broadcastMsg.cstr());
1191 enableControl(IDC_EDIT9,true);
1192 chanMgr->broadcastMsg.clear();
1195 case IDC_LOGDEBUG: // log debug
1196 servMgr->showLog = getButtonState(wParam) ? servMgr->showLog|(1<<LogBuffer::T_DEBUG) : servMgr->showLog&~(1<<LogBuffer::T_DEBUG);
1198 case IDC_LOGERRORS: // log errors
1199 servMgr->showLog = getButtonState(wParam) ? servMgr->showLog|(1<<LogBuffer::T_ERROR) : servMgr->showLog&~(1<<LogBuffer::T_ERROR);
1201 case IDC_LOGNETWORK: // log network
1202 servMgr->showLog = getButtonState(wParam) ? servMgr->showLog|(1<<LogBuffer::T_NETWORK) : servMgr->showLog&~(1<<LogBuffer::T_NETWORK);
1204 case IDC_LOGCHANNELS: // log channels
1205 servMgr->showLog = getButtonState(wParam) ? servMgr->showLog|(1<<LogBuffer::T_CHANNEL) : servMgr->showLog&~(1<<LogBuffer::T_CHANNEL);
1207 case IDC_CHECK9: // pause log
1208 servMgr->pauseLog = getButtonState(wParam);
1210 case IDC_CHECK2: // start outgoing
1212 if (getButtonState(IDC_CHECK2))
1215 SendDlgItemMessage(hwnd, IDC_COMBO1,WM_GETTEXT, 128, (LONG)servMgr->connectHost);
1216 servMgr->autoConnect = true;
1217 //SendDlgItemMessage(hwnd, IDC_CHECK2,WM_SETTEXT, 0, (LPARAM)"Disconnect");
1218 enableControl(IDC_COMBO1,false);
1220 servMgr->autoConnect = false;
1221 //SendDlgItemMessage(hwnd, IDC_CHECK2,WM_SETTEXT, 0, (LPARAM)"Connect");
1222 enableControl(IDC_COMBO1,true);
1225 case IDC_BUTTON11: // broadcast
1227 Host sh = servMgr->serverHost;
1231 sprintf(cmd,"http://localhost:%d/admin?page=broadcast",sh.port);
1232 ShellExecute(hwnd, NULL, cmd, NULL, NULL, SW_SHOWNORMAL);
1235 MessageBox(hwnd,"Server is not currently connected.\nPlease wait until you have a connection.","PeerCast",MB_OK);
1239 case IDC_BUTTON8: // play selected
1241 Channel *c = getListBoxChannel();
1243 chanMgr->playChannel(c->info);
1247 case IDC_BUTTON7: // advanced
1248 sys->callLocalURL("admin?page=settings",servMgr->serverHost.port);
1250 case IDC_BUTTON6: // servent disconnect
1252 /* Servent *s = (Servent *)getListBoxSelData(statusID);
1254 s->thread.active = false;*/
1255 Servent *s = getListBoxServent();
1257 s->thread.active = false;
1258 s->thread.finish = true;
1263 case IDC_BUTTON5: // chan disconnect
1265 /* Channel *c = (Channel *)getListBoxSelData(chanID);
1267 c->thread.active = false;*/
1269 // Channel *c = chanMgr->findChannelByChannelID((int)getListBoxSelData(chanID));
1270 Channel *c = getListBoxChannel();
1272 c->thread.active = false;
1273 c->thread.finish = true;
1278 case IDC_BUTTON3: // chan bump
1280 /* Channel *c = (Channel *)getListBoxSelData(chanID);
1284 // Channel *c = chanMgr->findChannelByChannelID((int)getListBoxSelData(chanID));
1285 Channel *c = getListBoxChannel();
1292 case IDC_BUTTON4: // get channel
1294 ChanHitList *chl = (ChanHitList *)getListBoxSelData(hitID);
1297 if (!chanMgr->findChannelByID(chl->info.id))
1299 Channel *c = chanMgr->createChannel(chl->info,NULL);
1304 MessageBox(hwnd,"Please select a channel","PeerCast",MB_OK);
1309 case IDC_BUTTON9: //JP-EX chan keep
1311 /* Channel *c = (Channel *)getListBoxSelData(chanID);
1314 if (!c->stayConnected)
1316 //if (servMgr->getFirewall() == ServMgr::FW_OFF)
1317 c->stayConnected = true;
1320 c->stayConnected = false;
1323 // Channel *c = chanMgr->findChannelByChannelID((int)getListBoxSelData(chanID));
1324 Channel *c = getListBoxChannel();
1326 if (!c->stayConnected){
1327 c->stayConnected = true;
1329 c->stayConnected = false;
1335 case IDC_BUTTON1: // clear log
1336 SendDlgItemMessage(guiWnd, logID, LB_RESETCONTENT, 0, 0);
1337 sys->logBuf->clear(); // for PCRaw (clear log)
1340 case IDC_BUTTON2: // find
1343 SendDlgItemMessage(hwnd, IDC_EDIT2,WM_GETTEXT, 64, (LONG)str);
1344 SendDlgItemMessage(hwnd, hitID, LB_RESETCONTENT, 0, 0);
1348 chanMgr->startSearch(info);
1355 case WM_MEASUREITEM:
1356 if ((UINT) wParam==IDC_LIST3){
1357 LPMEASUREITEMSTRUCT lpMI = (LPMEASUREITEMSTRUCT)lParam;
1358 lpMI->itemHeight = 12;
1359 } else if ((UINT) wParam==IDC_LIST2){
1360 LPMEASUREITEMSTRUCT lpMI = (LPMEASUREITEMSTRUCT)lParam;
1361 lpMI->itemHeight = 12;
1365 if ((UINT) wParam==IDC_LIST3)
1367 LPDRAWITEMSTRUCT _DrawItem=(LPDRAWITEMSTRUCT)lParam;
1370 unsigned int idx = 0;
1375 if (_DrawItem->itemID == idx){
1382 if ((_DrawItem->itemState) & (ODS_SELECTED))
1384 hBrush=CreateSolidBrush(RGB(49,106,197));
1388 hBrush=CreateSolidBrush(RGB(255,255,255));
1390 FillRect(_DrawItem->hDC,&_DrawItem->rcItem,hBrush);
1391 DeleteObject(hBrush);
1394 if (ld->status == Channel::S_RECEIVING){
1395 if (ld->chDisp.status == Channel::S_RECEIVING){
1396 if (ld->chDisp.relay){
1398 SetTextColor(_DrawItem->hDC,RGB(0,255,0));
1399 SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
1402 if (ld->chDisp.numRelays){
1404 SetTextColor(_DrawItem->hDC,RGB(0,0,255));
1405 SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
1408 SetTextColor(_DrawItem->hDC,RGB(255,0,255));
1409 SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
1413 /* status unmatch */
1414 SetTextColor(_DrawItem->hDC,RGB(0,0,0));
1415 SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
1417 TextOut(_DrawItem->hDC,
1418 _DrawItem->rcItem.left,
1419 _DrawItem->rcItem.top,
1423 SetTextColor(_DrawItem->hDC,RGB(0,0,0));
1424 SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
1425 TextOut(_DrawItem->hDC,
1426 _DrawItem->rcItem.left,
1427 _DrawItem->rcItem.top,
1431 if ((_DrawItem->itemState) & (ODS_SELECTED))
1433 SetTextColor(_DrawItem->hDC,RGB(255,255,255));
1434 SetBkColor(_DrawItem->hDC,RGB(49,106,197)) ;
1436 SetTextColor(_DrawItem->hDC,RGB(0,0,0));
1437 SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
1439 if (servMgr->getFirewall() == ServMgr::FW_ON){
1440 SetTextColor(_DrawItem->hDC,RGB(255,0,0));
1441 } else if (ld->bTracker && (ld->status == Channel::S_RECEIVING)){
1442 if ((_DrawItem->itemState) & (ODS_SELECTED))
1444 SetTextColor(_DrawItem->hDC,RGB(0,255,0));
1445 SetBkColor(_DrawItem->hDC,RGB(49,106,197)) ;
1447 SetTextColor(_DrawItem->hDC,RGB(0,128,0));
1451 TextOut(_DrawItem->hDC,
1452 _DrawItem->rcItem.left + 12,
1453 _DrawItem->rcItem.top,
1456 /* sprintf(buf, "- %4dkbps -", ld->bitRate);
1457 TextOut(_DrawItem->hDC,
1458 _DrawItem->rcItem.left + 12 + 118,
1459 _DrawItem->rcItem.top,
1462 TextOut(_DrawItem->hDC,
1463 _DrawItem->rcItem.left + 12 + 118 + 80,
1464 _DrawItem->rcItem.top,
1466 strlen(ld->statusStr));
1467 sprintf(buf, "- %3d/%3d - [%3d/%3d] -", ld->totalListeners, ld->totalRelays, ld->localListeners, ld->localRelays);
1468 TextOut(_DrawItem->hDC,
1469 _DrawItem->rcItem.left + 12 + 118 + 80 + 80,
1470 _DrawItem->rcItem.top,
1473 strcpy(buf, ld->stayConnected?"YES":"NO");
1474 TextOut(_DrawItem->hDC,
1475 _DrawItem->rcItem.left + 12 + 118 + 80 + 80 + 130,
1476 _DrawItem->rcItem.top,
1479 sprintf(buf, "- %4dkbps - %s - %3d/%3d - [%3d/%3d] - %s",
1486 ld->stayConnected?"YES":"NO");
1487 TextOut(_DrawItem->hDC,
1488 _DrawItem->rcItem.left + 12 + 118,
1489 _DrawItem->rcItem.top,
1493 } else if ((UINT) wParam==IDC_LIST2) {
1494 LPDRAWITEMSTRUCT _DrawItem=(LPDRAWITEMSTRUCT)lParam;
1497 unsigned int idx = 0;
1504 if (_DrawItem->itemID == idx){
1514 sd->h.toStr(hostName);
1516 if ((_DrawItem->itemState) & (ODS_SELECTED))
1518 hBrush=CreateSolidBrush(RGB(49,106,197));
1522 hBrush=CreateSolidBrush(RGB(255,255,255));
1524 FillRect(_DrawItem->hDC,&_DrawItem->rcItem,hBrush);
1525 DeleteObject(hBrush);
1530 SetTextColor(_DrawItem->hDC,RGB(0,255,0));
1531 // SetBkColor(_DrawItem->hDC,RGB(255,255,255));
1536 SetTextColor(_DrawItem->hDC,RGB(0,0,255));
1537 // SetBkColor(_DrawItem->hDC,RGB(255,255,255));
1540 SetTextColor(_DrawItem->hDC,RGB(255,0,255));
1541 // SetBkColor(_DrawItem->hDC,RGB(255,255,255));
1546 SetTextColor(_DrawItem->hDC,RGB(0,0,0));
1547 // SetBkColor(_DrawItem->hDC,RGB(255,255,255));
1550 if (sd->lastSkipTime + 120 > sys->getTime()){
1551 SetBkColor(_DrawItem->hDC,RGB(128,128,128));
1552 if (sd->type == Servent::T_RELAY){
1553 sprintf(buf, "
\81¥(%d)",sd->lastSkipCount);
1554 TextOut(_DrawItem->hDC,
1555 _DrawItem->rcItem.left,
1556 _DrawItem->rcItem.top,
1560 SetTextColor(_DrawItem->hDC,RGB(0,0,0));
1561 sprintf(buf, "
\81¤(%d)",sd->lastSkipCount);
1562 TextOut(_DrawItem->hDC,
1563 _DrawItem->rcItem.left,
1564 _DrawItem->rcItem.top,
1569 SetBkColor(_DrawItem->hDC,RGB(255,255,255));
1570 if (sd->type == Servent::T_RELAY){
1571 TextOut(_DrawItem->hDC,
1572 _DrawItem->rcItem.left,
1573 _DrawItem->rcItem.top,
1577 SetTextColor(_DrawItem->hDC,RGB(0,0,0));
1578 SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
1579 TextOut(_DrawItem->hDC,
1580 _DrawItem->rcItem.left,
1581 _DrawItem->rcItem.top,
1587 if ((_DrawItem->itemState) & (ODS_SELECTED))
1589 SetTextColor(_DrawItem->hDC,RGB(255,255,255));
1590 SetBkColor(_DrawItem->hDC,RGB(49,106,197)) ;
1592 SetTextColor(_DrawItem->hDC,RGB(0,0,0));
1593 SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
1595 if (sd->firewalled){
1596 if (!sd->numRelays){
1597 SetTextColor(_DrawItem->hDC,RGB(255,0,0));
1599 SetTextColor(_DrawItem->hDC,RGB(255,168,0));
1604 if (sd->ver_ex_number){
1605 sprintf(buf2, "(%c%c%04d)", sd->ver_ex_prefix[0], sd->ver_ex_prefix[1], sd->ver_ex_number);
1606 } else if (sd->vp_ver){
1607 sprintf(buf2, "(VP%04d)", sd->vp_ver);
1611 if (sd->type == Servent::T_RELAY){
1612 if (sd->status == Servent::S_CONNECTED){
1613 sprintf(buf, "(%d)RELAYING-%ds - %d/%d - %s - %d - %s%s",
1616 sd->totalListeners, sd->totalRelays,
1618 sd->syncpos, sd->agent.cstr(), buf2
1621 sprintf(buf, "%s-%s-%ds - %d/%d - %s - %d - %s%s",
1622 sd->typeStr, sd->statusStr, sd->tnum,
1623 sd->totalListeners, sd->totalRelays,
1625 sd->syncpos, sd->agent.cstr(), buf2
1628 } else if (sd->type == Servent::T_DIRECT){
1629 sprintf(buf, "%s-%s-%ds - %s - %d - %s ",
1630 sd->typeStr, sd->statusStr, sd->tnum,
1632 sd->syncpos, sd->agent.cstr()
1635 if (sd->status == Servent::S_CONNECTED){
1636 sprintf(buf, "%s-%s-%ds - %s - %d/%d",
1637 sd->typeStr, sd->statusStr, sd->tnum,
1639 sd->syncpos, sd->agent.cstr()
1642 sprintf(buf, "%s-%s-%ds - %s",
1643 sd->typeStr, sd->statusStr, sd->tnum,
1648 TextOut(_DrawItem->hDC,
1649 _DrawItem->rcItem.left + 12,
1650 _DrawItem->rcItem.top,
1659 MoveControls(lParam);
1662 case WM_GETMINMAXINFO:
1664 MINMAXINFO *pmmi = (MINMAXINFO *)lParam;
1667 pmmi->ptMinTrackSize.x = 530; //
\8dÅ
\8f¬
\95\9d
1668 pmmi->ptMinTrackSize.y = 435; //
\8dÅ
\8f¬
\8d\82
1669 pmmi->ptMaxTrackSize.x = 530; //
\8dÅ
\91å
\95\9d
1670 pmmi->ptMaxTrackSize.y = 1200; //
\8dÅ
\91å
\8d\82
1675 /* case WM_NCHITTEST:
1677 LRESULT lResult; //
\83J
\81[
\83\
\83\8b\88Ê
\92u
\94»
\92è
\8c\8b\89Ê
1679 //
\95Ï
\8a·
\88ê
\97\97\82É
\82 \82ê
\82Î
\95Ï
\8a·
\82µ
\82½
\92l
\82ð
\95Ô
\82·
\81B
1680 lResult = DefWindowProc( guiWnd, message, wParam, lParam );
1681 for( int i = 0; i < 8; i++ )
1683 if ( lResult == trans[ i ].from )
1685 return trans[ i ].to;
1689 // return HTCAPTION;
1694 GetWindowPlacement(hwnd, &winPlace);
1696 DestroyWindow( hwnd );
1700 GetWindowPlacement(hwnd, &winPlace);
1702 guiThread.active = false;
1703 // guiThread.lock();
1705 // guiThread.unlock();
1706 EndDialog(hwnd, LOWORD(wParam));
1711 //return DefDlgProc(hwnd, message, wParam, lParam); // this recurses for ever
1712 //return DefWindowProc(hwnd, message, wParam, lParam); // this stops window messages