-
Notifications
You must be signed in to change notification settings - Fork 3
/
ProjectE.asm
3097 lines (2714 loc) · 100 KB
/
ProjectE.asm
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
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
CONTROLDATA STRUCT
hWnd HWND ?
hTreeItem HWND ?
ntype DWORD ?
IDName DB 64+1 DUP (?)
ID DWORD ?
Caption DB 241 DUP (?)
hFont HWND ?
Style DWORD ?
NotStyle DWORD ?
ExStyle DWORD ?
Class DB 32 DUP (?) ;Set to Null string
MenuID DB 32 DUP (?) ;Set to Null string
dux DWORD ?
x DWORD ?
duy DWORD ?
y DWORD ?
duccx DWORD ?
ccx DWORD ?
duccy DWORD ?
ccy DWORD ?
hChild DWORD ?
hImg DWORD ?
ControlRect RECT <?>
CONTROLDATA ENDS
DIALOGDATA STRUCT
ControlData CONTROLDATA <?>
FontSize DWORD ? ;Set to 8
FontName DB 32 DUP (?) ;Set to "MS Sans Serif"
FontWeight DWORD ?
FontItalic DWORD ?
Charset DWORD ?
lpUndoRedoMemory DWORD ?
lpUndoRedoPointer DWORD ?
DIALOGDATA ENDS
VERSIONMEM STRUCT
hTreeItem DD ?
szName DB 32 DUP(?)
Value DD ?
fv DD ?
fv1 DD ?
fv2 DD ?
fv3 DD ?
pv DD ?
pv1 DD ?
pv2 DD ?
pv3 DD ?
os DD ?
ft DD ?
lng DD ?
chs DD ?
VERSIONMEM ENDS
ACCELMEM STRUCT
hTreeItem DWORD ?
szName DB 32 DUP(?)
Value DD ?
nkey DD ?
flag DD ? ;0=Nothing,1=Control,2=Shift,4=ALT
ACCELMEM ENDS
VERSIONITEM STRUCT
szName DB 64 DUP(?)
szValue DB 256 DUP(?)
VERSIONITEM ENDS
STRINGMEM STRUCT
szName DB 32 DUP(?)
Value DD ?
szString DB 256 DUP(?)
STRINGMEM ENDS
MNUHEAD STRUCT
hTreeItem DD ?
szMenuName DB 32 DUP(?)
MenuID DD ?
NextMenuItemID DD ?
MNUHEAD ENDS
MNUITEM STRUCT
Flag DD ?
szName DB 32 DUP(?)
ID DD ?
szCaption DB 64 DUP(?)
Level DD ?
nType DD ?
nState DD ?
Shortcut DD ?
MNUITEM ENDS
RESOURCEMEM STRUCT
nType DD ? ;0=Bitmap,1=Cursor,2=Icon,3=Avi,
;4=Manifest,5=WAVE
szName DB 32 DUP(?)
Value DD ?
szFile DB MAX_PATH DUP(?)
RESOURCEMEM ENDS
DoNewProject PROTO :DWORD
DockWndProc PROTO :DWORD,:DWORD,:DWORD,:DWORD
GetResources PROTO
ClearRCEditor PROTO
AcceleratorsDialogProc PROTO :DWORD,:DWORD,:DWORD,:DWORD
ResourcesDialogProc PROTO :DWORD,:DWORD,:DWORD,:DWORD
VersionInfoDialogProc PROTO :DWORD,:DWORD,:DWORD,:DWORD
StringTableDialogProc PROTO :DWORD,:DWORD,:DWORD,:DWORD
MenuEditDialogProc PROTO :DWORD,:DWORD,:DWORD,:DWORD
IncludesDialogProc PROTO :DWORD,:DWORD,:DWORD,:DWORD
DeleteMenuDefines PROTO :DWORD
DeleteDefine PROTO :DWORD
DecToBin PROTO :DWORD
FindStyle PROTO :DWORD,:DWORD
DeSelectWindow PROTO :HWND
SelectWindow PROTO :HWND,:DWORD
PrepareAndConvertToPixels PROTO :DWORD
AddOrReplaceDefine PROTO :DWORD,:DWORD
HexToBin PROTO :DWORD
DeleteSelectedWindows PROTO
CreateDialogFont PROTO :DWORD
DeMultiSelect PROTO
DrawButton PROTO :DWORD,:DWORD
SetImageOfStaticControl PROTO :DWORD
CreateControl PROTO :DWORD,:DWORD
ReCreateControl PROTO :DWORD
SetClipChildren PROTO :DWORD
HandleRCContextMenu PROTO :DWORD,:DWORD,:HWND
AskToSaveFilesDialogProc PROTO :DWORD,:DWORD,:DWORD,:DWORD
AddControl PROTO :HWND, :DWORD, :DWORD, :DWORD, :DWORD
tbProperties TBBUTTON <7, IDM_TOOLBOX_DIALOG, 0,TBSTYLE_BUTTON, 0, 0>
TBBUTTON <0, IDM_RCPROPERTIES_MENUS, 0,TBSTYLE_BUTTON, 0, 0>
TBBUTTON <1, IDM_RCPROPERTIES_INCLUDES, 0,TBSTYLE_BUTTON, 0, 0>
TBBUTTON <2, IDM_RCPROPERTIES_ACCELERATORS, 0,TBSTYLE_BUTTON, 0, 0>
TBBUTTON <3, IDM_RCPROPERTIES_VERSIONINFO, 0,TBSTYLE_BUTTON, 0, 0>
TBBUTTON <4, IDM_RCPROPERTIES_STRINGTABLE, 0,TBSTYLE_BUTTON, 0, 0>
TBBUTTON <5, IDM_RCPROPERTIES_RESOURCES, 0,TBSTYLE_BUTTON, 0, 0>
TBBUTTON <6, IDM_RCPROPERTIES_REMOVE, 0,TBSTYLE_BUTTON, 0, 0>
.DATA?
lpOldTreeProc DWORD ?
hImlRCDialogsTree DWORD ?
hRCPropertiesToolBar DWORD ?
hImlRCAddResNormal DWORD ?
hImlRCAddResDisabled DWORD ?
hStylesBrowseButton DWORD ?
lpPrevEditPropertiesProc DWORD ?
lpPrevPropertiesListProc DWORD ?
StyleExStyleChanged DWORD ?
lpPrevSelectComboListProc DWORD ?
hSelectComboButton DWORD ?
lpPrevSelectComboButtonProc DWORD ?
.DATA
hADialog HWND 0
hSelection DWORD 0 ;This is the handle of the first Static window in the selection Chain
DialogsTreeHeight DWORD 200
fSplit DWORD 0
hOthersParentItem HANDLE 0 ;This is the parent item of ALL Other Resources.(i.e all but dialogs)
hStringTableParentItem HANDLE 0 ;This is the parent item of ALL String Tables.
hMenusParentItem HANDLE 0 ;This is the parent item of ALL Menus.
hIncludesParentItem HANDLE 0 ;This is the parent item of ALL Includes.
hResourcesParentItem HANDLE 0 ;This is the parent item of ALL Various resources (BMP, AVI, ICONS etc)
hAccelTablesParentItem HANDLE 0 ;This is the parent item of ALL Accelerator Tables
hVersionInfosParentItem HANDLE 0 ;This is the parent item of ALL Version Info Tables
lpStringTableMem DWORD 0
fIsPushed DWORD 0
.CODE
NewToolBoxToolBar Proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
Local Rect:RECT
.If uMsg==WM_LBUTTONDBLCLK && ToolSelected>IDM_TOOLBOX_POINTER
MOV ECX,1
MOV EDX,IDM_TOOLBOX_POINTER
@@:
INC EDX
INC ECX
.If EDX!=ToolSelected
JMP @B
.EndIf
Invoke SendMessage,hWnd,TB_GETITEMRECT,ECX,ADDR Rect
MOV ECX,lParam
AND ECX,0FFFFh ;ECX is horizontal
MOV EDX,lParam
SHR EDX,16 ;EDX is vertical
Invoke PtInRect,ADDR Rect,ECX,EDX
.If EAX
;PrintText "Double Click on button"
Invoke AddControl,hADialog,0,0,80,40
.EndIf
.Else
Invoke GetWindowLong,hWnd,GWL_USERDATA
Invoke CallWindowProc,EAX,hWnd,uMsg,wParam,lParam
.EndIf
RET
NewToolBoxToolBar EndP
;Returns pointer to RESOURCEMEM.szName
GetImageNameFromValue Proc Uses EDI lpValue:DWORD
Local Buffer[256]:BYTE
.If lpResourcesMem
MOV EDI,lpResourcesMem
Invoke DecToBin,lpValue
.While [EDI].RESOURCEMEM.szFile
.If EAX==[EDI].RESOURCEMEM.Value
LEA EAX,[EDI].RESOURCEMEM.szName
.If BYTE PTR [EAX]==0
XOR EAX,EAX
.EndIf
JMP Ex
.EndIf
LEA EDI,[EDI+SizeOf RESOURCEMEM]
.EndW
.EndIf
XOR EAX,EAX
Ex:
RET
GetImageNameFromValue EndP
SetProperties Proc Uses EDI lpWindowData:DWORD
Local lvi:LVITEM
Local Buffer[256]:BYTE
MOV EDI,lpWindowData
Invoke SendMessage,hPropertiesList,WM_SETREDRAW,FALSE,0
Invoke SendMessage,hPropertiesList,LVM_DELETEALLITEMS,0,0
MOV lvi.imask,LVIF_TEXT
MOV lvi.iItem,0
MOV lvi.pszText,Offset szName
CALL InsertNewItem
LEA ECX,[EDI].CONTROLDATA.IDName
MOV lvi.pszText,ECX
CALL SetSubItem
INC lvi.iItem
MOV lvi.pszText,Offset szID
CALL InsertNewItem
MOV ECX,[EDI].CONTROLDATA.ID
Invoke BinToDec,ECX,ADDR Buffer
LEA ECX,Buffer
MOV lvi.pszText,ECX
CALL SetSubItem
INC lvi.iItem
MOV lvi.pszText,Offset szLeftt
CALL InsertNewItem
MOV ECX,[EDI].CONTROLDATA.dux
Invoke BinToDec,ECX,ADDR Buffer
LEA ECX,Buffer
MOV lvi.pszText,ECX
CALL SetSubItem
INC lvi.iItem
MOV lvi.pszText,Offset szTop
CALL InsertNewItem
MOV ECX,[EDI].CONTROLDATA.duy
Invoke BinToDec,ECX,ADDR Buffer
LEA ECX,Buffer
MOV lvi.pszText,ECX
CALL SetSubItem
INC lvi.iItem
MOV lvi.pszText,Offset szWidth
CALL InsertNewItem
MOV ECX,[EDI].CONTROLDATA.duccx
Invoke BinToDec,ECX,ADDR Buffer
LEA ECX,Buffer
MOV lvi.pszText,ECX
CALL SetSubItem
INC lvi.iItem
MOV lvi.pszText,Offset szHeight
CALL InsertNewItem
MOV ECX,[EDI].CONTROLDATA.duccy
Invoke BinToDec,ECX,ADDR Buffer
LEA ECX,Buffer
MOV lvi.pszText,ECX
CALL SetSubItem
INC lvi.iItem
MOV lvi.pszText,Offset szStyle
CALL InsertNewItem
MOV ECX,[EDI].CONTROLDATA.Style
Invoke wsprintf, ADDR Buffer, Offset szColorTemplate,ECX
LEA ECX,Buffer
MOV lvi.pszText,ECX
CALL SetSubItem
INC lvi.iItem
MOV lvi.pszText,Offset szExStyle
CALL InsertNewItem
MOV ECX,[EDI].CONTROLDATA.ExStyle
Invoke wsprintf, ADDR Buffer, Offset szColorTemplate,ECX
LEA ECX,Buffer
MOV lvi.pszText,ECX
CALL SetSubItem
INC lvi.iItem
MOV lvi.pszText,Offset szVisibleProperty ;"Visible"
CALL InsertNewItem
.If [EDI].CONTROLDATA.ntype ;i.e. NOT a dialog
MOV ECX,[EDI].CONTROLDATA.NotStyle
.Else ;Thanks SeaFarer
MOV ECX,[EDI].CONTROLDATA.Style
NOT ECX
.EndIf
AND ECX,WS_VISIBLE
.If ECX
LEA ECX,szFALSE
.Else
LEA ECX,szTRUE
.EndIf
MOV lvi.pszText,ECX
CALL SetSubItem
.If [EDI].CONTROLDATA.ntype==0 || [EDI].CONTROLDATA.ntype==1 || ([EDI].CONTROLDATA.ntype >=3 && [EDI].CONTROLDATA.ntype <= 6) || [EDI].CONTROLDATA.ntype ==13 ;13=StatusBar
MOV lvi.pszText,Offset szCaption
.ElseIf [EDI].CONTROLDATA.ntype==2 || [EDI].CONTROLDATA.ntype==7 || [EDI].CONTROLDATA.ntype==20 || [EDI].CONTROLDATA.ntype==23 || [EDI].CONTROLDATA.ntype==24
MOV lvi.pszText,Offset szText
.ElseIf [EDI].CONTROLDATA.ntype==21 ;Image Control
MOV lvi.pszText,Offset szImage
.Else
JMP @F
.EndIf
INC lvi.iItem
CALL InsertNewItem
LEA ECX,[EDI].CONTROLDATA.Caption
;Let's see if this #..... is defined
.If [EDI].CONTROLDATA.ntype==21
.If BYTE PTR [ECX]=="#"
INC ECX
.EndIf
PUSH ECX
Invoke GetImageNameFromValue,ECX
POP ECX
.If EAX ;NOW EAX is a pointer to the name
MOV ECX,EAX
.EndIf
.EndIf
MOV lvi.pszText,ECX
CALL SetSubItem
@@:
.If [EDI].CONTROLDATA.ntype==0 || [EDI].CONTROLDATA.ntype==23
MOV lvi.pszText,Offset szClass
INC lvi.iItem
CALL InsertNewItem
LEA ECX,[EDI].CONTROLDATA.Class
MOV lvi.pszText,ECX
CALL SetSubItem
.EndIf
.If [EDI].CONTROLDATA.ntype==0
MOV lvi.pszText,Offset szMenu
INC lvi.iItem
CALL InsertNewItem
LEA ECX,[EDI].CONTROLDATA.MenuID
MOV lvi.pszText,ECX
CALL SetSubItem
MOV lvi.pszText,Offset szFont
INC lvi.iItem
CALL InsertNewItem
LEA ECX,[EDI].DIALOGDATA.FontName
MOV lvi.pszText,ECX
CALL SetSubItem
.EndIf
Invoke SendMessage,hPropertiesList,WM_SETREDRAW,TRUE,0
RET
InsertNewItem:
MOV lvi.iSubItem,0
Invoke SendMessage,hPropertiesList,LVM_INSERTITEM,0,ADDR lvi
RETN
SetSubItem:
MOV lvi.iSubItem,1
Invoke SendMessage, hPropertiesList, LVM_SETITEM, 0, ADDR lvi
RETN
SetProperties EndP
GetImageType Proc Uses EDI dwValue:DWORD
.If lpResourcesMem
MOV EAX,dwValue
MOV EDI,lpResourcesMem
.While [EDI].RESOURCEMEM.szFile
.If EAX==[EDI].RESOURCEMEM.Value
MOV EAX,[EDI].RESOURCEMEM.nType
JMP Ex
.EndIf
LEA EDI,[EDI+SizeOf RESOURCEMEM]
.EndW
.EndIf
MOV EAX,-1 ;i.e. not found
Ex:
RET
GetImageType EndP
;Returns value in EAX
GetImageValueFromName Proc Uses EDI lpName:DWORD
Local Buffer[256]:BYTE
.If lpResourcesMem
MOV EDI,lpResourcesMem
.While [EDI].RESOURCEMEM.szFile
Invoke lstrcmp,ADDR [EDI].RESOURCEMEM.szName,lpName
.If !EAX
MOV EAX,[EDI].RESOURCEMEM.Value
JMP Ex
.EndIf
LEA EDI,[EDI+SizeOf RESOURCEMEM]
.EndW
.EndIf
XOR EAX,EAX
Ex:
RET
GetImageValueFromName EndP
SelectComboListProc Proc Uses EBX EDI hWnd:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD
Local Buffer[256]:BYTE
.If uMsg==WM_LBUTTONUP || uMsg==WM_KEYDOWN
.If uMsg==WM_KEYDOWN && wParam!=VK_RETURN
.Else
Invoke SendMessage,hWnd,LB_GETCURSEL,0,0
.If EAX!=LB_ERR
MOV ECX,EAX
Invoke SendMessage,hWnd,LB_GETTEXT,ECX,ADDR Buffer
Invoke SendMessage,hPropertiesList,LVM_GETNEXTITEM,-1,LVNI_ALL or LVNI_SELECTED
.If EAX==-1
.Else
MOV EBX,EAX
;MOV RCModified,TRUE
Invoke SetRCModified,TRUE
Invoke SetItemText,hPropertiesList,EBX,1,ADDR Buffer
Invoke GetWindowLong,hSelectComboButton,GWL_USERDATA
MOV EDI,EAX
;PrintDec EBX
.If EBX==11 ;Menu
LEA ECX,[EDI].CONTROLDATA.MenuID
Invoke lstrcpy,ECX,ADDR Buffer
.ElseIf EBX==8 ;Visible
Invoke lstrcmp,ADDR Buffer,Offset szTRUE
.If EAX
OR [EDI].CONTROLDATA.NotStyle,WS_VISIBLE
AND [EDI].CONTROLDATA.Style,-1 XOR WS_VISIBLE
.Else
AND [EDI].CONTROLDATA.NotStyle,-1 XOR WS_VISIBLE
OR [EDI].CONTROLDATA.Style,WS_VISIBLE
.EndIf
Invoke wsprintf, ADDR Buffer, Offset szColorTemplate,[EDI].CONTROLDATA.Style
Invoke SetItemText,hPropertiesList,6,1,ADDR Buffer
.ElseIf EBX==9 ;Image
.If Buffer[0]!=0
Invoke GetImageValueFromName,ADDR Buffer
;PrintHex EAX
.If EAX ;means that there is a name and EAX holds the number
PUSH EAX
MOV Buffer[0],"#"
MOV ECX,EAX
Invoke BinToDec,ECX,ADDR Buffer[1]
Invoke lstrcpy,ADDR [EDI].CONTROLDATA.Caption,ADDR Buffer
POP EAX
.Else ;No name --> use what it is in buffer as a number
;PrintString Buffer
Invoke lstrcpy,ADDR [EDI].CONTROLDATA.Caption,CTEXT("#")
Invoke lstrcat,ADDR [EDI].CONTROLDATA.Caption,ADDR Buffer
Invoke DecToBin,ADDR Buffer
.EndIf
;EAX holds the image ID
Invoke GetImageType,EAX
.Else
Invoke lstrcpy,ADDR [EDI].CONTROLDATA.Caption,Offset szNULL
XOR EAX,EAX ;i.e. since no image is selected, let's have bitmap as default
.EndIf
;EAX holds the image type -->0=Bitmap, 2=icon
AND [EDI].CONTROLDATA.Style,-1 XOR (SS_ICON or SS_BITMAP)
.If EAX==0
MOV EAX,SS_BITMAP
.Else
MOV EAX,SS_ICON
.EndIf
OR [EDI].CONTROLDATA.Style,EAX
; Invoke SetWindowLong,[EDI].CONTROLDATA.hChild,GWL_STYLE,[EDI].CONTROLDATA.Style
;Update Style on properties list
Invoke wsprintf, ADDR Buffer, Offset szColorTemplate,[EDI].CONTROLDATA.Style
Invoke SetItemText,hPropertiesList,6,1,ADDR Buffer
;.If [EDI].CONTROLDATA.ntype==21 ;Image
Invoke ReCreateControl,EDI
; JMP @F
;.EndIf
; .If [EDI].CONTROLDATA.hImg
; Invoke DeleteObject,[EDI].CONTROLDATA.hImg
; .EndIf
;
; .If BYTE PTR [[EDI].CONTROLDATA.hChild]
; Invoke SetImageOfStaticControl,EDI
; .Else
; Invoke SendMessage,[EDI].CONTROLDATA.hChild,STM_SETIMAGE,NULL,NULL
; .EndIf
.EndIf
.EndIf
.EndIf
Invoke SetFocus,hPropertiesList
.EndIf
.ElseIf uMsg==WM_MOUSEMOVE
Invoke SendMessage,hWnd,LB_ITEMFROMPOINT,0,lParam
Invoke SendMessage,hWnd,LB_SETCURSEL,EAX,0
.ElseIf uMsg==WM_KILLFOCUS
Invoke ShowWindow,hWnd,SW_HIDE
.EndIf
Invoke CallWindowProc,lpPrevSelectComboListProc,hWnd,uMsg,wParam,lParam
RET
SelectComboListProc EndP
GetMenuNames Proc Uses EBX EDI
Local tvi :TVITEM
Local Buffer[256] :BYTE
Invoke SendMessage,hSelectComboList,LB_ADDSTRING,0,Offset szNULL
.If hMenusParentItem
MOV tvi._mask,TVIF_PARAM
Invoke SendMessage,hOthersTree,TVM_GETNEXTITEM,TVGN_CHILD,hMenusParentItem
MoreMenus:
;----------
.If EAX ;This is a Menu hItem
MOV EBX,EAX
MOV tvi.hItem,EBX
Invoke SendMessage,hOthersTree,TVM_GETITEM,0,ADDR tvi
MOV EDI,tvi.lParam; is the Menu memory
LEA EAX,[EDI].MNUHEAD.szMenuName
.If BYTE PTR [EAX]==0
Invoke BinToDec,[EDI].MNUHEAD.MenuID,ADDR Buffer
LEA EAX,Buffer
.EndIf
Invoke SendMessage,hSelectComboList,LB_ADDSTRING,0,EAX
.Else
JMP Finish
.EndIf
Invoke SendMessage,hOthersTree,TVM_GETNEXTITEM,TVGN_NEXT,EBX
JMP MoreMenus
.EndIf
Finish:
RET
GetMenuNames EndP
GetImages Proc Uses EDI
Local Buffer[256]:BYTE
.If lpResourcesMem
MOV EDI,lpResourcesMem
Invoke SendMessage,hSelectComboList,LB_ADDSTRING,0,Offset szNULL
.While [EDI].RESOURCEMEM.szFile
;nType: 0=Bitmap,1=Cursor,2=Icon,3=Avi,4=Manifest
.If [EDI].RESOURCEMEM.nType==0 || [EDI].RESOURCEMEM.nType==2
LEA EAX,[EDI].RESOURCEMEM.szName
.If BYTE PTR [EAX]==0
Invoke BinToDec,[EDI].RESOURCEMEM.Value,ADDR Buffer
LEA EAX,Buffer
.EndIf
Invoke SendMessage,hSelectComboList,LB_ADDSTRING,0,EAX
.EndIf
LEA EDI,[EDI+SizeOf RESOURCEMEM]
.EndW
.EndIf
RET
GetImages EndP
SelectComboButtonProc Proc Uses EBX hWnd:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD
Local Rect :RECT
Local Buffer[256] :BYTE
Local DesktopRect :RECT
.If uMsg==WM_LBUTTONDOWN
MOV fIsPushed,TRUE
Invoke CallWindowProc,lpPrevSelectComboButtonProc,hWnd,uMsg,wParam,lParam
PUSH EAX
Invoke IsWindowVisible,hSelectComboList
.If EAX==0
Invoke SendMessage,hPropertiesList,LVM_GETNEXTITEM,-1,LVNI_ALL or LVNI_SELECTED
.If EAX==8 || EAX==11 || EAX==9 ;Visible/Menus/Images
MOV EBX,EAX
Invoke SendMessage,hSelectComboList,LB_RESETCONTENT,0,0
.If EBX==11 ;menu
Invoke GetMenuNames
.ElseIf EBX==9 ;Image
Invoke GetImages
.ElseIf EBX==8 ;Visible
Invoke SendMessage,hSelectComboList,LB_ADDSTRING,0,Offset szTRUE
Invoke SendMessage,hSelectComboList,LB_ADDSTRING,0,Offset szFALSE
.EndIf
Invoke GetWindowRect,hWnd,ADDR Rect
PUSH Rect.right
Invoke RtlZeroMemory,ADDR Rect,SizeOf RECT
MOV Rect.top,1
MOV Rect.left,LVIR_LABEL
Invoke GetItemText,hPropertiesList,EBX,1,ADDR Buffer
Invoke SendMessage,hPropertiesList,LVM_GETSUBITEMRECT,EBX,ADDR Rect
Invoke MapWindowPoints,hPropertiesList,NULL,ADDR Rect,2
Invoke SendMessage,hSelectComboList,LB_GETITEMHEIGHT,0,0
MOV EBX,EAX
Invoke SendMessage,hSelectComboList,LB_GETCOUNT,0,0
.If EAX && EAX!=LB_ERR
Invoke MulDiv,EBX,EAX,1
MOV EBX,EAX
ADD EBX,2
.If EBX>120
MOV EBX,120
.EndIf
.Else
XOR EBX,EBX
.EndIf
Invoke GetDesktopWindow
MOV ECX,EAX
Invoke GetWindowRect,ECX,ADDR DesktopRect
MOV EAX,Rect.bottom
ADD EAX,EBX;80
.If EAX>DesktopRect.bottom
MOV EAX,Rect.top
SUB EAX,EBX;81;0
DEC EAX
.Else
MOV EAX,Rect.bottom
.EndIf
POP EDX
SUB EDX,Rect.left
Invoke SetWindowPos,hSelectComboList,HWND_TOPMOST,Rect.left,EAX,EDX,EBX,SWP_SHOWWINDOW; or SWP_NOACTIVATE
Invoke SendMessage,hSelectComboList,LB_FINDSTRINGEXACT,-1,ADDR Buffer
.If EAX!=LB_ERR
Invoke SendMessage,hSelectComboList,LB_SETCURSEL,EAX,0
.Else
Invoke SendMessage,hSelectComboList,LB_SETTOPINDEX,0,0
.EndIf
Invoke InvalidateRect,hSelectComboList,NULL,TRUE
;Invoke UpdateWindow,hSelectComboList
.EndIf
.Else
Invoke ShowWindow,hSelectComboList,SW_HIDE
.EndIf
Invoke SetCapture,hWnd
POP EAX
RET
.ElseIf uMsg==WM_LBUTTONUP
MOV fIsPushed,FALSE
Invoke ReleaseCapture
Invoke InvalidateRect,hWnd,NULL,TRUE
.ElseIf uMsg==WM_PAINT
Invoke CallWindowProc,lpPrevSelectComboButtonProc,hWnd,uMsg,wParam,lParam
PUSH EAX
Invoke DrawButton,hWnd,fIsPushed
POP EAX
RET
.EndIf
Invoke CallWindowProc,lpPrevSelectComboButtonProc,hWnd,uMsg,wParam,lParam
RET
SelectComboButtonProc EndP
ProjectTreeSelChange Proc Uses EBX hItem:HWND
MOV EBX,hItem
.If EBX==0 || EBX==hParentItem || EBX==hASMFilesItem || EBX==hModulesItem || EBX==hIncludeFilesItem || EBX== hResourceFilesItem || EBX==hTextFilesItem || EBX==hOtherFilesItem || EBX==hDefFilesItem || EBX==hBatchFilesItem
.Else
Invoke GetTreeItemParameter,WinAsmHandles.hProjTree,hItem
.If EAX
MOV EBX,EAX
;Invoke LockWindowUpdate,hClient
Invoke IsWindowVisible,EBX
.If !EAX && OpenChildStyle ;i.e. not visible
Invoke SetWindowPos,EBX,HWND_TOP,0,0,0,0,SWP_NOMOVE Or SWP_NOSIZE Or SWP_SHOWWINDOW
Invoke SendMessage,hClient,WM_MDIMAXIMIZE,EBX,0
.Else
Invoke SetWindowPos,EBX,HWND_TOP,0,0,0,0,SWP_NOMOVE Or SWP_NOSIZE Or SWP_SHOWWINDOW
.EndIf
;Invoke LockWindowUpdate,0
.EndIf
.EndIf
RET
ProjectTreeSelChange EndP
DialogsTreeSelChange Proc Uses EDI EBX hItem:HWND
Local tvi :TVITEM
Local lParam :DWORD
Invoke SetWindowPos,hRCEditorWindow,HWND_TOP,0,0,0,0,SWP_NOMOVE Or SWP_NOSIZE Or SWP_SHOWWINDOW
Invoke GetTreeItemParameter,hDialogsTree,hItem
MOV lParam,EAX
Invoke SetProperties,lParam
Invoke SendMessage, hDialogsTree, TVM_GETNEXTITEM,TVGN_PARENT,hItem
.If EAX==0 ;i.e this is an item that corresponds to a Dialog
MOV EAX,lParam
MOV EAX,[EAX].CONTROLDATA.hWnd ;EAX is the Dialog Handle
MOV EBX,EAX
.Else ;i.e this is an item that corresponds to a control
MOV EAX,lParam
MOV EBX,[EAX].CONTROLDATA.hWnd
Invoke SendMessage, hDialogsTree, TVM_GETNEXTITEM,TVGN_PARENT,hItem
MOV tvi._mask,TVIF_PARAM
MOV tvi.hItem,EAX
Invoke SendMessage,hDialogsTree,TVM_GETITEM,0,ADDR tvi
MOV EAX,tvi.lParam
MOV EAX,[EAX].CONTROLDATA.hWnd ;EAX is the Dialog Handle
.EndIf
.If EAX!=hADialog
PUSH EAX
Invoke ShowWindow,hADialog,SW_HIDE
Invoke SetScrollPos,hRCEditorWindow,SB_HORZ,0,TRUE
Invoke SetScrollPos,hRCEditorWindow,SB_VERT,0,TRUE
POP EAX
MOV hADialog,EAX
Invoke SetClipChildren,TRUE
Invoke SetWindowPos,hADialog,0,8,DIALOGSYMARGIN,0,0,SWP_NOSIZE or SWP_SHOWWINDOW
.EndIf
@@:
Invoke DeSelectWindow,hSelection
MOV hSelection,EAX
.If EAX
JMP @B
.EndIf
Invoke SelectWindow,EBX,TRUE
;Better Update if user keeps keyboard pressed
Invoke UpdateWindow,hDialogsTree
Invoke UpdateWindow,hRCEditorWindow
RET
DialogsTreeSelChange EndP
CreateBlocksList Proc hWnd:HWND
Local lvc:LV_COLUMN
; OR LVS_SHOWSELALWAYS
Invoke CreateWindowEx,WS_EX_CLIENTEDGE,Offset szListViewClass,NULL,WS_CHILD OR LVS_REPORT OR LVS_SINGLESEL OR LVS_NOCOLUMNHEADER OR LVS_SORTASCENDING,0, 0, 0, 0,hWnd,NULL,hInstance,0
;MOV WinAsmHandles.hBlocksList,EAX
MOV WinAsmHandles.hBlocksList,EAX
MOV EAX, LVS_EX_FULLROWSELECT OR LVS_EX_LABELTIP
Invoke SendMessage,WinAsmHandles.hBlocksList,LVM_SETEXTENDEDLISTVIEWSTYLE, 0, EAX
MOV lvc.imask, LVCF_WIDTH
MOV lvc.lx, 200
Invoke SendMessage, WinAsmHandles.hBlocksList, LVM_INSERTCOLUMN, 0, ADDR lvc
Invoke SendMessage, WinAsmHandles.hBlocksList, LVM_SETIMAGELIST, LVSIL_SMALL, hListAPIImageList
; Invoke SendMessage,WinAsmHandles.hBlocksList,WM_SETFONT,hFontTahoma,FALSE
RET
CreateBlocksList EndP
WindowStylesProc Proc Uses ESI EDI EBX hWnd:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD
Local lvc :LV_COLUMN
Local lvi :LVITEM
Local hList :HWND
Local Buffer[256] :BYTE
Local StyleRemaining:DWORD
.If uMsg==WM_INITDIALOG
MOV StyleExStyleChanged,FALSE
Invoke GetDlgItem,hWnd,1
MOV hList,EAX
MOV EAX, LVS_EX_FULLROWSELECT or LVS_EX_GRIDLINES OR LVS_EX_LABELTIP
Invoke SendMessage,hList,LVM_SETEXTENDEDLISTVIEWSTYLE, 0, EAX
MOV lvc.imask, LVCF_WIDTH or LVCF_FMT
MOV lvc.lx, 154
MOV lvc.fmt,LVCFMT_LEFT
Invoke SendMessage, hList, LVM_INSERTCOLUMN, 0, ADDR lvc
MOV lvc.lx, 35
MOV lvc.fmt,LVCFMT_CENTER
Invoke SendMessage, hList, LVM_INSERTCOLUMN, 1, ADDR lvc
MOV lvi.imask,LVIF_TEXT; OR LVIF_IMAGE
Invoke SetWindowText,hWnd,Offset szWindowStyles ;"Window Styles"
MOV ESI,Offset StyleDef
MOV lvi.iItem,-1
MOV lvi.cchTextMax,256
MOV EDI,lParam
MOV EAX,[EDI].CONTROLDATA.Style
MOV StyleRemaining,EAX
Invoke SetWindowLong,hWnd,GWL_USERDATA,EDI
.While BYTE PTR [ESI+4]
MOV ECX,[ESI]
.If !ECX; || ECX==WS_VISIBLE
JMP GetNextStyle
.EndIf
Invoke lstrcmp,ADDR [ESI+4],CTEXT("WS_CHILDWINDOW") ;Equ to WS_CHILD
.If !EAX
JMP GetNextStyle
.EndIf
.If [EDI].CONTROLDATA.ntype==0 ;i.e If this is a Dialog
.If WORD PTR [ESI+4]!="SD" && WORD PTR [ESI+4]!="SW"
JMP GetNextStyle
.EndIf
Invoke lstrcmp,ADDR [ESI+4],CTEXT("WS_OVERLAPPEDWINDOW") ;Equ to WS_OVERLAPPED OR WS_CAPTION OR WS_SYSMENU OR WS_THICKFRAME OR WS_MINIMIZEBOX OR WS_MAXIMIZEBOX
.If !EAX
JMP GetNextStyle
.EndIf
Invoke lstrcmp,ADDR [ESI+4],CTEXT("WS_POPUPWINDOW") ;Equ to WS_POPUP OR WS_BORDER OR WS_SYSMENU
.If !EAX
JMP GetNextStyle
.EndIf
Invoke lstrcmp,ADDR [ESI+4],CTEXT("WS_TABSTOP") ;Equ to WS_MAXIMIZEBOX
.If !EAX
JMP GetNextStyle
.EndIf
Invoke lstrcmp,ADDR [ESI+4],CTEXT("WS_THICKFRAME") ;Equ to WS_SIZEBOX
.If !EAX
JMP GetNextStyle
.EndIf
Invoke lstrcmp,ADDR [ESI+4],CTEXT("WS_ICONIC") ;Equ to WS_MINIMIZE
.If !EAX
JMP GetNextStyle
.EndIf
Invoke lstrcmp,ADDR [ESI+4],CTEXT("WS_TILEDWINDOW") ;Equ to WS_OVERLAPPEDWINDOW
.If !EAX
JMP GetNextStyle
.EndIf
Invoke lstrcmp,ADDR [ESI+4],CTEXT("DS_3DLOOK") ;Obsolete-not used
.If !EAX
JMP GetNextStyle
.EndIf
Invoke lstrcmp,ADDR [ESI+4],CTEXT("WS_GROUP") ;not suitable for dialogs???
.If !EAX
JMP GetNextStyle
.EndIf
.Else ;This is a control
Invoke lstrcmp,ADDR [ESI+4],CTEXT("WS_MAXIMIZEBOX") ;Equ to WS_TABSTOP
.If !EAX
JMP GetNextStyle
.EndIf
Invoke lstrcmp,ADDR [ESI+4],CTEXT("WS_MINIMIZEBOX") ;Equ to WS_GROUP
.If !EAX
JMP GetNextStyle
.EndIf
;----------------------------------------------------------------
Invoke lstrcmp,ADDR [ESI+4],CTEXT("WS_MAXIMIZE") ;Equ to ES_SELECTIONBAR && ES_EX_NOCALLOLEINIT
.If !EAX
JMP GetNextStyle
.EndIf
Invoke lstrcmp,ADDR [ESI+4],CTEXT("WS_SYSMENU") ;Equ to ES_NOIME
.If !EAX
JMP GetNextStyle
.EndIf
Invoke lstrcmp,ADDR [ESI+4],CTEXT("WS_THICKFRAME") ;Equ to ES_SELFIME
.If !EAX
JMP GetNextStyle
.EndIf
Invoke lstrcmp,ADDR [ESI+4],CTEXT("WS_SIZEBOX") ;Equ to WS_THICKFRAME==ES_SELFIME
.If !EAX
JMP GetNextStyle
.EndIf
MOV ECX,DWORD PTR [ESI]
.If ECX==WS_MINIMIZE || ECX==WS_OVERLAPPEDWINDOW || ECX==WS_TILEDWINDOW || ECX==WS_ICONIC || ECX==WS_POPUP || ECX==WS_POPUPWINDOW || ECX==WS_CAPTION
JMP GetNextStyle
.EndIf
.If [EDI].CONTROLDATA.ntype==1 ;Static
.If WORD PTR [ESI+4]!="SS" && WORD PTR [ESI+4]!="SW"
JMP GetNextStyle
.EndIf
;|| ECX==SS_OWNERDRAW
;|| ECX==SS_CENTERIMAGE
.If ECX==SS_REALSIZEIMAGE || ECX==SS_ICON || ECX==SS_BITMAP || (ECX>=SS_BLACKRECT && ECX<=SS_WHITEFRAME) || ECX==SS_USERITEM || (ECX>=SS_ETCHEDHORZ && ECX<=SS_ETCHEDFRAME)
JMP GetNextStyle
.EndIf
.ElseIf [EDI].CONTROLDATA.ntype==2 ;Edit
.If WORD PTR [ESI+4]!="SE" && WORD PTR [ESI+4]!="SW"
JMP GetNextStyle
.EndIf
;Rich Edit only
.If ECX==ES_SAVESEL || ECX==ES_SUNKEN || ECX==ES_SELECTIONBAR || ECX==ES_EX_NOCALLOLEINIT || ECX==ES_VERTICAL || ECX==ES_NOIME || ECX==ES_SELFIME
JMP GetNextStyle
.EndIf
Invoke lstrcmp,ADDR [ESI+4],CTEXT("ES_DISABLENOSCROLL") ;Equ to ES_NUMBER
.If !EAX
JMP GetNextStyle
.EndIf
.ElseIf [EDI].CONTROLDATA.ntype==3 ;GroupBox
.If WORD PTR [ESI+4]!="SB" && WORD PTR [ESI+4]!="SW"
JMP GetNextStyle
.EndIf
;MOV ECX,DWORD PTR [ESI]
.If ECX==BS_LEFTTEXT || ECX==BS_USERBUTTON || ECX==BS_OWNERDRAW || ECX==BS_PUSHLIKE || ECX==BS_3STATE || ECX==BS_AUTO3STATE || ECX==BS_AUTOCHECKBOX || ECX==BS_AUTORADIOBUTTON || ECX==BS_CHECKBOX || ECX==BS_DEFPUSHBUTTON || ECX==BS_PUSHBUTTON || ECX== BS_RADIOBUTTON
JMP GetNextStyle
.EndIf
.ElseIf [EDI].CONTROLDATA.ntype==4 ;BS_PUSHBUTTON & BS_DEFPUSHBUTTON
.If WORD PTR [ESI+4]!="SB" && WORD PTR [ESI+4]!="SW"
JMP GetNextStyle
.EndIf
;MOV ECX,DWORD PTR [ESI]
.If ECX==BS_LEFTTEXT || ECX==BS_GROUPBOX || ECX==BS_USERBUTTON || ECX==BS_OWNERDRAW || ECX==BS_PUSHLIKE || ECX==BS_3STATE || ECX==BS_AUTO3STATE || ECX==BS_AUTOCHECKBOX || ECX==BS_AUTORADIOBUTTON || ECX==BS_CHECKBOX || ECX== BS_RADIOBUTTON
JMP GetNextStyle
.EndIf
.ElseIf [EDI].CONTROLDATA.ntype==5 ;BS_AUTOCHECKBOX
.If WORD PTR [ESI+4]!="SB" && WORD PTR [ESI+4]!="SW"
JMP GetNextStyle
.EndIf
.If ECX==BS_USERBUTTON || ECX==BS_OWNERDRAW || ECX==BS_AUTORADIOBUTTON || ECX==BS_DEFPUSHBUTTON || ECX==BS_GROUPBOX || ECX==BS_PUSHBUTTON || ECX== BS_RADIOBUTTON
JMP GetNextStyle
.EndIf
.ElseIf [EDI].CONTROLDATA.ntype==6 ;BS_RADIOBUTTON
.If WORD PTR [ESI+4]!="SB" && WORD PTR [ESI+4]!="SW"
JMP GetNextStyle
.EndIf
.If ECX==BS_USERBUTTON || ECX==BS_OWNERDRAW || ECX==BS_DEFPUSHBUTTON || ECX==BS_GROUPBOX || ECX==BS_PUSHBUTTON || ECX==BS_AUTOCHECKBOX || ECX==BS_CHECKBOX || ECX==BS_3STATE || ECX==BS_AUTO3STATE
JMP GetNextStyle
.EndIf
.ElseIf [EDI].CONTROLDATA.ntype==7 ;ComboBox
.If WORD PTR [ESI+4]!="BC" && WORD PTR [ESI+4]!="SW"
JMP GetNextStyle
.EndIf
.ElseIf [EDI].CONTROLDATA.ntype==8 ;ListBox
.If WORD PTR [ESI+4]!="BL" && WORD PTR [ESI+4]!="SW"
JMP GetNextStyle
.EndIf
.If ECX==LBS_STANDARD ;=LBS_NOTIFY OR LBS_SORT OR WS_VSCROLL OR WS_BORDER=A00003
JMP GetNextStyle