-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCodeShot.Asm
2374 lines (1866 loc) · 82.2 KB
/
CodeShot.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
;=====================================================================================
; x64dbg plugin SDK for Masm - fearless 2016 - www.LetTheLight.in
;
; CodeShot.asm
;
;-------------------------------------------------------------------------------------
.686
.MMX
.XMM
.model flat,stdcall
option casemap:none
;DEBUG32 EQU 1
IFDEF DEBUG32
PRESERVEXMMREGS equ 1
includelib M:\Masm32\lib\Debug32.lib
DBG32LIB equ 1
DEBUGEXE textequ <'M:\Masm32\DbgWin.exe'>
include M:\Masm32\include\debug32.inc
ENDIF
Include x64dbgpluginsdk.inc ; Main x64dbg Plugin SDK for your program, and prototypes for the main exports
include x64dbgpluginsdk_x86.inc
includelib x64dbgpluginsdk_x86.lib
Include CodeShot.inc ; plugin's include file
include CodeShotIni.asm
include CodeShotDate.asm
;=====================================================================================
.CONST
PLUGIN_VERSION EQU 1
.DATA
PLUGIN_NAME DB "CodeShot",0
.DATA?
;-------------------------------------------------------------------------------------
; GLOBAL Plugin SDK variables
;-------------------------------------------------------------------------------------
PUBLIC pluginHandle
PUBLIC hwndDlg
PUBLIC hMenu
PUBLIC hMenuDisasm
PUBLIC hMenuDump
PUBLIC hMenuStack
pluginHandle DD ?
hwndDlg DD ?
hMenu DD ?
hMenuDisasm DD ?
hMenuDump DD ?
hMenuStack DD ?
;-------------------------------------------------------------------------------------
.CODE
;=====================================================================================
; Main entry function for a DLL file - required.
;-------------------------------------------------------------------------------------
DllMain PROC hinstDLL:HINSTANCE, fdwReason:DWORD, lpvReserved:DWORD
.IF fdwReason == DLL_PROCESS_ATTACH
mov eax, hinstDLL
mov hInstance, eax
.ENDIF
mov eax,TRUE
ret
DllMain ENDP
;=====================================================================================
; pluginit - Called by debugger when plugin.dp32 is loaded - needs to be EXPORTED
;
; Arguments: initStruct - a pointer to a PLUG_INITSTRUCT structure
;
; Notes: you must fill in the pluginVersion, sdkVersion and pluginName members.
; The pluginHandle is obtained from the same structure - it may be needed in
; other function calls.
;
; you can call your own setup routine from within this function to setup
; menus and commands, and pass the initStruct parameter to this function.
;
;-------------------------------------------------------------------------------------
pluginit PROC C PUBLIC USES EBX initStruct:DWORD
mov ebx, initStruct
; Fill in required information of initStruct, which is a pointer to a PLUG_INITSTRUCT structure
mov eax, PLUGIN_VERSION
mov [ebx].PLUG_INITSTRUCT.pluginVersion, eax
mov eax, PLUG_SDKVERSION
mov [ebx].PLUG_INITSTRUCT.sdkVersion, eax
Invoke lstrcpy, Addr [ebx].PLUG_INITSTRUCT.pluginName, Addr PLUGIN_NAME
mov ebx, initStruct
mov eax, [ebx].PLUG_INITSTRUCT.pluginHandle
mov pluginHandle, eax
; Do any other initialization here
; Construct plugin's .ini file from module filename
Invoke GetModuleFileName, 0, Addr szModuleFilename, SIZEOF szModuleFilename
Invoke GetModuleFileName, 0, Addr X64DBGINIFILE, SIZEOF X64DBGINIFILE
Invoke GetModuleFileName, hInstance, Addr CodeShotIni, SIZEOF CodeShotIni
Invoke szLen, Addr CodeShotIni
lea ebx, CodeShotIni
add ebx, eax
sub ebx, 4 ; move back past 'dp32' extention
mov byte ptr [ebx], 0 ; null so we can use lstrcat
Invoke szCatStr, ebx, Addr szIni ; add 'ini' to end of string instead
; get main .ini file for x32/64dbg.exe
Invoke szLen, Addr X64DBGINIFILE
lea ebx, X64DBGINIFILE
add ebx, eax
sub ebx, 3 ; move back past 'exe' extention
mov byte ptr [ebx], 0 ; null so we can use lstrcat
Invoke szCatStr, ebx, Addr szIni ; add 'ini' to end of string instead
;PrintString X64DBGINIFILE
Invoke CS_GetCodeShotsFolder
Invoke GdiplusStartup, Addr CODESHOT_GDIPlusToken, Addr CODESHOT_gdipsi, NULL
mov eax, TRUE
ret
pluginit ENDP
;=====================================================================================
; plugstop - Called by debugger when the plugin.dp32 is unloaded - needs to be EXPORTED
;
; Arguments: none
;
; Notes: perform cleanup operations here, clearing menus and other housekeeping
;
;-------------------------------------------------------------------------------------
plugstop PROC C PUBLIC
; remove any menus, unregister any callbacks etc
Invoke UnregisterHotKey, hQToolbar, 0
Invoke UnregisterHotKey, hQToolbar, 1
Invoke UnregisterHotKey, hQToolbar, 2
Invoke UnregisterHotKey, hQToolbar, 3
.IF hCodeShotToolbar != NULL
Invoke _plugin_stoptoolbargui
.ENDIF
Invoke GdiplusShutdown, CODESHOT_GDIPlusToken
Invoke _plugin_menuclear, hMenu
Invoke GuiAddLogMessage, Addr szCodeShotUnloaded
mov eax, TRUE
ret
plugstop ENDP
;=====================================================================================
; plugsetup - Called by debugger to initialize your plugins setup - needs to be EXPORTED
;
; Arguments: setupStruct - a pointer to a PLUG_SETUPSTRUCT structure
;
; Notes: setupStruct contains useful handles for use within x64dbg, mainly Qt
; menu handles (which are not supported with win32 api) and the main window
; handle with this information you can add your own menus and menu items
; to an existing menu, or one of the predefined supported right click
; context menus: hMenuDisam, hMenuDump & hMenuStack
;
; plugsetup is called after pluginit.
;-------------------------------------------------------------------------------------
plugsetup PROC C PUBLIC USES EBX setupStruct:DWORD
LOCAL hIconData:ICONDATA
mov ebx, setupStruct
; Extract handles from setupStruct which is a pointer to a PLUG_SETUPSTRUCT structure
mov eax, [ebx].PLUG_SETUPSTRUCT.hwndDlg
mov hwndDlg, eax
mov eax, [ebx].PLUG_SETUPSTRUCT.hMenu
mov hMenu, eax
mov eax, [ebx].PLUG_SETUPSTRUCT.hMenuDisasm
mov hMenuDisasm, eax
mov eax, [ebx].PLUG_SETUPSTRUCT.hMenuDump
mov hMenuDump, eax
mov eax, [ebx].PLUG_SETUPSTRUCT.hMenuStack
mov hMenuStack, eax
mov hMainScreen, 0
Invoke _plugin_getmainscreenhandle, Addr hMainScreen
;PrintDec hMainScreen
;Invoke GuiGetWindowHandle
;PrintDec eax
.IF hMainScreen == 0
Invoke GuiAddLogMessage, Addr szFailedToGetMainScreen
.ENDIF
Invoke LoadImage, hInstance, ICO_CODESHOT, IMAGE_ICON, 0, 0, 0
mov hIcoCodeShot, eax
Invoke LoadImage, hInstance, ICO_TAKECODESHOT, IMAGE_ICON, 0, 0, 0
mov hIcoTakeCodeShot, eax
; Load menu icons for popup dropdown menu
Invoke LoadBitmap, hInstance, BMP_MENU_CODESHOT_PNG
mov hBmpMenuCodeShotPng, eax
Invoke LoadBitmap, hInstance, BMP_MENU_CODESHOT_JPG
mov hBmpMenuCodeShotJpg, eax
Invoke LoadBitmap, hInstance, BMP_MENU_CODESHOT_BMP
mov hBmpMenuCodeShotBmp, eax
Invoke LoadBitmap, hInstance, BMP_MENU_CODESHOT_OPTIONS
mov hBmpMenuCodeShotOptions, eax
Invoke LoadBitmap, hInstance, BMP_MENU_CODESHOT_FOLDER
mov hBmpMenuCodeShotFolder, eax
; Read ini settings
Invoke IniGetCameraShutterClick
mov g_CameraShutterClick, eax
Invoke IniGetSeperateFolderForModules
mov g_SeperateFolderForModules, eax
Invoke IniGetImageFileIncludeAddress
mov g_ImageFileIncludeAddress, eax
Invoke IniGetDefaultImageType
mov g_ImageType, eax
Invoke IniGetImageCompression
mov g_ImageCompression, eax
Invoke IniGetShowToolbarButton
mov g_ShowToolbarButton, eax
Invoke IniGetImageFileIncludeDatetime
mov g_ImageFileIncludeDatetime, eax
Invoke IniGetExcludeStatusBar
mov g_ExcludeStatusBar, eax
Invoke IniGetExcludeCommandBar
mov g_ExcludeCommandBar, eax
mov hCodeShotToolbar, 0
.IF g_ShowToolbarButton == 1
Invoke _plugin_starttoolbargui, Addr CC_CodeShotToolbarProc, Addr CC_CodeShotToolbarInitProc
.ENDIF
; Do any setup here: add menus, menu items, callback and commands etc
Invoke _plugin_menuaddentry, hMenu, MENU_CODESHOT, Addr szTakeCodeShot
Invoke _plugin_menuaddentry, hMenu, MENU_CODESHOT_OPTIONS, Addr szCodeShotOptions
;Invoke _plugin_loadmenuicon, hInstance, IMG_CODESHOT, Addr hIconData
;.IF eax == TRUE
; Invoke _plugin_menuseticon, hMenu, Addr hIconData
; ;Invoke _plugin_menuentryseticon, pluginHandle, MENU_CODESHOT, Addr hIconData
;.ENDIF
Invoke _plugin_loadmenuicon, hInstance, IMG_CODESHOT_OPTIONS, Addr hIconData
.IF eax == TRUE
Invoke _plugin_menuentryseticon, pluginHandle, MENU_CODESHOT_OPTIONS, Addr hIconData
.ENDIF
Invoke _plugin_loadmenuicon, hInstance, IMG_TAKECODESHOT, Addr hIconData
.IF eax == TRUE
Invoke _plugin_menuseticon, hMenu, Addr hIconData
Invoke _plugin_menuentryseticon, pluginHandle, MENU_CODESHOT, Addr hIconData
.ENDIF
Invoke _plugin_menuaddseparator, hMenu
Invoke _plugin_menuaddentry, hMenu, MENU_CODESHOT_FOLDER, Addr szMenuCodeshotOpenFolder
Invoke _plugin_loadmenuicon, hInstance, IMG_CODESHOT_FOLDER, Addr hIconData
.IF eax == TRUE
Invoke _plugin_menuentryseticon, pluginHandle, MENU_CODESHOT_FOLDER, Addr hIconData
.ENDIF
Invoke GuiAddLogMessage, Addr szCodeShotInfo
ret
plugsetup ENDP
;=====================================================================================
; CC_CodeShotToolbarProc
;-------------------------------------------------------------------------------------
CC_CodeShotToolbarProc PROC USES EBX ECX hWin:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM, uIdSubclass:UINT, dwRefData:DWORD
LOCAL hParent:DWORD
;LOCAL hControl:DWORD
LOCAL lpThreadId:DWORD
LOCAL wNotifyCode:DWORD
LOCAL VK_HOTKEY:DWORD
LOCAL rect:RECT
mov eax, uMsg
;.IF eax == WM_NCDESTROY
; Invoke DestroyWindow, dwRefData
; Invoke RemoveWindowSubclass, hWin, Addr GUIRedirectionProc, uIdSubclass ; remove subclass before control destroyed.
.IF eax == WM_COMMAND
mov eax, wParam
shr eax, 16
mov wNotifyCode, eax
mov eax,wParam
and eax,0FFFFh
.IF eax == IDC_TOOLBAR_BTN || eax == TB_CODESHOT
Invoke DbgIsDebugging
.IF eax == FALSE
Invoke GuiAddLogMessage, Addr szDebuggingRequired
.ELSE
Invoke CS_TakeCodeShot, NULL
.ENDIF
.ELSEIF eax == IDM_CODESHOT_PNG
Invoke DbgIsDebugging
.IF eax == FALSE
Invoke GuiAddLogMessage, Addr szDebuggingRequired
.ELSE
Invoke CS_TakeCodeShot, IMAGE_TYPE_PNG
.ENDIF
.ELSEIF eax == IDM_CODESHOT_JPG
Invoke DbgIsDebugging
.IF eax == FALSE
Invoke GuiAddLogMessage, Addr szDebuggingRequired
.ELSE
Invoke CS_TakeCodeShot, IMAGE_TYPE_JPG
.ENDIF
.ELSEIF eax == IDM_CODESHOT_BMP
Invoke DbgIsDebugging
.IF eax == FALSE
Invoke GuiAddLogMessage, Addr szDebuggingRequired
.ELSE
Invoke CS_TakeCodeShot, IMAGE_TYPE_BMP
.ENDIF
;Invoke CreateThread, NULL, NULL, Addr CS_TakeCodeShot, IMAGE_TYPE_PNG, NULL, Addr lpThreadId
.ELSEIF eax == IDM_CODESHOT_OPTIONS
Invoke DialogBoxParam, hInstance, IDD_OPTIONSDLG, hwndDlg, Addr CodeShotOptionsDlgProc, NULL
.ELSEIF eax == IDM_CODESHOT_FOLDER
Invoke CS_OpenCodeShotsFolder
.ENDIF
.ELSEIF eax == WM_NOTIFY
mov ecx, lParam ; lParam is a pointer to a NMHDR Struct
mov eax, (NMHDR PTR [ecx]).code
mov ebx, (NMHDR PTR [ecx]).hwndFrom
.IF eax == NM_CUSTOMDRAW
;PrintText 'NMTBCUSTOMDRAW'
.IF ebx == hCodeShotToolbar
;PrintText 'hCodeShotToolbar'
Invoke GetClientRect, hCodeShotToolbar, Addr rect
;Invoke GetStockObject, LTGRAY_BRUSH
Invoke GetSysColorBrush, COLOR_BTNFACE
mov ecx, lParam
mov ebx, (NMTBCUSTOMDRAW PTR [ecx]).nmcd.hdc
Invoke FillRect, ebx, Addr rect, eax
.ENDIF
.ELSEIF eax == TBN_DROPDOWN
;PrintText 'TBN_DROPDOWN'
Invoke GetWindowRect, hCodeShotToolbar, Addr rect
;Invoke ClientToScreen, hToolBarConnect, Addr TrayMenuPoint
Invoke MapWindowPoints, hCodeShotToolbar, NULL, Addr rect, 2
push eax
mov ebx, rect.bottom
mov ecx, rect.top
sub ecx, ebx
shr eax, 16
sub eax, ecx
mov TrayMenuPoint.y, eax
pop eax
and eax,0FFFFh
mov TrayMenuPoint.x, eax
;Invoke GetCursorPos, addr TrayMenuPoint
;sub TrayMenuPoint.x, 10d
;add TrayMenuPoint.y, 10d
; Focus Main Window - ; Fix for shortcut menu not popping up right
Invoke SetForegroundWindow, hWin
Invoke TrackPopupMenu, hCodeShotMenu, TPM_LEFTALIGN +TPM_LEFTBUTTON, TrayMenuPoint.x, TrayMenuPoint.y, NULL, hWin, NULL
Invoke PostMessage, hWin, WM_NULL, 0, 0 ; Fix for shortcut menu not popping up right
.ENDIF
.ELSEIF eax == WM_SIZE
mov eax, lParam
and eax,0FFFFh
.IF eax > 1024d
Invoke GetParent, hWin
mov hParent, eax
Invoke GetClientRect, hParent, Addr rect
;PrintDec rect.right
mov eax, rect.right
sub eax, 48;26
mov rect.left, eax
;Invoke GetDlgItem, hWin, IDC_TOOLBAR ;_BTN
;mov hControl, eax
Invoke SetWindowPos, hCodeShotToolbar, HWND_TOP, rect.left, 2, 0, 0, SWP_NOZORDER + SWP_NOSIZE
.ENDIF
.ELSEIF eax == WM_HOTKEY
mov eax, lParam
shr eax, 16
mov VK_HOTKEY, eax
mov eax,lParam
and eax,0FFFFh
.IF wParam == 0 ; possible Ctrl+Printscreen
.IF eax == MOD_CONTROL
mov eax, VK_HOTKEY
.IF eax == VK_CODESHOT
Invoke CS_TakeCodeShot, NULL
.ENDIF
.ENDIF
.ELSEIF wParam == 1
.IF eax == MOD_CONTROL
mov eax, VK_HOTKEY
.IF eax == VK_1
Invoke CS_TakeCodeShot, IMAGE_TYPE_PNG
.ENDIF
.ENDIF
.ELSEIF wParam == 2
.IF eax == MOD_CONTROL
mov eax, VK_HOTKEY
.IF eax == VK_2
Invoke CS_TakeCodeShot, IMAGE_TYPE_JPG
.ENDIF
.ENDIF
.ELSEIF wParam == 3
.IF eax == MOD_CONTROL
mov eax, VK_HOTKEY
.IF eax == VK_3
Invoke CS_TakeCodeShot, IMAGE_TYPE_BMP
.ENDIF
.ENDIF
.ENDIF
.ENDIF
Invoke DefSubclassProc, hWin, uMsg, wParam, lParam
ret
CC_CodeShotToolbarProc ENDP
;=====================================================================================
; CC_CodeShotToolbarInitProc
;-------------------------------------------------------------------------------------
CC_CodeShotToolbarInitProc PROC hMainWindow:DWORD, hMenubar:DWORD, hToolbar:DWORD
LOCAL rect:RECT
LOCAL hinstance:DWORD
LOCAL tbab:TBADDBITMAP ; Add Bitmap Structure
LOCAL tbb:TBBUTTON ; Button Structure
LOCAL hTbBmp:DWORD ; Toolbar bitmap handle
LOCAL dwSize:DWORD
LOCAL dwStyle:DWORD
LOCAL buffer[64]:BYTE
mov eax, hToolbar
mov hQToolbar, eax
Invoke GetModuleHandle, NULL
mov hinstance, eax
Invoke GetClientRect, hMainWindow, Addr rect
mov eax, WS_CHILD + WS_VISIBLE + TBSTYLE_CUSTOMERASE + TBSTYLE_TRANSPARENT + TBSTYLE_TOOLTIPS + TBSTYLE_FLAT + CCS_NORESIZE + CCS_NODIVIDER
mov dwStyle, eax
mov eax, rect.right
sub eax, 48;26
Invoke CreateWindowEx, 0, Addr szToolbarClass, NULL, dwStyle, eax, 2, 48, 22, hToolbar, IDC_TOOLBAR, hinstance, NULL ;+ TBSTYLE_TRANSPARENT 24
mov hCodeShotToolbar, eax
;Invoke GetParent, hCodeShotToolbar
;PrintDec eax
;PrintDec hToolbar
Invoke ImageList_Create, 16,16, ILC_COLOR32, 1, 2
mov hCodeShotIL_Enabled, eax
Invoke ImageList_Create, 16,16, ILC_COLOR32, 1, 2
mov hCodeShotIL_Disabled, eax
Invoke SendMessage, hCodeShotToolbar, CCM_SETVERSION, 5, 0
Invoke SendMessage, hCodeShotToolbar, TB_SETIMAGELIST, 0, hCodeShotIL_Enabled
Invoke SendMessage, hCodeShotToolbar, TB_SETDISABLEDIMAGELIST, 0, hCodeShotIL_Disabled
Invoke ImageList_AddIcon, hCodeShotIL_Enabled, hIcoTakeCodeShot
Invoke ImageList_AddIcon, hCodeShotIL_Disabled, hIcoTakeCodeShot
invoke SendMessage, hCodeShotToolbar, TB_BUTTONSTRUCTSIZE, sizeof TBBUTTON, 0 ; Set toolbar struct size
mov ebx, 16d ;Wd ; loword = bitmap Width
mov eax, 16d ;Ht ; hiword = bitmap Height
shl eax, 16d
mov ax, bx
mov dwSize, eax
;invoke SendMessage, hCodeShotToolbar, TB_SETBITMAPSIZE, 0, dwSize ; Set bitmap size
invoke SendMessage, hCodeShotToolbar, TB_SETBUTTONSIZE, 0, dwSize ; Set each button size
Invoke SendMessage, hCodeShotToolbar, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_DRAWDDARROWS
mov tbb.fsState, TBSTATE_ENABLED
mov tbb.dwData, 0
mov tbb.iString, 0
mov tbb.iBitmap, 0 ;; button ID number
mov tbb.idCommand, TB_CODESHOT ;; command ID number
mov tbb.fsStyle, TBSTYLE_BUTTON or TBSTYLE_AUTOSIZE or TBSTYLE_DROPDOWN
invoke SendMessage, hCodeShotToolbar, TB_ADDBUTTONS, 1, ADDR tbb
; for without dropdown button comment out after TBSTYLE_BUTTON, adjust to: mov eax, rect.right sub eax, 26, adjust WM_SIZE to same 26d instead of 48d
;Invoke CC_InitRebar, hMainWindow, hMenubar, hToolbar
invoke CreateWindowEx, NULL, addr tiClass, NULL, TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hCodeShotToolbar, NULL, hinstance, NULL
mov hToolTip, eax
mov ti.cbSize, SIZEOF TOOLINFO
mov ti.uFlags, TTF_SUBCLASS or TTF_IDISHWND
mov eax, hCodeShotToolbar
mov ti.TOOLINFO.uId, eax
Invoke LoadString, hInstance, 1001, Addr buffer, 64d
lea eax, szCodeShotTooltipText;buffer
mov ti.TOOLINFO.lpszText, eax
Invoke SendMessage, hToolTip, TTM_ADDTOOL, NULL, Addr ti
Invoke CS_BuildCodeShotMenu
Invoke RegisterHotKey, hToolbar, 0, MOD_CONTROL + MOD_NOREPEAT, VK_CODESHOT
Invoke RegisterHotKey, hToolbar, 1, MOD_CONTROL + MOD_NOREPEAT, VK_1
Invoke RegisterHotKey, hToolbar, 2, MOD_CONTROL + MOD_NOREPEAT, VK_2
Invoke RegisterHotKey, hToolbar, 3, MOD_CONTROL + MOD_NOREPEAT, VK_3
mov eax, 0
ret
CC_CodeShotToolbarInitProc ENDP
;=====================================================================================
; CC_InitRebar
;-------------------------------------------------------------------------------------
CC_InitRebar PROC hMainWindow:DWORD, hMenubar:DWORD, hToolbar:DWORD
LOCAL hinstance:DWORD
LOCAL rect:RECT
LOCAL RebarInfo:REBARINFO
LOCAL rbbi:REBARBANDINFO
LOCAL tbhandl:DWORD
LOCAL tbTile:DWORD
Invoke GetModuleHandle, NULL
mov hinstance, eax
Invoke GetClientRect, hMainWindow, Addr rect
mov eax, rect.right
sub eax, 26
Invoke CreateWindowEx, 0, Addr szRebarClass, NULL, WS_CHILD + WS_VISIBLE + RBS_TOOLTIPS , eax, 2, 24, 24, hToolbar, IDC_REBAR, hinstance, NULL ;+ TBSTYLE_TRANSPARENT RBS_BANDBORDERS RBS_FIXEDORDER
mov hCodeShotRebar, eax
;PrintDec hCodeShotRebar
mov rbbi.cbSize,SIZEOF REBARBANDINFO
mov rbbi.fMask, RBBIM_ID or RBBIM_STYLE or RBBIM_CHILDSIZE or RBBIM_CHILD ;
mov rbbi.wID, IDC_TOOLBAR
mov rbbi.fStyle, RBBS_FIXEDSIZE or RBBS_CHILDEDGE;RBBS_CHILDEDGE or RBBS_FIXEDSIZE
mov rbbi.lx,0;100
mov rbbi.cxMinChild,22
mov rbbi.cyMinChild,22
mov rbbi.cyChild,22
mov eax, hCodeShotToolbar
mov rbbi.hwndChild, eax
invoke SendMessage, hCodeShotRebar, RB_INSERTBAND, 0, ADDR rbbi
Invoke SendMessage, hCodeShotRebar, RB_SETBKCOLOR, 0, 0F0F0F0h
ret
CC_InitRebar ENDP
;=====================================================================================
; CBMENUENTRY - Called by debugger when a menu item is clicked - needs to be EXPORTED
;
; Arguments: cbType
; cbInfo - a pointer to a PLUG_CB_MENUENTRY structure. The hEntry contains
; the resource id of menu item identifiers
;
; Notes: hEntry can be used to determine if the user has clicked on your plugins
; menu item(s) and to do something in response to it.
; Needs to be PROC C type procedure call to be compatible with debugger
;-------------------------------------------------------------------------------------
CBMENUENTRY PROC C PUBLIC USES EBX cbType:DWORD, cbInfo:DWORD
mov ebx, cbInfo
mov eax, [ebx].PLUG_CB_MENUENTRY.hEntry
.IF eax == MENU_CODESHOT
Invoke DbgIsDebugging
.IF eax == FALSE
Invoke GuiAddLogMessage, Addr szDebuggingRequired
mov eax, FALSE
ret
.ENDIF
Invoke CS_TakeCodeShot, g_ImageType ;IMAGE_TYPE_PNG
.ELSEIF eax == MENU_CODESHOT_OPTIONS
Invoke DialogBoxParam, hInstance, IDD_OPTIONSDLG, hwndDlg, Addr CodeShotOptionsDlgProc, NULL
.ELSEIF eax == MENU_CODESHOT_FOLDER
Invoke CS_OpenCodeShotsFolder
.ENDIF
ret
CBMENUENTRY ENDP
CBINITDEBUG PROC C PUBLIC USES EBX cbType:DWORD, cbInfo:DWORD
;Invoke EnableWindow, hCodeShotToolbarButtonControl, TRUE
;Invoke ShowWindow, hCodeShotToolbarButtonControl, SW_SHOW
ret
CBINITDEBUG ENDP
CBSTOPDEBUG PROC C PUBLIC USES EBX cbType:DWORD, cbInfo:DWORD
;Invoke ShowWindow, hCodeShotToolbarButtonControl, SW_HIDE
;Invoke EnableWindow, hCodeShotToolbarButtonControl, FALSE
ret
CBSTOPDEBUG ENDP
;=====================================================================================
; CodeShot Dialog Procedure
;-------------------------------------------------------------------------------------
CodeShotOptionsDlgProc PROC hWin:HWND,iMsg:DWORD,wParam:WPARAM, lParam:LPARAM
mov eax, iMsg
.IF eax == WM_INITDIALOG
Invoke GetDlgItem, hWin, IDC_MENUTEXT
mov hMenuText, eax
Invoke SetWindowText, hMenuText, Addr szOptionsMenu0Text
;-----------------------------------------------------------------------------------------------------
; ModernUI_CaptionBar & ModernUI style dialog
;-----------------------------------------------------------------------------------------------------
Invoke MUIApplyToDialog, hWin, FALSE, TRUE
; Create CaptionBar control and save handle
Invoke MUICaptionBarCreate, hWin, Addr szCSOptionsDlgTitle, 26, IDC_CAPTIONBAR, MUICS_WINNODROPSHADOW + MUICS_NOMAXBUTTON + MUICS_NOMINBUTTON + MUICS_LEFT ;or MUICS_REDCLOSEBUTTON
mov hCaptionBar, eax
; Set some properties for our CaptionBar control
Invoke MUICaptionBarSetProperty, hCaptionBar, @CaptionBarBackColor, MUI_RGBCOLOR(27,161,226)
Invoke MUICaptionBarSetProperty, hCaptionBar, @CaptionBarBtnTxtRollColor, MUI_RGBCOLOR(61,61,61)
Invoke MUICaptionBarSetProperty, hCaptionBar, @CaptionBarBtnBckRollColor, MUI_RGBCOLOR(87,193,244)
;-----------------------------------------------------------------------------------------------------
; Create ModernUI_Button controls for our menu items
Invoke MUIButtonCreate, hWin, Addr szOptionsMenu5Text, 1, 27, 220, 43, IDC_OPTIONSMENUITEM5, MUIBS_LEFT ;+ MUIBS_HAND
mov hPreMenuBtn, eax
Invoke MUIButtonSetAllProperties, hPreMenuBtn, Addr MUI_MENUITEM_DARK_THEME_BLANK_2, SIZEOF MUI_BUTTON_PROPERTIES
Invoke MUIButtonCreate, hWin, Addr szOptionsMenu0Text, 1, 70, 220, 45, IDC_OPTIONSMENUITEM0, MUIBS_LEFT ;+ MUIBS_HAND
mov hOptionsMenu0, eax
Invoke MUIButtonSetProperty, hOptionsMenu0, @ButtonDllInstance, hInstance
Invoke MUIButtonLoadImages, hOptionsMenu0, MUIBIT_ICO, ICO_OPTIONS_IMAGE, ICO_OPTIONS_IMAGE, ICO_OPTIONS_IMAGE, ICO_OPTIONS_IMAGE, ICO_OPTIONS_IMAGE
Invoke MUIButtonSetAllProperties, hOptionsMenu0, Addr MUI_MENUITEM_DARK_THEME_2, SIZEOF MUI_BUTTON_PROPERTIES
Invoke MUIButtonCreate, hWin, Addr szOptionsMenu1Text, 1, 115, 220, 45, IDC_OPTIONSMENUITEM1, MUIBS_LEFT + MUIBS_HAND
mov hOptionsMenu1, eax
Invoke MUIButtonSetProperty, hOptionsMenu1, @ButtonDllInstance, hInstance
Invoke MUIButtonLoadImages, hOptionsMenu1, MUIBIT_ICO, ICO_OPTIONS_CAMERA, ICO_OPTIONS_CAMERA, ICO_OPTIONS_CAMERA, ICO_OPTIONS_CAMERA, ICO_OPTIONS_CAMERA
Invoke MUIButtonSetAllProperties, hOptionsMenu1, Addr MUI_MENUITEM_DARK_THEME_2, SIZEOF MUI_BUTTON_PROPERTIES
; Create our ModernUI_Button control
Invoke MUIButtonCreate, hWin, Addr szOptionsMenu2Text, 1, 160, 220, 45, IDC_OPTIONSMENUITEM2, MUIBS_LEFT + MUIBS_HAND
mov hOptionsMenu2, eax
Invoke MUIButtonSetProperty, hOptionsMenu2, @ButtonDllInstance, hInstance
Invoke MUIButtonLoadImages, hOptionsMenu2, MUIBIT_ICO, ICO_OPTIONS_FILE, ICO_OPTIONS_FILE, ICO_OPTIONS_FILE, ICO_OPTIONS_FILE, ICO_OPTIONS_FILE
Invoke MUIButtonSetAllProperties, hOptionsMenu2, Addr MUI_MENUITEM_DARK_THEME_2, SIZEOF MUI_BUTTON_PROPERTIES
; Create our ModernUI_Button control
Invoke MUIButtonCreate, hWin, Addr szOptionsMenu3Text, 1, 205, 220, 45, IDC_OPTIONSMENUITEM3, MUIBS_LEFT + MUIBS_HAND
mov hOptionsMenu3, eax
Invoke MUIButtonSetProperty, hOptionsMenu3, @ButtonDllInstance, hInstance
Invoke MUIButtonLoadImages, hOptionsMenu3, MUIBIT_ICO, ICO_OPTIONS_FOLDER, ICO_OPTIONS_FOLDER, ICO_OPTIONS_FOLDER, ICO_OPTIONS_FOLDER, ICO_OPTIONS_FOLDER
Invoke MUIButtonSetAllProperties, hOptionsMenu3, Addr MUI_MENUITEM_DARK_THEME_2, SIZEOF MUI_BUTTON_PROPERTIES
Invoke MUIButtonCreate, hWin, Addr szOptionsMenu4Text, 1, 250, 220, 45, IDC_OPTIONSMENUITEM4, MUIBS_LEFT + MUIBS_HAND
mov hOptionsMenu4, eax
Invoke MUIButtonSetProperty, hOptionsMenu4, @ButtonDllInstance, hInstance
Invoke MUIButtonLoadImages, hOptionsMenu4, MUIBIT_ICO, ICO_OPTIONS_EXIT, ICO_OPTIONS_EXIT, ICO_OPTIONS_EXIT, ICO_OPTIONS_EXIT, ICO_OPTIONS_EXIT
Invoke MUIButtonSetAllProperties, hOptionsMenu4, Addr MUI_MENUITEM_DARK_THEME_2, SIZEOF MUI_BUTTON_PROPERTIES
Invoke MUIButtonCreate, hWin, Addr szOptionsMenu5Text, 1, 295, 220, 45, IDC_OPTIONSMENUITEM5, MUIBS_LEFT ;+ MUIBS_HAND
mov hOptionsMenu5, eax
Invoke MUIButtonSetAllProperties, hOptionsMenu5, Addr MUI_MENUITEM_DARK_THEME_BLANK_2, SIZEOF MUI_BUTTON_PROPERTIES
Invoke MUIButtonSetState, hOptionsMenu0, TRUE
; smart panel container
Invoke MUISmartPanelCreate, hWin, 221, 70, 387, 215, IDC_SP1, MUISPS_NORMAL ;327
mov hSP1, eax
Invoke MUISmartPanelSetProperty, hSP1, @SmartPanelDllInstance, hInstance
;Invoke SmartPanelSetIsDlgMsgVar, hSP1, Addr hCurrentPanel
Invoke MUISmartPanelRegisterPanel, hSP1, IDD_OptionsPanel0, Addr OptionsPanel0Proc
mov hOptionsPanel0, eax
Invoke MUISmartPanelRegisterPanel, hSP1, IDD_OptionsPanel1, Addr OptionsPanel1Proc
mov hOptionsPanel1, eax
Invoke MUISmartPanelRegisterPanel, hSP1, IDD_OptionsPanel2, Addr OptionsPanel2Proc
mov hOptionsPanel2, eax
Invoke MUISmartPanelRegisterPanel, hSP1, IDD_OptionsPanel3, Addr OptionsPanel3Proc
mov hOptionsPanel3, eax
Invoke MUISmartPanelSetCurrentPanel, hSP1, 0, FALSE
;Invoke SendMessage, hSP1, MUISPM_SETCURRENTPANEL, 0, FALSE
;---------------------------------------------------------------------------------------------------------------
; Handle painting of our dialog with our specified background and border color to mimic new Modern style UI feel
;---------------------------------------------------------------------------------------------------------------
.ELSEIF eax == WM_ERASEBKGND
mov eax, 1
ret
.ELSEIF eax == WM_PAINT
invoke MUIPaintBackground, hWin, MUI_RGBCOLOR(240,240,240), MUI_RGBCOLOR(51,51,51) ;MUI_RGBCOLOR(27,161,226) 240,240,240
mov eax, 0
ret
;---------------------------------------------------------------------------------------------------------------
.ELSEIF eax == WM_CLOSE
Invoke EndDialog, hWin, NULL
.ELSEIF eax == WM_COMMAND
mov eax, wParam
and eax, 0FFFFh
.IF eax == IDC_OPTIONSMENUITEM0
Invoke MUIButtonSetState, hOptionsMenu0, TRUE
Invoke MUIButtonSetState, hOptionsMenu1, FALSE
Invoke MUIButtonSetState, hOptionsMenu2, FALSE
Invoke MUIButtonSetState, hOptionsMenu3, FALSE
Invoke MUISmartPanelSetCurrentPanel, hSP1, 0, TRUE
Invoke SetWindowText, hMenuText, Addr szOptionsMenu0Text
.ELSEIF eax == IDC_OPTIONSMENUITEM1
Invoke MUIButtonSetState, hOptionsMenu0, FALSE
Invoke MUIButtonSetState, hOptionsMenu1, TRUE
Invoke MUIButtonSetState, hOptionsMenu2, FALSE
Invoke MUIButtonSetState, hOptionsMenu3, FALSE
Invoke MUISmartPanelSetCurrentPanel, hSP1, 1, TRUE
Invoke SetWindowText, hMenuText, Addr szOptionsMenu1Text
.ELSEIF eax == IDC_OPTIONSMENUITEM2
Invoke MUIButtonSetState, hOptionsMenu0, FALSE
Invoke MUIButtonSetState, hOptionsMenu1, FALSE
Invoke MUIButtonSetState, hOptionsMenu2, TRUE
Invoke MUIButtonSetState, hOptionsMenu3, FALSE
Invoke MUISmartPanelSetCurrentPanel, hSP1, 2, TRUE
Invoke SetWindowText, hMenuText, Addr szOptionsMenu2Text
.ELSEIF eax == IDC_OPTIONSMENUITEM3
Invoke MUIButtonSetState, hOptionsMenu0, FALSE
Invoke MUIButtonSetState, hOptionsMenu1, FALSE
Invoke MUIButtonSetState, hOptionsMenu2, FALSE
Invoke MUIButtonSetState, hOptionsMenu3, TRUE
Invoke MUISmartPanelSetCurrentPanel, hSP1, 3, TRUE
Invoke SetWindowText, hMenuText, Addr szOptionsMenu3Text
.ELSEIF eax == IDC_OPTIONSMENUITEM4
Invoke SendMessage, hWin, WM_CLOSE, NULL, NULL
.ENDIF
.ELSE
mov eax, FALSE
ret
.ENDIF
mov eax, TRUE
ret
CodeShotOptionsDlgProc ENDP
;------------------------------------------------------------------------------
; OptionsPanel0Proc
;------------------------------------------------------------------------------
OptionsPanel0Proc PROC USES EBX hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
mov eax, uMsg
.IF eax==WM_INITDIALOG
IFDEF DEBUG32
;PrintText 'OptionsPanel1Proc:WM_INITDIALOG'
ENDIF
Invoke MUIButtonCreate, hWin, Addr szInfoImageFormat, 20, 11, 130, 24, IDC_INFOIMAGEFORMAT, MUIBS_LEFT
mov hBtnInfoImageFormat, eax
Invoke MUIButtonSetProperty, hBtnInfoImageFormat, @ButtonTextColor, MUI_RGBCOLOR(51,51,51)
Invoke MUIButtonSetProperty, hBtnInfoImageFormat, @ButtonTextColorAlt, MUI_RGBCOLOR(51,51,51)
Invoke MUIButtonSetProperty, hBtnInfoImageFormat, @ButtonBackColor, MUI_RGBCOLOR(240,240,240)
Invoke MUIButtonSetProperty, hBtnInfoImageFormat, @ButtonBackColorAlt, MUI_RGBCOLOR(240,240,240)
Invoke MUIButtonSetProperty, hBtnInfoImageFormat, @ButtonBorderStyle, MUIBBS_NONE
Invoke MUICheckboxCreate, hWin, Addr szRadio1Text, 150, 11, 70, 24, IDC_RADIO1, MUICS_HAND
mov hRadio1, eax
Invoke MUICheckboxSetProperty, hRadio1, @CheckboxDllInstance, hInstance
Invoke MUICheckboxLoadImages, hRadio1, MUICIT_ICO, ICO_MUI_NOSETRADIO, ICO_MUI_NOSETRADIO, ICO_MUI_RADIO, ICO_MUI_RADIO, ICO_MUI_RADIO, ICO_MUI_RADIO
Invoke MUICheckboxCreate, hWin, Addr szRadio2Text, 220, 11, 70, 24, IDC_RADIO2, MUICS_HAND
mov hRadio2, eax
Invoke MUICheckboxSetProperty, hRadio2, @CheckboxDllInstance, hInstance
Invoke MUICheckboxLoadImages, hRadio2, MUICIT_ICO, ICO_MUI_NOSETRADIO, ICO_MUI_NOSETRADIO, ICO_MUI_RADIO, ICO_MUI_RADIO, ICO_MUI_RADIO, ICO_MUI_RADIO
Invoke MUICheckboxCreate, hWin, Addr szRadio3Text, 290, 11, 70, 24, IDC_RADIO3, MUICS_HAND
mov hRadio3, eax
Invoke MUICheckboxSetProperty, hRadio3, @CheckboxDllInstance, hInstance
Invoke MUICheckboxLoadImages, hRadio3, MUICIT_ICO, ICO_MUI_NOSETRADIO, ICO_MUI_NOSETRADIO, ICO_MUI_RADIO, ICO_MUI_RADIO, ICO_MUI_RADIO, ICO_MUI_RADIO
Invoke szCopy, Addr szJpegQuality, Addr szInfoJpegQuality
Invoke utoa_ex, g_ImageCompression, Addr szImageCompressionValue
Invoke szCatStr, Addr szInfoJpegQuality, Addr szImageCompressionValue
Invoke MUIButtonCreate, hWin, Addr szInfoJpegQuality, 20, 48, 135, 24, IDC_INFOJPEGQUALITY, MUIBS_LEFT
mov hBtnInfoJpegQuality, eax
Invoke MUIButtonSetProperty, hBtnInfoJpegQuality, @ButtonTextColor, MUI_RGBCOLOR(51,51,51)
Invoke MUIButtonSetProperty, hBtnInfoJpegQuality, @ButtonTextColorAlt, MUI_RGBCOLOR(51,51,51)
Invoke MUIButtonSetProperty, hBtnInfoJpegQuality, @ButtonBackColor, MUI_RGBCOLOR(240,240,240)
Invoke MUIButtonSetProperty, hBtnInfoJpegQuality, @ButtonBackColorAlt, MUI_RGBCOLOR(240,240,240)
Invoke MUIButtonSetProperty, hBtnInfoJpegQuality, @ButtonBorderStyle, MUIBBS_NONE
Invoke CreateWindowEx, NULL, Addr szTrackbarClass, NULL, WS_CHILD + WS_VISIBLE + TBS_HORZ + TBS_NOTICKS + TBS_FIXEDLENGTH + TBS_NOTIFYBEFOREMOVE, 152, 48, 210, 24, hWin, IDC_TRACKJPEGQUALITY, hInstance, NULL ;+TBS_TRANSPARENTBKGND +TBS_FIXEDLENGTH+ +TBS_TRANSPARENTBKGND TBS_AUTOTICKS+
mov hTrackbarJpegQuality, eax
Invoke SendMessage, hTrackbarJpegQuality, TBM_SETRANGEMIN, FALSE, 50
Invoke SendMessage, hTrackbarJpegQuality, TBM_SETRANGEMAX, FALSE, 100
Invoke SendMessage, hTrackbarJpegQuality, TBM_SETPOS, TRUE, g_ImageCompression
mov eax, g_ImageType
.IF eax == IMAGE_TYPE_BMP
Invoke MUICheckboxSetState, hRadio1, TRUE
Invoke MUICheckboxSetState, hRadio2, FALSE
Invoke MUICheckboxSetState, hRadio3, FALSE
Invoke EnableWindow, hTrackbarJpegQuality, FALSE
.ELSEIF eax == IMAGE_TYPE_JPG
Invoke MUICheckboxSetState, hRadio1, FALSE
Invoke MUICheckboxSetState, hRadio2, TRUE
Invoke MUICheckboxSetState, hRadio3, FALSE
Invoke EnableWindow, hTrackbarJpegQuality, TRUE
.ELSEIF eax == IMAGE_TYPE_PNG
Invoke MUICheckboxSetState, hRadio1, FALSE
Invoke MUICheckboxSetState, hRadio2, FALSE
Invoke MUICheckboxSetState, hRadio3, TRUE
Invoke InvalidateRect, hRadio3, NULL, TRUE
Invoke EnableWindow, hTrackbarJpegQuality, FALSE
.ENDIF
.ELSEIF eax == WM_COMMAND
mov eax,wParam
and eax,0FFFFh
.IF eax == IDC_RADIO1
Invoke MUICheckboxSetState, hRadio1, TRUE
Invoke MUICheckboxSetState, hRadio2, FALSE
Invoke MUICheckboxSetState, hRadio3, FALSE
mov eax, IMAGE_TYPE_BMP
mov g_ImageType, eax
Invoke IniSetDefaultImageType, IMAGE_TYPE_BMP
Invoke EnableWindow, hTrackbarJpegQuality, FALSE
.ELSEIF eax == IDC_RADIO2
Invoke MUICheckboxSetState, hRadio1, FALSE
Invoke MUICheckboxSetState, hRadio2, TRUE
Invoke MUICheckboxSetState, hRadio3, FALSE
mov eax, IMAGE_TYPE_JPG
mov g_ImageType, eax
Invoke IniSetDefaultImageType, IMAGE_TYPE_JPG
Invoke EnableWindow, hTrackbarJpegQuality, TRUE
.ELSEIF eax == IDC_RADIO3
Invoke MUICheckboxSetState, hRadio1, FALSE
Invoke MUICheckboxSetState, hRadio2, FALSE
Invoke MUICheckboxSetState, hRadio3, TRUE
mov eax, IMAGE_TYPE_PNG
mov g_ImageType, eax
Invoke IniSetDefaultImageType, IMAGE_TYPE_PNG
Invoke EnableWindow, hTrackbarJpegQuality, FALSE
.ENDIF
Invoke CS_GenExampleFilename, g_ImageType
Invoke SetWindowText, hBtnFileGen, Addr CODESHOT_EXAMPLEFILE
.ELSEIF eax == WM_NOTIFY
mov ebx, lParam ; lParam is a pointer to a NMHDR Struct
mov eax, (NMHDR PTR [ebx]).code
mov ebx, (NMHDR PTR [ebx]).hwndFrom
.IF ebx == hTrackbarJpegQuality
.IF eax == TRBN_THUMBPOSCHANGING
mov ebx, lParam
mov eax, (NMTRBTHUMBPOSCHANGING ptr [ebx]).dwPos
mov g_ImageCompression, eax
Invoke szCopy, Addr szJpegQuality, Addr szInfoJpegQuality
Invoke utoa_ex, g_ImageCompression, Addr szImageCompressionValue
Invoke szCatStr, Addr szInfoJpegQuality, Addr szImageCompressionValue
Invoke SetWindowText, hBtnInfoJpegQuality, Addr szInfoJpegQuality
Invoke IniSetImageCompression, g_ImageCompression
.ENDIF
.ENDIF
.ELSEIF eax == WM_ERASEBKGND
mov eax, 1
ret
.ELSEIF eax == WM_PAINT
invoke MUIPaintBackground, hWin, MUI_RGBCOLOR(240,240,240), 0
.ELSEIF eax==WM_CLOSE
invoke DestroyWindow, hWin
.ELSE
mov eax,FALSE
ret
.ENDIF
mov eax,TRUE
ret
OptionsPanel0Proc ENDP
;------------------------------------------------------------------------------
; OptionsPanel1Proc
;------------------------------------------------------------------------------
OptionsPanel1Proc PROC hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
mov eax, uMsg
.IF eax==WM_INITDIALOG
Invoke MUICheckboxCreate, hWin, Addr szCheckbox1Text, 20, 11, 350, 24, IDC_CHECKBOX1, MUICS_HAND
mov hChk1, eax
Invoke MUICheckboxSetProperty, hChk1, @CheckboxDllInstance, hInstance
Invoke MUICheckboxLoadImages, hChk1, MUICIT_ICO, ICO_MUI_NOCHECKMARK, ICO_MUI_NOCHECKMARK, ICO_MUI_CHECKMARK, ICO_MUI_CHECKMARK, ICO_MUI_NOCHECKMARK, ICO_MUI_NOCHECKMARK
; Invoke MUICheckboxCreate, hWin, Addr szCheckbox2Text, 20, 48, 350, 24, IDC_CHECKBOX2, MUICS_HAND
; mov hChk2, eax
; Invoke MUICheckboxSetProperty, hChk2, @CheckboxDllInstance, hInstance
; Invoke MUICheckboxLoadImages, hChk2, MUICIT_ICO, ICO_MUI_NOCHECKMARK, ICO_MUI_NOCHECKMARK, ICO_MUI_CHECKMARK, ICO_MUI_CHECKMARK, ICO_MUI_NOCHECKMARK, ICO_MUI_NOCHECKMARK
.IF g_ExcludeStatusBar == 1
Invoke MUICheckboxSetState, hChk1, TRUE
.ENDIF
.IF g_ExcludeCommandBar == 1
Invoke MUICheckboxSetState, hChk2, TRUE
.ENDIF
.ELSEIF eax == WM_COMMAND
mov eax,wParam
and eax,0FFFFh
.IF eax == IDC_CHECKBOX1
Invoke MUICheckboxGetState, hChk1
.IF eax == TRUE
mov g_ExcludeStatusBar, 1
Invoke IniSetExcludeStatusBar, 1
.ELSE
mov g_ExcludeStatusBar, 0
Invoke IniSetExcludeStatusBar, 0
.ENDIF
; .ELSEIF eax == IDC_CHECKBOX2
; Invoke MUICheckboxGetState, hChk2