-
Notifications
You must be signed in to change notification settings - Fork 2
/
editdlg.cpp
494 lines (477 loc) · 17 KB
/
editdlg.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
#include "regedit.h"
#include "resource.h"
extern HBITMAP img_up,img_down;
INT_PTR CALLBACK EditString (HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) {
val_ed_dialog_data *params;
switch (msg) {
case WM_INITDIALOG:
SetWindowLongPtr(hwnd, DWLP_USER, lParam);
params = (val_ed_dialog_data*)lParam;
if (params->readonly) {
SendDlgItemMessage(hwnd,IDC_EDITSTR,EM_SETREADONLY,1,0);
EnableWindow(GetDlgItem(hwnd,IDOK),0);
SetWindowText(hwnd,_T("Edit String (read only)"));
}
params->applyEn = true;
SetDlgItemText(hwnd,IDC_VNAME,params->name.c);
SetDlgItemText(hwnd,IDC_EDITSTR,params->data.c);
params->applyEn = false;
SetFocus(GetDlgItem(hwnd,IDC_EDITSTR));
SendDlgItemMessage(hwnd,IDC_EDITSTR,EM_SETSEL,0,-1);
return 0;
case WM_CLOSE: EndDialog(hwnd,0); return 1;
case WM_COMMAND:
params = (val_ed_dialog_data*)GetWindowLongPtr(hwnd, DWLP_USER);
switch (LOWORD (wParam)) {
case IDC_APPLY:
params->applyEn=0;
EnableWindow(GetDlgItem(hwnd,IDC_APPLY),0);
SetFocus(GetDlgItem(hwnd,IDC_EDITSTR));
case IDOK:
params->newdata.GetDlgItemText(hwnd,IDC_EDITSTR);
if (LOWORD(wParam)==IDOK) EndDialog(hwnd,1);
break;
case IDCANCEL: EndDialog(hwnd,0); break;
case IDC_EDITSTR:
if (HIWORD(wParam)==EN_CHANGE && !params->applyEn) {
params->applyEn = 1;
EnableWindow(GetDlgItem(hwnd,IDC_APPLY),1);
}
break;
}
return 1;
}
return 0;
}
#define DISABLE_LIST_DRAG
INT_PTR CALLBACK EditMString (HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) {
TCHAR *c;
int k,l,m,n;
TCHAR s[64];
val_ed_dialog_data *params;
static DWORD numstr;
static int cursel;
static UINT WM_DRAG_LIST;
switch (msg) {
case WM_INITDIALOG:
SetWindowLongPtr(hwnd, DWLP_USER, lParam);
params = (val_ed_dialog_data*)lParam;
cursel=0;
if (params->readonly) {
SendDlgItemMessage(hwnd,IDC_EDITSTR,EM_SETREADONLY,1,0);
EnableWindow(GetDlgItem(hwnd,IDOK),0);
EnableWindow(GetDlgItem(hwnd,IDC_MOVEUP),0);
EnableWindow(GetDlgItem(hwnd,IDC_MOVEDOWN),0);
EnableWindow(GetDlgItem(hwnd,IDC_NEW),0);
EnableWindow(GetDlgItem(hwnd,IDC_DEL),0);
EnableWindow(GetDlgItem(hwnd,IDC_CONCAT),0);
SetWindowText(hwnd,_T("Edit Multistring (read only)"));
}
#ifndef DISABLE_LIST_DRAG
MakeDragList(GetDlgItem(hwnd, IDC_SLIST));
WM_DRAG_LIST = RegisterWindowMessage(DRAGLISTMSGSTRING);
#endif
params->applyEn = 2;
#ifndef _WIN32_WCE
SendDlgItemMessage(hwnd,IDC_MOVEUP,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)img_up);
SendDlgItemMessage(hwnd,IDC_MOVEDOWN,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)img_down);
#endif
SetDlgItemText(hwnd,IDC_VNAME,params->name.c);
SetDlgItemText(hwnd,IDC_EDITSTR,params->data.c);
for(n=numstr=0,c=params->data.c;n<(int)params->data.l /*&& c[n]*/;) {
k=_tcslen(c+n);
if (n==(int)params->data.l/sizeof(TCHAR)-1) break;
SendDlgItemMessage(hwnd,IDC_SLIST,LB_ADDSTRING,0,(LPARAM)(c+n));
numstr++;
n+=k+1;
}
SendDlgItemMessage(hwnd,IDC_SLIST,LB_SETCURSEL,0,0);
params->applyEn = 0;
SetFocus(GetDlgItem(hwnd,IDC_EDITSTR));
SendDlgItemMessage(hwnd,IDC_EDITSTR,EM_SETSEL,0,-1);
_stprintf(s,_T("String %i of %i:"),cursel,
(int)SendDlgItemMessage(hwnd,IDC_SLIST,LB_GETCOUNT,0,0));
SetDlgItemText(hwnd,IDC_VSLIST,s);
return 0;
case WM_CLOSE: EndDialog(hwnd,0); return 1;
case WM_COMMAND:
params = (val_ed_dialog_data*)GetWindowLongPtr(hwnd, DWLP_USER);
switch (LOWORD (wParam)) {
case IDC_APPLY:
params->applyEn = 0;
EnableWindow(GetDlgItem(hwnd,IDC_APPLY),0);
SetFocus(GetDlgItem(hwnd,IDC_EDITSTR));
case IDOK:
l=SendDlgItemMessage(hwnd,IDC_SLIST,LB_GETCOUNT,0,0);
for(n=k=0;n<l;n++) {
m=SendDlgItemMessage(hwnd,IDC_SLIST,LB_GETTEXTLEN,n,0);
if (m!=LB_ERR) k+=m+1; else k+=30;
}
c = params->newdata.resize(k*sizeof(TCHAR));
for(n=m=0;n<l;n++) {
c[m]=0;
SendDlgItemMessage(hwnd,IDC_SLIST,LB_GETTEXT,n,(LPARAM)(c+m));
m+=_tcslen(c+m)+1;
}
c[m++]=0;
params->newdata.l = m*sizeof(TCHAR);
if (LOWORD(wParam)==IDOK) EndDialog(hwnd,1);
break;
case IDCANCEL: EndDialog(hwnd,0); break;
case IDC_EDITSTR:
if (HIWORD(wParam)==EN_CHANGE) {
if (!params->applyEn) {
params->applyEn = 1;
EnableWindow(GetDlgItem(hwnd,IDC_APPLY),1);
}
if (params->applyEn != 2) {
DWORD l=SendDlgItemMessage(hwnd,IDC_EDITSTR,WM_GETTEXTLENGTH,0,0);
c=(TCHAR*)malloc((l+10) * sizeof(TCHAR));
GetDlgItemText(hwnd,IDC_EDITSTR,c,l+9);
SendDlgItemMessage(hwnd,IDC_SLIST,LB_DELETESTRING,cursel,0);
SendDlgItemMessage(hwnd,IDC_SLIST,LB_INSERTSTRING,cursel,(LPARAM)c);
SendDlgItemMessage(hwnd,IDC_SLIST,LB_SETCURSEL,cursel,0);
free(c);
_stprintf(s,_T("String %i of %i:"),cursel,
(int)SendDlgItemMessage(hwnd,IDC_SLIST,LB_GETCOUNT,0,0));
SetDlgItemText(hwnd,IDC_VSLIST,s);
}
}
break;
case IDC_SLIST:
if (HIWORD(wParam)==LBN_SELCHANGE) {
setsel: cursel=SendDlgItemMessage(hwnd,IDC_SLIST,LB_GETCURSEL,0,0);
if (cursel<0) cursel=0; else {
DWORD l1=SendDlgItemMessage(hwnd,IDC_SLIST,LB_GETTEXTLEN,cursel,0),
l=SendDlgItemMessage(hwnd,IDC_EDITSTR,WM_GETTEXTLENGTH,0,0);
TCHAR *c1;
c=(TCHAR*)malloc((l+10) * sizeof(TCHAR)); c1=(TCHAR*)malloc((l1+10) * sizeof(TCHAR));
*c=*c1=0;
GetDlgItemText(hwnd,IDC_EDITSTR,c,l+9);
SendDlgItemMessage(hwnd,IDC_SLIST,LB_GETTEXT,cursel,(LPARAM)c1);
int t = params->applyEn;
params->applyEn = 2;
if (_tcscmp(c,c1)) SetDlgItemText(hwnd,IDC_EDITSTR,c1);
params->applyEn = t;
free(c); free(c1);
}
_stprintf(s,_T("String %i of %i:"),cursel,
(int)SendDlgItemMessage(hwnd,IDC_SLIST,LB_GETCOUNT,0,0));
SetDlgItemText(hwnd,IDC_VSLIST,s);
}
break;
case IDC_NEW:
SendDlgItemMessage(hwnd,IDC_SLIST,LB_INSERTSTRING,cursel,(LPARAM)"");
SendDlgItemMessage(hwnd,IDC_SLIST,LB_SETCURSEL,cursel,0);
goto setsel;
break;
case IDC_DEL:
SendDlgItemMessage(hwnd,IDC_SLIST,LB_DELETESTRING,cursel,0);
l=SendDlgItemMessage(hwnd,IDC_SLIST,LB_GETCOUNT,0,0);
cursel=(cursel>=l)?(l>0)?l-1:0:cursel;
SendDlgItemMessage(hwnd,IDC_SLIST,LB_SETCURSEL,cursel,0);
goto setsel;
break;
case IDC_MOVEUP:
if (cursel<=0) {cursel=0; break;}
m=SendDlgItemMessage(hwnd,IDC_SLIST,LB_GETTEXTLEN,cursel,0);
c=(TCHAR*)malloc((m+5) * sizeof(TCHAR));
SendDlgItemMessage(hwnd,IDC_SLIST,LB_GETTEXT,cursel,(LPARAM)c);
SendDlgItemMessage(hwnd,IDC_SLIST,LB_DELETESTRING,cursel,0);
cursel--;
SendDlgItemMessage(hwnd,IDC_SLIST,LB_INSERTSTRING,cursel,(LPARAM)c);
free(c);
SendDlgItemMessage(hwnd,IDC_SLIST,LB_SETCURSEL,cursel,0);
goto setsel;
break;
case IDC_MOVEDOWN:
l=SendDlgItemMessage(hwnd,IDC_SLIST,LB_GETCOUNT,0,0);
if (cursel>=l-1) break;
m=SendDlgItemMessage(hwnd,IDC_SLIST,LB_GETTEXTLEN,cursel,0);
c=(TCHAR*)malloc((m+5) * sizeof(TCHAR));
SendDlgItemMessage(hwnd,IDC_SLIST,LB_GETTEXT,cursel,(LPARAM)c);
SendDlgItemMessage(hwnd,IDC_SLIST,LB_DELETESTRING,cursel,0);
cursel++;
SendDlgItemMessage(hwnd,IDC_SLIST,LB_INSERTSTRING,cursel,(LPARAM)c);
free(c);
SendDlgItemMessage(hwnd,IDC_SLIST,LB_SETCURSEL,cursel,0);
goto setsel;
break;
case IDC_CONCAT:
l=SendDlgItemMessage(hwnd,IDC_SLIST,LB_GETCOUNT,0,0);
if (cursel>=l-1) break;
l=SendDlgItemMessage(hwnd,IDC_SLIST,LB_GETTEXTLEN,cursel,0);
m=SendDlgItemMessage(hwnd,IDC_SLIST,LB_GETTEXTLEN,cursel+1,0);
c=(TCHAR*)malloc((l+m+5) * sizeof(TCHAR)); c[0]=0;
SendDlgItemMessage(hwnd,IDC_SLIST,LB_GETTEXT,cursel,(LPARAM)c);
l=_tcslen(c);
SendDlgItemMessage(hwnd,IDC_SLIST,LB_GETTEXT,cursel+1,(LPARAM)(c+l));
c[l+m]=0;
SendDlgItemMessage(hwnd,IDC_SLIST,LB_DELETESTRING,cursel+1,0);
SendDlgItemMessage(hwnd,IDC_SLIST,LB_DELETESTRING,cursel,0);
SendDlgItemMessage(hwnd,IDC_SLIST,LB_INSERTSTRING,cursel,(LPARAM)c);
free(c);
SendDlgItemMessage(hwnd,IDC_SLIST,LB_SETCURSEL,cursel,0);
goto setsel;
break;
}
return 1;
}
#ifndef DISABLE_LIST_DRAG
if (msg == WM_DRAG_LIST) {
int lbitem; HWND lbwnd = GetDlgItem(hwnd, IDC_SLIST);
DRAGLISTINFO &dli = *(DRAGLISTINFO*)lParam; //don't need wParam
static int drlcount = 0;
char s[64]; sprintf(s, "WM_DRAG_LIST [%04i]: ntfn = %i\n", drlcount++, dli.uNotification);
SetWindowText(hwnd, s);
switch(dli.uNotification) {
case DL_BEGINDRAG:
return true;
case DL_DROPPED:
// move item here
return 0; //don't care
case DL_CANCELDRAG: return 0; //don't care
case DL_DRAGGING: //Where's the message ?! :(
lbitem = LBItemFromPt(lbwnd, dli.ptCursor, true);
DrawInsert(hwnd, lbwnd, lbitem);
return DL_MOVECURSOR;
}
}
#endif
return 0;
}
INT_PTR CALLBACK EditDWORD (HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) {
static int edval,cval,lock;
val_ed_dialog_data *params;
TCHAR s[64];
int n;
switch (msg) {
case WM_INITDIALOG:
SetWindowLongPtr(hwnd, DWLP_USER, lParam);
params = (val_ed_dialog_data*)lParam;
*((DWORD*)params->newdata.c) = cval = *((DWORD*)params->data.c);
if (params->data.l != 4) SetWindowText(hwnd, _T("Edit false DWORD Value?!"));
SetDlgItemText(hwnd,IDC_VNAME,params->name.c);
if (params->readonly) {
SendDlgItemMessage(hwnd,IDC_DECNUM,EM_SETREADONLY,1,0);
SendDlgItemMessage(hwnd,IDC_HEXNUM,EM_SETREADONLY,1,0);
EnableWindow(GetDlgItem(hwnd,IDOK),0);
}
lock = 1,params->applyEn = 2,edval = 0;
_stprintf(s,_T("%i"),cval);
SetDlgItemText(hwnd,IDC_DECNUM,s);
_stprintf(s,_T("%X"),cval);
SetDlgItemText(hwnd,IDC_HEXNUM,s);
_stprintf(s,_T("0x%08X (%i)"),cval,cval);
SetDlgItemText(hwnd,IDC_RESULTNUM,s);
SendDlgItemMessage(hwnd,IDC_DECNUM,EM_SETLIMITTEXT,32,0);
SendDlgItemMessage(hwnd,IDC_HEXNUM,EM_SETLIMITTEXT,32,0);
lock = params->applyEn = 0;
return 0;
case WM_CLOSE: EndDialog(hwnd,edval); return 1;
case WM_COMMAND:
params = (val_ed_dialog_data*)GetWindowLongPtr(hwnd, DWLP_USER);
switch (LOWORD (wParam)) {
case IDOK:
*((DWORD*)params->newdata.c) = cval;
EndDialog(hwnd,1);
break;
case IDCANCEL: EndDialog(hwnd,edval); break;
case IDC_APPLY:
*((DWORD*)params->newdata.c) = cval;
params->applyEn = 0, edval = 1;
EnableWindow(GetDlgItem(hwnd,IDC_APPLY),0);
break;
case IDC_DECNUM:
if (HIWORD(wParam)==EN_UPDATE && !lock) {
GetDlgItemText(hwnd,IDC_DECNUM,s,64);
_stscanf(s,_T("%i"),&cval);
_stprintf(s,_T("%X"),cval);
lock=1;
SetDlgItemText(hwnd,IDC_HEXNUM,s);
_stprintf(s,_T("0x%08X (%i)"),cval,cval);
SetDlgItemText(hwnd,IDC_RESULTNUM,s);
lock=0;
if (!params->applyEn) {
params->applyEn = 1;
EnableWindow(GetDlgItem(hwnd,IDC_APPLY),1);
}
}
break;
case IDC_HEXNUM:
if (HIWORD(wParam)==EN_UPDATE && !lock) {
GetDlgItemText(hwnd,IDC_HEXNUM,s,64);
for(n=0,cval=0;isxdigit((unsigned char)s[n]);n++)
cval=(cval<<4)| ((s[n]<='9')? s[n]-'0' : _totupper(s[n])-'A'+10);
_stprintf(s,_T("%i"),cval);
lock=1;
SetDlgItemText(hwnd,IDC_DECNUM,s);
_stprintf(s,_T("0x%08X (%i)"),cval,cval);
SetDlgItemText(hwnd,IDC_RESULTNUM,s);
lock=0;
if (!params->applyEn) {
params->applyEn = 1;
EnableWindow(GetDlgItem(hwnd,IDC_APPLY),1);
}
}
break;
}
return 1;
}
return 0;
}
static WNDPROC DefPhoneKeyboardProc = NULL;
static LRESULT CALLBACK PhoneKeyboardProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
return CallWindowProc(DefPhoneKeyboardProc, hwnd, msg == WM_LBUTTONDBLCLK ? WM_LBUTTONDOWN : msg, wParam, lParam);
}
INT_PTR CALLBACK EditBinary(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
val_ed_dialog_data *params;
TCHAR s[64];
RECT rect;
TCITEM item;
UINT value;
BOOL valid;
switch (msg) {
case WM_ACTIVATE:
if (HWND const hwndPhoneKeyboard = GetDlgItem(hwnd, IDC_PHONEKEYBOARD)) {
if (wParam)
DefPhoneKeyboardProc = (WNDPROC)SetWindowLongPtr(hwndPhoneKeyboard, GWLP_WNDPROC, (LONG_PTR)PhoneKeyboardProc);
else
SetWindowLongPtr(hwndPhoneKeyboard, GWLP_WNDPROC, (LONG_PTR)DefPhoneKeyboardProc);
}
break;
case WM_INITDIALOG:
SetWindowLongPtr(hwnd, DWLP_USER, lParam);
params = (val_ed_dialog_data*)lParam;
if (HWND const hwndPhoneKeyboard = GetDlgItem(hwnd, IDC_PHONEKEYBOARD)) {
GetClientRect(hwndPhoneKeyboard, &rect);
TabCtrl_SetItemSize(hwndPhoneKeyboard, rect.bottom, rect.bottom);
item.mask = TCIF_TEXT;
item.pszText = _T("*");
TabCtrl_InsertItem(hwndPhoneKeyboard, 0, &item);
TabCtrl_SetCurSel(hwndPhoneKeyboard, -1);
}
if (params->readonly) {
SendDlgItemMessage(hwnd,IDC_HEXEDIT,EM_SETREADONLY,1,0);
EnableWindow(GetDlgItem(hwnd,IDOK),0);
}
_stprintf(s,_T("Edit %sBinary %s"), params->flag1?_T("value as "):_T(""),params->readonly?_T(" (read only)"):_T(""));
SetWindowText(hwnd,s);
params->applyEn = 1;
SetDlgItemText(hwnd,IDC_VNAME,params->name.c);
SendDlgItemMessage(hwnd,IDC_HEXEDIT,WM_USER,(WPARAM)params->data.c, params->data.l);
params->applyEn = 0;
SetFocus(GetDlgItem(hwnd,IDC_HEXEDIT));
return 0;
case WM_CLOSE: EndDialog(hwnd,0); return 1;
case WM_COMMAND:
params = (val_ed_dialog_data*)GetWindowLongPtr(hwnd, DWLP_USER);
switch (LOWORD (wParam)) {
case IDC_APPLY:
params->applyEn = 0;
EnableWindow(GetDlgItem(hwnd,IDC_APPLY),0);
SetFocus(GetDlgItem(hwnd,IDC_HEXEDIT));
case IDOK:
params->newdata.l = SendDlgItemMessage(hwnd,IDC_HEXEDIT,WM_USER+1,0,0);
params->newdata.resize();
params->newdata.c[params->newdata.l / sizeof(TCHAR)] = 0;
SendDlgItemMessage(hwnd,IDC_HEXEDIT,WM_USER+2,(WPARAM)params->newdata.c,params->newdata.s);
if (LOWORD(wParam)==IDOK) EndDialog(hwnd,1);
break;
case IDCANCEL: EndDialog(hwnd,0); break;
case IDC_HEXEDIT:
if (HIWORD(wParam)==EN_CHANGE && !params->applyEn) {
params->applyEn = 1;
EnableWindow(GetDlgItem(hwnd,IDC_APPLY),1);
}
break;
}
return 1;
case WM_NOTIFY:
switch (LPNMHDR(lParam)->code) {
case TCN_SELCHANGE:
switch (UINT const hitcode =
TabCtrl_GetCurSel(LPNMHDR(lParam)->hwndFrom) |
TabCtrl_GetItemCount(LPNMHDR(lParam)->hwndFrom) << 4) {
case 0x10: //symbol *
SetWindowText(LPNMHDR(lParam)->hwndFrom, NULL);
GetWindowRect(LPNMHDR(lParam)->hwndFrom, &rect);
MapWindowPoints(NULL, hwnd, LPPOINT(&rect), 2);
SetWindowPos(LPNMHDR(lParam)->hwndFrom, NULL,
rect.left, rect.top - (rect.bottom - rect.top + 3) * 3,
(rect.bottom - rect.top + 3) * 3,
(rect.bottom - rect.top + 3) * 4,
SWP_NOZORDER);
item.mask = TCIF_TEXT;
item.pszText = _T("#");
TabCtrl_InsertItem(LPNMHDR(lParam)->hwndFrom, 1, &item);
item.pszText = _T("0");
TabCtrl_InsertItem(LPNMHDR(lParam)->hwndFrom, 1, &item);
item.pszText = _T("9");
TabCtrl_InsertItem(LPNMHDR(lParam)->hwndFrom, 0, &item);
item.pszText = _T("8");
TabCtrl_InsertItem(LPNMHDR(lParam)->hwndFrom, 0, &item);
item.pszText = _T("7");
TabCtrl_InsertItem(LPNMHDR(lParam)->hwndFrom, 0, &item);
item.pszText = _T("6");
TabCtrl_InsertItem(LPNMHDR(lParam)->hwndFrom, 0, &item);
item.pszText = _T("5");
TabCtrl_InsertItem(LPNMHDR(lParam)->hwndFrom, 0, &item);
item.pszText = _T("4");
TabCtrl_InsertItem(LPNMHDR(lParam)->hwndFrom, 0, &item);
item.pszText = _T("3");
TabCtrl_InsertItem(LPNMHDR(lParam)->hwndFrom, 0, &item);
item.pszText = _T("2");
TabCtrl_InsertItem(LPNMHDR(lParam)->hwndFrom, 0, &item);
item.pszText = _T("1");
TabCtrl_InsertItem(LPNMHDR(lParam)->hwndFrom, 0, &item);
break;
case 0xCB: //symbol #
value = GetDlgItemInt(hwnd, LPNMHDR(lParam)->idFrom, &valid, FALSE);
if (valid)
SendDlgItemMessage(hwnd, IDC_HEXEDIT, WM_USER + 4, value, 0);
// fall through
case 0xC9: //symbol *
GetWindowRect(LPNMHDR(lParam)->hwndFrom, &rect);
MapWindowPoints(NULL, hwnd, LPPOINT(&rect), 2);
SetWindowPos(LPNMHDR(lParam)->hwndFrom, NULL,
rect.left, rect.right - rect.left + rect.top,
(rect.bottom - rect.top) - (rect.right - rect.left) - 3,
(rect.bottom - rect.top) - (rect.right - rect.left) - 3,
SWP_NOZORDER);
TabCtrl_DeleteItem(LPNMHDR(lParam)->hwndFrom, 0);
TabCtrl_DeleteItem(LPNMHDR(lParam)->hwndFrom, 0);
TabCtrl_DeleteItem(LPNMHDR(lParam)->hwndFrom, 0);
TabCtrl_DeleteItem(LPNMHDR(lParam)->hwndFrom, 0);
TabCtrl_DeleteItem(LPNMHDR(lParam)->hwndFrom, 0);
TabCtrl_DeleteItem(LPNMHDR(lParam)->hwndFrom, 0);
TabCtrl_DeleteItem(LPNMHDR(lParam)->hwndFrom, 0);
TabCtrl_DeleteItem(LPNMHDR(lParam)->hwndFrom, 0);
TabCtrl_DeleteItem(LPNMHDR(lParam)->hwndFrom, 0);
TabCtrl_DeleteItem(LPNMHDR(lParam)->hwndFrom, 1);
TabCtrl_DeleteItem(LPNMHDR(lParam)->hwndFrom, 1);
break;
case 0xC0: //digit 1
case 0xC1: //digit 2
case 0xC2: //digit 3
case 0xC3: //digit 4
case 0xC4: //digit 5
case 0xC5: //digit 6
case 0xC6: //digit 7
case 0xC7: //digit 8
case 0xC8: //digit 9
case 0xCA: //digit 0
value = GetDlgItemInt(hwnd, LPNMHDR(lParam)->idFrom, &valid, FALSE);
value *= 10;
if (hitcode != 0xCA)
value += hitcode - 0xBF;
SetDlgItemInt(hwnd, LPNMHDR(lParam)->idFrom, value, FALSE);
break;
}
TabCtrl_SetCurSel(LPNMHDR(lParam)->hwndFrom, -1);
break;
}
return 1;
}
return 0;
}