Example #1
0
void ServersComboBox::resetContents(const Host &current_host, bool caption, bool connection)
{
	setUpdatesEnabled(false);
	clear();
	int sel = -1;
	if (caption) {
		addItem(tr("MPD Servers"));
	}
	std::vector<ServerItem> servers;
	loadPresetServers(&servers);
	for (int i = 0; i < (int)servers.size(); i++) {
		int row = count();
		QString text = servers[i].name;
		addItem(text);
		setItemData(row, text);
		if (current_host == servers[i].host) {
			sel = i;
		}
	}
	if (sel < 0 && current_host.isValid()) {
		QString text = makeServerText(current_host);
		if (!text.isEmpty()) {
			sel = count();
			addItem(text);
		}
	}
	if (connection) {
		addItem(trConnect());
	}
	setCurrentIndex(sel);
	setUpdatesEnabled(true);

}
Example #2
0
QString ServersComboBox::makeServerText(const Host &host)
{
	QString name;
	name = host.address();
	if (host.isValid()) {
		if (name.indexOf(':') >= 0) {
			name = '[' + name + ']';
		}
		name += ':' + QString::number(host.port());
	}
	return name;
}
Example #3
0
QList<Host> Discover::parseProcessOutput(const QByteArray &processData)
{
    m_reader.clear();
    m_reader.addData(processData);

    QList<Host> hosts;

    while (!m_reader.atEnd() && !m_reader.hasError()) {

        QXmlStreamReader::TokenType token = m_reader.readNext();
        if(token == QXmlStreamReader::StartDocument)
            continue;

        if(token == QXmlStreamReader::StartElement && m_reader.name() == "host") {
            Host host = parseHost();
            if (host.isValid()) {
                hosts.append(host);
            }
        }
    }
    return hosts;
}
Example #4
0
// --------------------------------------------------
LRESULT CALLBACK GUIProc (HWND hwnd, UINT message,
                                 WPARAM wParam, LPARAM lParam)
{

	static const struct 
		{
			LRESULT from; // 変換元
			LRESULT to;   // 変換先
		}
	trans[] = 
		{
			{ HTLEFT,        HTBORDER }, // 左端の左右矢印 → 矢印なし
			{ HTRIGHT,       HTBORDER }, // 右端の左右矢印 → 矢印なし
			{ HTTOPLEFT,     HTTOP    }, // 左上隅の斜め矢印 → 縦矢印
			{ HTTOPRIGHT,    HTTOP    }, // 右上隅の斜め矢印 → 縦矢印
			{ HTBOTTOMLEFT,  HTBOTTOM }, // 左下隅の斜め矢印 → 縦矢印
			{ HTBOTTOMRIGHT, HTBOTTOM }, // 右下隅の斜め矢印 → 縦矢印
			{ HTTOP,         HTTOP    },
			{ HTBOTTOM,      HTBOTTOM }
		};


	bool rectflg = false;

   switch (message)
   {
       case WM_INITDIALOG:
			guiWnd = hwnd;

			shownChannels = false;
			logID = IDC_LIST1;		// log
			statusID = IDC_LIST2;	// status
			hitID = IDC_LIST4;		// hit
			chanID = IDC_LIST3;		// channels

			enableControl(IDC_BUTTON8,false);
			enableControl(IDC_BUTTON11,false);
			enableControl(IDC_BUTTON10,false);
			
			peercastApp->updateSettings();

			if (servMgr->autoServe)
				setButtonState(IDC_CHECK1,true);
			if (servMgr->autoConnect)
				setButtonState(IDC_CHECK2,true);


			guiThread.func = showConnections;
			if (!sys->startThread(&guiThread))
			{
				MessageBox(hwnd,"Unable to start GUI","PeerCast",MB_OK|MB_ICONERROR);
				PostMessage(hwnd,WM_DESTROY,0,0);
			}

			if (guiFlg){
				SetWindowPlacement(hwnd, &winPlace);
			}

			{	// for PCRaw (connection list)
				HWND hwndList;
				
				hwndList = GetDlgItem(guiWnd, chanID);
#ifndef WIN64
				wndOldListBox = (WNDPROC)GetWindowLong(hwndList, GWL_WNDPROC);
				SetWindowLong(hwndList, GWL_WNDPROC, (DWORD)ListBoxProc);

				hwndList = GetDlgItem(guiWnd, statusID);
				wndOldConnListBox = (WNDPROC)GetWindowLong(hwndList, GWL_WNDPROC);
				SetWindowLong(hwndList, GWL_WNDPROC, (DWORD)ConnListBoxProc);
#else
				wndOldListBox = (WNDPROC)GetWindowLongPtr(hwndList, GWLP_WNDPROC);
				SetWindowLongPtr(hwndList, GWLP_WNDPROC, (DWORD)ListBoxProc);

				hwndList = GetDlgItem(guiWnd, statusID);
				wndOldConnListBox = (WNDPROC)GetWindowLongPtr(hwndList, GWLP_WNDPROC);
				SetWindowLongPtr(hwndList, GWLP_WNDPROC, (DWORD)ConnListBoxProc);
#endif
			}

			break;

	  case WM_COMMAND:
			switch( wParam )
			{
				case IDC_CHECK1:		// start server
						if (getButtonState(IDC_CHECK1))
						{
							//SendDlgItemMessage(hwnd, IDC_CHECK1,WM_SETTEXT, 0, (LPARAM)"Deactivate");

							SendDlgItemMessage(hwnd, IDC_EDIT3,WM_GETTEXT, 64, (LONG)servMgr->password);

							servMgr->serverHost.port = (unsigned short)getEditInt(IDC_EDIT1);
							servMgr->setMaxRelays(getEditInt(IDC_MAXRELAYS));


							enableControl(IDC_EDIT1,false);
							enableControl(IDC_EDIT3,false);
							enableControl(IDC_MAXRELAYS,false);
							enableControl(IDC_BUTTON8,true);
							enableControl(IDC_BUTTON11,true);
							enableControl(IDC_BUTTON10,true);

							//writeSettings();
							servMgr->autoServe = true;

							setEditStr(IDC_CHECK1,"Enabled");


						}else{
							//SendDlgItemMessage(hwnd, IDC_CHECK1,WM_SETTEXT, 0, (LPARAM)"Activate");

							servMgr->autoServe = false;

							enableControl(IDC_EDIT1,true);
							enableControl(IDC_EDIT3,true);
							enableControl(IDC_MAXRELAYS,true);
							enableControl(IDC_BUTTON8,false);
							enableControl(IDC_BUTTON11,false);
							enableControl(IDC_BUTTON10,false);

							setEditStr(IDC_CHECK1,"Disabled");

						}
						setControls(true);

					break;
				case IDC_CHECK11:		// DJ message
					if (getButtonState(IDC_CHECK11))
					{
						enableControl(IDC_EDIT9,false);
						SendDlgItemMessage(hwnd, IDC_EDIT9,WM_GETTEXT, 128, (LONG)chanMgr->broadcastMsg.cstr());
					}else{
						enableControl(IDC_EDIT9,true);
						chanMgr->broadcastMsg.clear();
					}
					break;
				case IDC_LOGDEBUG:		// log debug
					servMgr->showLog = getButtonState(wParam) ? servMgr->showLog|(1<<LogBuffer::T_DEBUG) : servMgr->showLog&~(1<<LogBuffer::T_DEBUG);
					break;
				case IDC_LOGERRORS:		// log errors
					servMgr->showLog = getButtonState(wParam) ? servMgr->showLog|(1<<LogBuffer::T_ERROR) : servMgr->showLog&~(1<<LogBuffer::T_ERROR);
					break;
				case IDC_LOGNETWORK:		// log network
					servMgr->showLog = getButtonState(wParam) ? servMgr->showLog|(1<<LogBuffer::T_NETWORK) : servMgr->showLog&~(1<<LogBuffer::T_NETWORK);
					break;
				case IDC_LOGCHANNELS:		// log channels
					servMgr->showLog = getButtonState(wParam) ? servMgr->showLog|(1<<LogBuffer::T_CHANNEL) : servMgr->showLog&~(1<<LogBuffer::T_CHANNEL);
					break;
				case IDC_CHECK9:		// pause log
					servMgr->pauseLog = getButtonState(wParam);
					break;
				case IDC_CHECK2:		// start outgoing

					if (getButtonState(IDC_CHECK2))
					{

						SendDlgItemMessage(hwnd, IDC_COMBO1,WM_GETTEXT, 128, (LONG)servMgr->connectHost);
						servMgr->autoConnect = true;
						//SendDlgItemMessage(hwnd, IDC_CHECK2,WM_SETTEXT, 0, (LPARAM)"Disconnect");
						enableControl(IDC_COMBO1,false);
					}else{
						servMgr->autoConnect = false;
						//SendDlgItemMessage(hwnd, IDC_CHECK2,WM_SETTEXT, 0, (LPARAM)"Connect");
						enableControl(IDC_COMBO1,true);
					}
					break;
				case IDC_BUTTON11:		// broadcast
					{
						Host sh = servMgr->serverHost;
						if (sh.isValid())
						{
							char cmd[256];
							sprintf(cmd,"http://localhost:%d/admin?page=broadcast",sh.port);
							ShellExecute(hwnd, NULL, cmd, NULL, NULL, SW_SHOWNORMAL);
		
						}else{
							MessageBox(hwnd,"Server is not currently connected.\nPlease wait until you have a connection.","PeerCast",MB_OK);
						}
					}
					break;
				case IDC_BUTTON8:		// play selected
					{
						Channel *c = getListBoxChannel();
						if (c){
							chanMgr->playChannel(c->info);
						}
					}
					break;
				case IDC_BUTTON7:		// advanced
					sys->callLocalURL("admin?page=settings",servMgr->serverHost.port);
					break;
				case IDC_BUTTON6:		// servent disconnect
					{
/*						Servent *s = (Servent *)getListBoxSelData(statusID);
						if (s)
							s->thread.active = false;*/
						Servent *s = getListBoxServent();
						if (s){
							s->thread.active = false;
							s->thread.finish = true;
						}
						sleep_skip = true;
					}
					break;
				case IDC_BUTTON5:		// chan disconnect
					{
/*						Channel *c = (Channel *)getListBoxSelData(chanID);
						if (c)
							c->thread.active = false;*/

//						Channel *c = chanMgr->findChannelByChannelID((int)getListBoxSelData(chanID));
						Channel *c = getListBoxChannel();
						if (c){
							c->thread.active = false;
							c->thread.finish = true;
						}
						sleep_skip = true;
					}
					break;
				case IDC_BUTTON3:		// chan bump
					{
/*						Channel *c = (Channel *)getListBoxSelData(chanID);
						if (c)
							c->bump = true;*/

//						Channel *c = chanMgr->findChannelByChannelID((int)getListBoxSelData(chanID));
						Channel *c = getListBoxChannel();
						if (c){
							c->bump = true;
						}
					}

					break;
				case IDC_BUTTON4:		// get channel 
					{
						ChanHitList *chl = (ChanHitList *)getListBoxSelData(hitID);
						if (chl)
						{
							if (!chanMgr->findChannelByID(chl->info.id))
							{
								Channel *c = chanMgr->createChannel(chl->info,NULL);
								if (c)
									c->startGet();
							}
						}else{
							MessageBox(hwnd,"Please select a channel","PeerCast",MB_OK);
						}
					}
					break;

					case IDC_BUTTON9:		//JP-EX chan keep
					{
/*						Channel *c = (Channel *)getListBoxSelData(chanID);
						if (c)
						{
							if (!c->stayConnected)
							{
								//if (servMgr->getFirewall() == ServMgr::FW_OFF)
								c->stayConnected = true;
							}	
							else
								c->stayConnected = false;
						}*/

//						Channel *c = chanMgr->findChannelByChannelID((int)getListBoxSelData(chanID));
						Channel *c = getListBoxChannel();
						if (c){
							if (!c->stayConnected){
								c->stayConnected = true;
							} else {
								c->stayConnected = false;
							}
						}
					}
					break;

				case IDC_BUTTON1:		// clear log
					SendDlgItemMessage(guiWnd, logID, LB_RESETCONTENT, 0, 0);
					sys->logBuf->clear();	// for PCRaw (clear log)
					break;

				case IDC_BUTTON2:		// find
					{
						char str[64];
						SendDlgItemMessage(hwnd, IDC_EDIT2,WM_GETTEXT, 64, (LONG)str);
						SendDlgItemMessage(hwnd, hitID, LB_RESETCONTENT, 0, 0);
						ChanInfo info;
						info.init();
						info.name.set(str);
						chanMgr->startSearch(info);
					}
					break;

			}
			break;

		case WM_MEASUREITEM:
			if ((UINT) wParam==IDC_LIST3){
				LPMEASUREITEMSTRUCT lpMI = (LPMEASUREITEMSTRUCT)lParam;
				lpMI->itemHeight = 12;
			} else if ((UINT) wParam==IDC_LIST2){
				LPMEASUREITEMSTRUCT lpMI = (LPMEASUREITEMSTRUCT)lParam;
				lpMI->itemHeight = 12;
			}
			break;
		case WM_DRAWITEM:
			if  ((UINT) wParam==IDC_LIST3)
			{
				LPDRAWITEMSTRUCT _DrawItem=(LPDRAWITEMSTRUCT)lParam;
				HBRUSH   hBrush;
				ListData *ld;
				unsigned int idx = 0;
				bool flg = false;

				ld = list_top;
				while(ld){
					if (_DrawItem->itemID == idx){
						flg = true;
						break;
					}
					ld = ld->next;
					idx++;
				}
				if ((_DrawItem->itemState) & (ODS_SELECTED))
				{
					hBrush=CreateSolidBrush(RGB(49,106,197));
				}
				else  
				{
					hBrush=CreateSolidBrush(RGB(255,255,255));
				}
				FillRect(_DrawItem->hDC,&_DrawItem->rcItem,hBrush);                   
				DeleteObject(hBrush);
				if (flg){
					char buf[256];
					if (ld->status == Channel::S_RECEIVING){
						if (ld->chDisp.status == Channel::S_RECEIVING){
							if (ld->chDisp.relay){
								/* relay ok */
								SetTextColor(_DrawItem->hDC,RGB(0,255,0));
								SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
							} else {
								/* no more relay */
								if (ld->chDisp.numRelays){
									/* relay full */
									SetTextColor(_DrawItem->hDC,RGB(0,0,255));
									SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
								} else {
									/* relay ng */
									SetTextColor(_DrawItem->hDC,RGB(255,0,255));
									SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
								}
							}
						} else {
							/* status unmatch */
							SetTextColor(_DrawItem->hDC,RGB(0,0,0));
							SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
						}
						TextOut(_DrawItem->hDC,
							_DrawItem->rcItem.left,
							_DrawItem->rcItem.top,
							"■",
							2);
					} else {
						SetTextColor(_DrawItem->hDC,RGB(0,0,0));
						SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
						TextOut(_DrawItem->hDC,
								_DrawItem->rcItem.left,
								_DrawItem->rcItem.top,
								"□",
								2);
					}
					if ((_DrawItem->itemState) & (ODS_SELECTED))
					{
						SetTextColor(_DrawItem->hDC,RGB(255,255,255));
						SetBkColor(_DrawItem->hDC,RGB(49,106,197)) ;
					} else {
						SetTextColor(_DrawItem->hDC,RGB(0,0,0));
						SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
					}
					if (servMgr->getFirewall() == ServMgr::FW_ON){
						SetTextColor(_DrawItem->hDC,RGB(255,0,0));
					} else if (ld->bTracker && (ld->status == Channel::S_RECEIVING)){
						if ((_DrawItem->itemState) & (ODS_SELECTED))
						{
							SetTextColor(_DrawItem->hDC,RGB(0,255,0));
							SetBkColor(_DrawItem->hDC,RGB(49,106,197)) ;
						} else {
							SetTextColor(_DrawItem->hDC,RGB(0,128,0));
						}
					}

					TextOut(_DrawItem->hDC,
							_DrawItem->rcItem.left + 12,
							_DrawItem->rcItem.top,
							ld->name,
							strlen(ld->name));
/*					sprintf(buf, "- %4dkbps -", ld->bitRate);
					TextOut(_DrawItem->hDC,
							_DrawItem->rcItem.left + 12 + 118,
							_DrawItem->rcItem.top,
							buf,
							strlen(buf));
					TextOut(_DrawItem->hDC,
							_DrawItem->rcItem.left + 12 + 118 + 80,
							_DrawItem->rcItem.top,
							ld->statusStr,
							strlen(ld->statusStr));
					sprintf(buf, "- %3d/%3d - [%3d/%3d] -", ld->totalListeners, ld->totalRelays, ld->localListeners, ld->localRelays);
					TextOut(_DrawItem->hDC,
							_DrawItem->rcItem.left + 12 + 118 + 80 + 80,
							_DrawItem->rcItem.top,
							buf,
							strlen(buf));
					strcpy(buf, ld->stayConnected?"YES":"NO");
					TextOut(_DrawItem->hDC,
							_DrawItem->rcItem.left + 12 + 118 + 80 + 80 + 130,
							_DrawItem->rcItem.top,
							buf,
							strlen(buf));*/
					sprintf(buf, "- %4dkbps - %s - %3d/%3d - [%3d/%3d] - %s",
						ld->bitRate,
						ld->statusStr,
						ld->totalListeners,
						ld->totalRelays,
						ld->localListeners,
						ld->localRelays,
						ld->stayConnected?"YES":"NO");
					TextOut(_DrawItem->hDC,
							_DrawItem->rcItem.left + 12 + 118,
							_DrawItem->rcItem.top,
							buf,
							strlen(buf));
				}
			} else if  ((UINT) wParam==IDC_LIST2) {
				LPDRAWITEMSTRUCT _DrawItem=(LPDRAWITEMSTRUCT)lParam;
				HBRUSH   hBrush;
				ServentData *sd;
				unsigned int idx = 0;
				bool flg = false;

				sd_lock.on();

				sd = servent_top;
				while(sd){
					if (_DrawItem->itemID == idx){
						flg = true;
						break;
					}
					sd = sd->next;
					idx++;
				}
				if (flg){
					char buf[256];
					char hostName[64];
					sd->h.toStr(hostName);

					if ((_DrawItem->itemState) & (ODS_SELECTED))
					{
						hBrush=CreateSolidBrush(RGB(49,106,197));
					}
					else  
					{
						hBrush=CreateSolidBrush(RGB(255,255,255));
					}
					FillRect(_DrawItem->hDC,&_DrawItem->rcItem,hBrush);                   
					DeleteObject(hBrush);

					if (sd->infoFlg){
						if (sd->relay){
							/* relay ok */
							SetTextColor(_DrawItem->hDC,RGB(0,255,0));
//							SetBkColor(_DrawItem->hDC,RGB(255,255,255));
						} else {
							/* no more relay */
							if (sd->numRelays){
								/* relay full */
								SetTextColor(_DrawItem->hDC,RGB(0,0,255));
//								SetBkColor(_DrawItem->hDC,RGB(255,255,255));
							} else {
								/* relay ng */
								SetTextColor(_DrawItem->hDC,RGB(255,0,255));
//								SetBkColor(_DrawItem->hDC,RGB(255,255,255));
							}
						}
					} else {
						/* no info */
						SetTextColor(_DrawItem->hDC,RGB(0,0,0));
//						SetBkColor(_DrawItem->hDC,RGB(255,255,255));
					}

					if (sd->lastSkipTime + 120 > sys->getTime()){
						SetBkColor(_DrawItem->hDC,RGB(128,128,128));
						if (sd->type == Servent::T_RELAY){
							sprintf(buf, "▼(%d)",sd->lastSkipCount);
							TextOut(_DrawItem->hDC,
							_DrawItem->rcItem.left,
							_DrawItem->rcItem.top,
							buf,
							strlen(buf));
						} else {
							SetTextColor(_DrawItem->hDC,RGB(0,0,0));
							sprintf(buf, "▽(%d)",sd->lastSkipCount);
							TextOut(_DrawItem->hDC,
									_DrawItem->rcItem.left,
									_DrawItem->rcItem.top,
									buf,
									strlen(buf));
						}
					} else {
						SetBkColor(_DrawItem->hDC,RGB(255,255,255));
						if (sd->type == Servent::T_RELAY){
							TextOut(_DrawItem->hDC,
							_DrawItem->rcItem.left,
							_DrawItem->rcItem.top,
							"■",
							2);
						} else {
							SetTextColor(_DrawItem->hDC,RGB(0,0,0));
							SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
							TextOut(_DrawItem->hDC,
									_DrawItem->rcItem.left,
									_DrawItem->rcItem.top,
									"□",
									2);
						}
					}

					if ((_DrawItem->itemState) & (ODS_SELECTED))
					{
						SetTextColor(_DrawItem->hDC,RGB(255,255,255));
						SetBkColor(_DrawItem->hDC,RGB(49,106,197)) ;
					} else {
						SetTextColor(_DrawItem->hDC,RGB(0,0,0));
						SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
					}
					if (sd->firewalled){
						if (!sd->numRelays){
							SetTextColor(_DrawItem->hDC,RGB(255,0,0));
						} else {
							SetTextColor(_DrawItem->hDC,RGB(255,168,0));
						}
					}

					char buf2[16];
					if (sd->ver_ex_number){
						sprintf(buf2, "(%c%c%04d)", sd->ver_ex_prefix[0], sd->ver_ex_prefix[1], sd->ver_ex_number);
					} else if (sd->vp_ver){
						sprintf(buf2, "(VP%04d)", sd->vp_ver);
					} else {
						buf2[0] = '\0';
					}
					if (sd->type == Servent::T_RELAY){
						if (sd->status == Servent::S_CONNECTED){
							sprintf(buf, "(%d)RELAYING-%ds  - %d/%d -  %s  -  %d - %s%s",
								sd->lastSkipCount,
								sd->tnum,
								sd->totalListeners, sd->totalRelays,
								hostName,
								sd->syncpos, sd->agent.cstr(), buf2
								);
						} else {
							sprintf(buf, "%s-%s-%ds  - %d/%d -  %s  -  %d - %s%s",
								sd->typeStr, sd->statusStr, sd->tnum,
								sd->totalListeners, sd->totalRelays,
								hostName,
								sd->syncpos, sd->agent.cstr(), buf2
								);
						}
					} else if (sd->type == Servent::T_DIRECT){
						sprintf(buf, "%s-%s-%ds  -  %s  -  %d - %s ",
							sd->typeStr, sd->statusStr, sd->tnum,
							hostName,
							sd->syncpos, sd->agent.cstr()
							);
					} else {
						if (sd->status == Servent::S_CONNECTED){
							sprintf(buf, "%s-%s-%ds  -  %s  -  %d/%d",
								sd->typeStr, sd->statusStr, sd->tnum,
								hostName,
								sd->syncpos, sd->agent.cstr()
								);
						} else {
							sprintf(buf, "%s-%s-%ds  -  %s",
								sd->typeStr, sd->statusStr, sd->tnum,
								hostName
								);
						}
					}
					TextOut(_DrawItem->hDC,
							_DrawItem->rcItem.left + 12,
							_DrawItem->rcItem.top,
							buf,
							strlen(buf));
				}
				sd_lock.off();
			}
			break;

		case WM_SIZE:
			MoveControls(lParam);
			break;

		case WM_GETMINMAXINFO:
		{
			MINMAXINFO *pmmi = (MINMAXINFO *)lParam;
			if ( pmmi )
			{
				pmmi->ptMinTrackSize.x = 530;  // 最小幅
				pmmi->ptMinTrackSize.y = 435;  // 最小高
				pmmi->ptMaxTrackSize.x = 530; // 最大幅
				pmmi->ptMaxTrackSize.y = 1200;  // 最大高
			}
			return 0;
		}

/*		case WM_NCHITTEST:
		{
			LRESULT lResult; // カーソル位置判定結果

			// 変換一覧にあれば変換した値を返す。
			lResult = DefWindowProc( guiWnd, message, wParam, lParam );
			for( int i = 0; i < 8; i++ )
			{
				if ( lResult == trans[ i ].from )
				{
					return trans[ i ].to;
				}
			}
//			return lResult;
//			return HTCAPTION;
//			return 0;
		}*/
		
		case WM_CLOSE:
			GetWindowPlacement(hwnd, &winPlace);
			guiFlg = true;
			DestroyWindow( hwnd );
			break;

		case WM_DESTROY:
			GetWindowPlacement(hwnd, &winPlace);
			guiFlg = true;
			guiThread.active = false;
//			guiThread.lock();
			guiWnd = NULL;
//			guiThread.unlock();
			EndDialog(hwnd, LOWORD(wParam));
			break;

		//default:
			// do nothing
			//return DefDlgProc(hwnd, message, wParam, lParam);		// this recurses for ever
			//return DefWindowProc(hwnd, message, wParam, lParam);	// this stops window messages
   }
   return 0;
}