| 298 | } |
| 299 | |
| 300 | void Cgui_rpcDlg::OnEnChangeUrl() |
| 301 | { |
| 302 | // TODO: ����ÿؼ��� RICHEDIT �ؼ������������� |
| 303 | // ����֪ͨ��������д CDialog::OnInitDialog() |
| 304 | // ���������� CRichEditCtrl().SetEventMask()�� |
| 305 | // ͬʱ�� ENM_CHANGE ��־�������㵽�����С� |
| 306 | |
| 307 | // TODO: �ڴ����ӿؼ�֪ͨ����������� |
| 308 | CString url; |
| 309 | GetDlgItem(IDC_URL)->GetWindowText(url); |
| 310 | if (url.GetLength() == 0) |
| 311 | return; |
| 312 | url.MakeLower(); |
| 313 | char* ptr = url.GetBuffer(); |
| 314 | #define SKIP_SP(x) do { if (*(x) == ' ' || *(x) == '\t') (x)++; } while(0) |
| 315 | SKIP_SP(ptr); |
| 316 | if (*ptr == 0 || strlen(ptr) <= sizeof("http://") - 1) |
| 317 | return; |
| 318 | if (strncmp(ptr, "http://", sizeof("http://") - 1) == 0) |
| 319 | ptr += sizeof("http://") - 1; |
| 320 | if (*ptr == 0) |
| 321 | { |
| 322 | GetDlgItem(IDC_IP)->SetWindowText(""); |
| 323 | return; |
| 324 | } |
| 325 | CString addr = ptr; |
| 326 | int pos = addr.Find('/'); |
| 327 | if (pos >= 0) |
| 328 | addr.Truncate(pos); |
| 329 | CString port = "80"; |
| 330 | pos = addr.Find(':'); |
| 331 | if (pos >= 0) |
| 332 | { |
| 333 | port = addr.Mid(pos + 1); |
| 334 | addr.Truncate(pos); |
| 335 | } |
| 336 | GetDlgItem(IDC_IP)->SetWindowText(addr.GetString()); |
| 337 | if (port.GetLength() > 0) |
| 338 | GetDlgItem(IDC_PORT)->SetWindowText(port.GetString()); |
| 339 | } |
| 340 | |
| 341 | ////////////////////////////////////////////////////////////////////////// |
| 342 | |