| 805 |
} |
} |
| 806 |
|
|
| 807 |
// C-p/C-n/C-b/C-f/C-a/C-e をサポート (2007.9.5 maya) |
// C-p/C-n/C-b/C-f/C-a/C-e をサポート (2007.9.5 maya) |
| 808 |
|
// C-d/C-k をサポート (2007.10.3 yutaka) |
| 809 |
// ドロップダウンの中のエディットコントロールを |
// ドロップダウンの中のエディットコントロールを |
| 810 |
// サブクラス化するためのウインドウプロシージャ |
// サブクラス化するためのウインドウプロシージャ |
| 811 |
static WNDPROC OrigHostnameEditProc; // Original window procedure |
WNDPROC OrigHostnameEditProc; // Original window procedure |
| 812 |
static LRESULT CALLBACK HostnameEditProc(HWND dlg, UINT msg, |
LRESULT CALLBACK HostnameEditProc(HWND dlg, UINT msg, |
| 813 |
WPARAM wParam, LPARAM lParam) |
WPARAM wParam, LPARAM lParam) |
| 814 |
{ |
{ |
| 815 |
HWND parent; |
HWND parent; |
| 816 |
int max, select; |
int max, select, len; |
| 817 |
|
char *str; |
| 818 |
|
|
| 819 |
switch (msg) { |
switch (msg) { |
| 820 |
// キーが押されたのを検知する |
// キーが押されたのを検知する |
| 852 |
max = GetWindowTextLength(dlg) ; |
max = GetWindowTextLength(dlg) ; |
| 853 |
PostMessage(dlg, EM_SETSEL, max, max); |
PostMessage(dlg, EM_SETSEL, max, max); |
| 854 |
return 0; |
return 0; |
| 855 |
|
|
| 856 |
|
case 0x44: // Ctrl+d |
| 857 |
|
case 0x4b: // Ctrl+k |
| 858 |
|
SendMessage(dlg, EM_GETSEL, 0, (LPARAM)&select); |
| 859 |
|
max = GetWindowTextLength(dlg); |
| 860 |
|
max++; // '\0' |
| 861 |
|
str = malloc(max); |
| 862 |
|
if (str != NULL) { |
| 863 |
|
len = GetWindowText(dlg, str, max); |
| 864 |
|
if (select >= 0 && select < len) { |
| 865 |
|
if (wParam == 0x44) { // カーソル配下の文字のみを削除する |
| 866 |
|
memmove(&str[select], &str[select + 1], len - select - 1); |
| 867 |
|
str[len - 1] = '\0'; |
| 868 |
|
|
| 869 |
|
} else if (wParam == 0x4b) { // カーソルから行末まで削除する |
| 870 |
|
str[select] = '\0'; |
| 871 |
|
} |
| 872 |
|
|
| 873 |
|
SetWindowText(dlg, str); |
| 874 |
|
SendMessage(dlg, EM_SETSEL, select, select); |
| 875 |
|
} |
| 876 |
|
free(str); |
| 877 |
|
return 0; |
| 878 |
|
} |
| 879 |
|
break; |
| 880 |
} |
} |
| 881 |
} |
} |
| 882 |
break; |
break; |
| 886 |
switch (wParam) { |
switch (wParam) { |
| 887 |
case 0x01: |
case 0x01: |
| 888 |
case 0x02: |
case 0x02: |
| 889 |
|
case 0x04: |
| 890 |
case 0x05: |
case 0x05: |
| 891 |
case 0x06: |
case 0x06: |
| 892 |
|
case 0x0b: |
| 893 |
case 0x0e: |
case 0x0e: |
| 894 |
case 0x10: |
case 0x10: |
| 895 |
return 0; |
return 0; |