/
WinAPITheme.au3
794 lines (672 loc) · 40.5 KB
/
WinAPITheme.au3
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
#include-once
#include "APIThemeConstants.au3"
#include "WinAPIInternals.au3"
; #INDEX# =======================================================================================================================
; Title .........: WinAPI Extended UDF Library for AutoIt3
; AutoIt Version : 3.3.13.12
; Description ...: Additional variables, constants and functions for the WinAPITheme.au3
; Author(s) .....: Yashied, jpm
; ===============================================================================================================================
#Region Global Variables and Constants
; #VARIABLES# ===================================================================================================================
; ===============================================================================================================================
; #CONSTANTS# ===================================================================================================================
Global Const $tagDTTOPTS = 'dword Size;dword Flags;dword clrText;dword clrBorder;dword clrShadow;int TextShadowType;' & $tagPOINT & ';int BorderSize;int FontPropId;int ColorPropId;int StateId;int ApplyOverlay;int GlowSize;ptr DrawTextCallback;lparam lParam'
; ===============================================================================================================================
#EndRegion Global Variables and Constants
#Region Functions list
; #CURRENT# =====================================================================================================================
; _WinAPI_BeginBufferedPaint
; _WinAPI_BufferedPaintClear
; _WinAPI_BufferedPaintInit
; _WinAPI_BufferedPaintSetAlpha
; _WinAPI_BufferedPaintUnInit
; _WinAPI_CloseThemeData
; _WinAPI_DrawThemeBackground
; _WinAPI_DrawThemeEdge
; _WinAPI_DrawThemeIcon
; _WinAPI_DrawThemeParentBackground
; _WinAPI_DrawThemeText
; _WinAPI_DrawThemeTextEx
; _WinAPI_EndBufferedPaint
; _WinAPI_GetBufferedPaintBits
; _WinAPI_GetBufferedPaintDC
; _WinAPI_GetBufferedPaintTargetDC
; _WinAPI_GetBufferedPaintTargetRect
; _WinAPI_GetCurrentThemeName
; _WinAPI_GetThemeAppProperties
; _WinAPI_GetThemeBackgroundContentRect
; _WinAPI_GetThemeBackgroundExtent
; _WinAPI_GetThemeBackgroundRegion
; _WinAPI_GetThemeBitmap
; _WinAPI_GetThemeBool
; _WinAPI_GetThemeColor
; _WinAPI_GetThemeDocumentationProperty
; _WinAPI_GetThemeEnumValue
; _WinAPI_GetThemeFilename
; _WinAPI_GetThemeFont
; _WinAPI_GetThemeInt
; _WinAPI_GetThemeMargins
; _WinAPI_GetThemeMetric
; _WinAPI_GetThemePartSize
; _WinAPI_GetThemePosition
; _WinAPI_GetThemePropertyOrigin
; _WinAPI_GetThemeRect
; _WinAPI_GetThemeString
; _WinAPI_GetThemeSysBool
; _WinAPI_GetThemeSysColor
; _WinAPI_GetThemeSysColorBrush
; _WinAPI_GetThemeSysFont
; _WinAPI_GetThemeSysInt
; _WinAPI_GetThemeSysSize
; _WinAPI_GetThemeSysString
; _WinAPI_GetThemeTextExtent
; _WinAPI_GetThemeTextMetrics
; _WinAPI_GetThemeTransitionDuration
; _WinAPI_GetWindowTheme
; _WinAPI_IsThemeActive
; _WinAPI_IsThemeBackgroundPartiallyTransparent
; _WinAPI_IsThemePartDefined
; _WinAPI_OpenThemeData
; _WinAPI_SetThemeAppProperties
; _WinAPI_SetWindowTheme
; ===============================================================================================================================
#EndRegion Functions list
#Region Public Functions
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: Jpm
; ===============================================================================================================================
Func _WinAPI_BeginBufferedPaint($hDC, $tTarget, ByRef $hNewDC, $iFormat = 0, $iFlags = 0, $tExclude = 0, $iAlpha = -1)
Local Const $tagBP_PAINTPARAMS = 'dword cbSize;dword dwFlags;ptr prcExclude;ptr pBlendFunction'
Local $tPP = DllStructCreate($tagBP_PAINTPARAMS)
$hNewDC = 0
Local $tBF = 0
If $iAlpha <> -1 Then
$tBF = DllStructCreate($tagBLENDFUNCTION)
DllStructSetData($tBF, 1, 0)
DllStructSetData($tBF, 2, 0)
DllStructSetData($tBF, 3, $iAlpha)
DllStructSetData($tBF, 4, 1)
EndIf
DllStructSetData($tPP, 1, DllStructGetSize($tPP))
DllStructSetData($tPP, 2, $iFlags)
DllStructSetData($tPP, 3, DllStructGetPtr($tExclude))
DllStructSetData($tPP, 4, DllStructGetPtr($tBF))
Local $aRet = DllCall('uxtheme.dll', 'handle', 'BeginBufferedPaint', 'handle', $hDC, 'struct*', $tTarget, 'dword', $iFormat, _
'struct*', $tPP, 'handle*', 0)
If @error Or Not $aRet[0] Then Return SetError(@error, @extended, 0)
$hNewDC = $aRet[5]
Return $aRet[0]
EndFunc ;==>_WinAPI_BeginBufferedPaint
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_BufferedPaintClear($hBP, $tRECT = 0)
Local $aRet = DllCall('uxtheme.dll', 'long', 'BufferedPaintClear', 'handle', $hBP, 'struct*', $tRECT)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return 1
EndFunc ;==>_WinAPI_BufferedPaintClear
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_BufferedPaintInit()
Local $aRet = DllCall('uxtheme.dll', 'long', 'BufferedPaintInit')
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return 1
EndFunc ;==>_WinAPI_BufferedPaintInit
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_BufferedPaintSetAlpha($hBP, $iAlpha = 255, $tRECT = 0)
Local $aRet = DllCall('uxtheme.dll', 'long', 'BufferedPaintSetAlpha', 'handle', $hBP, 'struct*', $tRECT, 'byte', $iAlpha)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return 1
EndFunc ;==>_WinAPI_BufferedPaintSetAlpha
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_BufferedPaintUnInit()
Local $aRet = DllCall('uxtheme.dll', 'long', 'BufferedPaintUnInit')
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return 1
EndFunc ;==>_WinAPI_BufferedPaintUnInit
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_CloseThemeData($hTheme)
Local $aRet = DllCall('uxtheme.dll', 'long', 'CloseThemeData', 'handle', $hTheme)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return 1
EndFunc ;==>_WinAPI_CloseThemeData
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_DrawThemeBackground($hTheme, $iPartId, $iStateId, $hDC, $tRECT, $tCLIP = 0)
Local $aRet = DllCall('uxtheme.dll', 'long', 'DrawThemeBackground', 'handle', $hTheme, 'handle', $hDC, 'int', $iPartId, _
'int', $iStateId, 'struct*', $tRECT, 'struct*', $tCLIP)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return 1
EndFunc ;==>_WinAPI_DrawThemeBackground
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_DrawThemeEdge($hTheme, $iPartId, $iStateId, $hDC, $tRECT, $iEdge, $iFlags, $tAREA = 0)
Local $aRet = DllCall('uxtheme.dll', 'long', 'DrawThemeEdge', 'handle', $hTheme, 'handle', $hDC, 'int', $iPartId, _
'int', $iStateId, 'struct*', $tRECT, 'uint', $iEdge, 'uint', $iFlags, 'struct*', $tAREA)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return 1
EndFunc ;==>_WinAPI_DrawThemeEdge
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_DrawThemeIcon($hTheme, $iPartId, $iStateId, $hDC, $tRECT, $hIL, $iIndex)
Local $aRet = DllCall('uxtheme.dll', 'long', 'DrawThemeIcon', 'handle', $hTheme, 'handle', $hDC, 'int', $iPartId, _
'int', $iStateId, 'struct*', $tRECT, 'handle', $hIL, 'int', $iIndex)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return 1
EndFunc ;==>_WinAPI_DrawThemeIcon
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_DrawThemeParentBackground($hWnd, $hDC, $tRECT = 0)
Local $aRet = DllCall('uxtheme.dll', 'long', 'DrawThemeParentBackground', 'hwnd', $hWnd, 'handle', $hDC, 'struct*', $tRECT)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return 1
EndFunc ;==>_WinAPI_DrawThemeParentBackground
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_DrawThemeText($hTheme, $iPartId, $iStateId, $hDC, $sText, $tRECT, $iFlags)
Local $aRet = DllCall('uxtheme.dll', 'long', 'DrawThemeText', 'handle', $hTheme, 'handle', $hDC, 'int', $iPartId, _
'int', $iStateId, 'wstr', $sText, 'int', -1, 'dword', $iFlags, 'dword', 0, 'struct*', $tRECT)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return 1
EndFunc ;==>_WinAPI_DrawThemeText
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_DrawThemeTextEx($hTheme, $iPartId, $iStateId, $hDC, $sText, $tRECT, $iFlags, $tDTTOPTS)
Local $aRet = DllCall('uxtheme.dll', 'long', 'DrawThemeTextEx', 'handle', $hTheme, 'handle', $hDC, 'int', $iPartId, _
'int', $iStateId, 'wstr', $sText, 'int', -1, 'dword', $iFlags, 'struct*', $tRECT, 'struct*', $tDTTOPTS)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return 1
EndFunc ;==>_WinAPI_DrawThemeTextEx
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_EndBufferedPaint($hBP, $bUpdate = True)
Local $aRet = DllCall('uxtheme.dll', 'long', 'EndBufferedPaint', 'handle', $hBP, 'bool', $bUpdate)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return 1
EndFunc ;==>_WinAPI_EndBufferedPaint
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetBufferedPaintBits($hBP)
Local $aRet = DllCall('uxtheme.dll', 'long', 'GetBufferedPaintBits', 'handle', $hBP, 'ptr*', 0, 'int*', 0)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return SetExtended($aRet[3], $aRet[2])
EndFunc ;==>_WinAPI_GetBufferedPaintBits
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetBufferedPaintDC($hBP)
Local $aRet = DllCall('uxtheme.dll', 'handle', 'GetBufferedPaintDC', 'handle', $hBP)
If @error Then Return SetError(@error, @extended, 0)
Return $aRet[0]
EndFunc ;==>_WinAPI_GetBufferedPaintDC
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetBufferedPaintTargetDC($hBP)
Local $aRet = DllCall('uxtheme.dll', 'handle', 'GetBufferedPaintTargetDC', 'handle', $hBP)
If @error Then Return SetError(@error, @extended, 0)
Return $aRet[0]
EndFunc ;==>_WinAPI_GetBufferedPaintTargetDC
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetBufferedPaintTargetRect($hBP)
Local $tRECT = DllStructCreate($tagRECT)
Local $aRet = DllCall('uxtheme.dll', 'long', 'GetBufferedPaintTargetRect', 'handle', $hBP, 'struct*', $tRECT)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return $tRECT
EndFunc ;==>_WinAPI_GetBufferedPaintTargetRect
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetCurrentThemeName()
Local $aRet = DllCall('uxtheme.dll', 'long', 'GetCurrentThemeName', 'wstr', '', 'int', 4096, 'wstr', '', 'int', 2048, _
'wstr', '', 'int', 2048)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Local $aResult[3]
For $i = 0 To 2
$aResult[$i] = $aRet[$i * 2 + 1]
Next
Return $aResult
EndFunc ;==>_WinAPI_GetCurrentThemeName
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetThemeAppProperties()
Local $aRet = DllCall('uxtheme.dll', 'dword', 'GetThemeAppProperties')
If @error Then Return SetError(@error, @extended, 0)
Return $aRet[0]
EndFunc ;==>_WinAPI_GetThemeAppProperties
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetThemeBackgroundContentRect($hTheme, $iPartId, $iStateId, $hDC, $tRECT)
Local $tAREA = DllStructCreate($tagRECT)
Local $aRet = DllCall('uxtheme.dll', 'long', 'GetThemeBackgroundContentRect', 'handle', $hTheme, 'handle', $hDC, _
'int', $iPartId, 'int', $iStateId, 'struct*', $tRECT, 'struct*', $tAREA)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return $tAREA
EndFunc ;==>_WinAPI_GetThemeBackgroundContentRect
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetThemeBackgroundExtent($hTheme, $iPartId, $iStateId, $hDC, $tRECT)
Local $tAREA = DllStructCreate($tagRECT)
Local $aRet = DllCall('uxtheme.dll', 'long', 'GetThemeBackgroundExtent', 'handle', $hTheme, 'handle', $hDC, 'int', $iPartId, _
'int', $iStateId, 'struct*', $tRECT, 'struct*', $tAREA)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return $tAREA
EndFunc ;==>_WinAPI_GetThemeBackgroundExtent
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetThemeBackgroundRegion($hTheme, $iPartId, $iStateId, $hDC, $tRECT)
Local $aRet = DllCall('uxtheme.dll', 'long', 'GetThemeBackgroundRegion', 'handle', $hTheme, 'handle', $hDC, 'int', $iPartId, _
'int', $iStateId, 'struct*', $tRECT, 'handle*', 0)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return $aRet[6]
EndFunc ;==>_WinAPI_GetThemeBackgroundRegion
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetThemeBitmap($hTheme, $iPartId, $iStateId, $iPropId, $iFlag = 0x01)
Local $aRet = DllCall('uxtheme.dll', 'long', 'GetThemeBitmap', 'handle', $hTheme, 'int', $iPartId, 'int', $iStateId, _
'int', $iPropId, 'ulong', $iFlag, 'handle*', 0)
If @error Then Return SetError(@error, @extended, -1)
If $aRet[0] Then Return SetError(10, $aRet[0], -1)
Return $aRet[6]
EndFunc ;==>_WinAPI_GetThemeBitmap
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetThemeBool($hTheme, $iPartId, $iStateId, $iPropId)
Local $aRet = DllCall('uxtheme.dll', 'long', 'GetThemeBool', 'handle', $hTheme, 'int', $iPartId, 'int', $iStateId, _
'int', $iPropId, 'bool*', 0)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return $aRet[5]
EndFunc ;==>_WinAPI_GetThemeBool
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetThemeColor($hTheme, $iPartId, $iStateId, $iPropId)
Local $aRet = DllCall('uxtheme.dll', 'long', 'GetThemeColor', 'handle', $hTheme, 'int', $iPartId, 'int', $iStateId, _
'int', $iPropId, 'dword*', 0)
If @error Then Return SetError(@error, @extended, -1)
If $aRet[0] Then Return SetError(10, $aRet[0], -1)
Return __RGB($aRet[5])
EndFunc ;==>_WinAPI_GetThemeColor
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetThemeDocumentationProperty($sFile, $sProperty)
Local $aRet = DllCall('uxtheme.dll', 'long', 'GetThemeDocumentationProperty', 'wstr', $sFile, 'wstr', $sProperty, _
'wstr', '', 'int', 4096)
If @error Then Return SetError(@error, @extended, '')
If $aRet[0] Then Return SetError(10, $aRet[0], '')
Return $aRet[3]
EndFunc ;==>_WinAPI_GetThemeDocumentationProperty
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: Jpm
; ===============================================================================================================================
Func _WinAPI_GetThemeEnumValue($hTheme, $iPartId, $iStateId, $iPropId)
Local $aRet = DllCall('uxtheme.dll', 'long', 'GetThemeEnumValue', 'handle', $hTheme, 'int', $iPartId, 'int', $iStateId, _
'int', $iPropId, 'int*', 0)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return $aRet[5]
EndFunc ;==>_WinAPI_GetThemeEnumValue
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetThemeFilename($hTheme, $iPartId, $iStateId, $iPropId)
Local $aRet = DllCall('uxtheme.dll', 'uint', 'GetThemeFilename', 'handle', $hTheme, 'int', $iPartId, 'int', $iStateId, _
'int', $iPropId, 'wstr', '', 'int', 4096)
If @error Then Return SetError(@error, @extended, '')
If $aRet[0] Then Return SetError(10, $aRet[0], '')
Return $aRet[5]
EndFunc ;==>_WinAPI_GetThemeFilename
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetThemeFont($hTheme, $iPartId, $iStateId, $iPropId, $hDC = 0)
Local $tLOGFONT = DllStructCreate($tagLOGFONT)
Local $aRet = DllCall('uxtheme.dll', 'long', 'GetThemeFont', 'handle', $hTheme, 'handle', $hDC, 'int', $iPartId, _
'int', $iStateId, 'int', $iPropId, 'struct*', $tLOGFONT)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return $tLOGFONT
EndFunc ;==>_WinAPI_GetThemeFont
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetThemeInt($hTheme, $iPartId, $iStateId, $iPropId)
Local $aRet = DllCall('uxtheme.dll', 'long', 'GetThemeInt', 'handle', $hTheme, 'int', $iPartId, 'int', $iStateId, _
'int', $iPropId, 'int*', 0)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return $aRet[5]
EndFunc ;==>_WinAPI_GetThemeInt
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetThemeMargins($hTheme, $iPartId, $iStateId, $iPropId, $hDC, $tRECT)
Local $tMARGINS = DllStructCreate($tagMARGINS)
Local $aRet = DllCall('uxtheme.dll', 'long', 'GetThemeMargins', 'handle', $hTheme, 'handle', $hDC, 'int', $iPartId, _
'int', $iStateId, 'int', $iPropId, 'struct*', $tRECT, 'struct*', $tMARGINS)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return $tMARGINS
EndFunc ;==>_WinAPI_GetThemeMargins
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetThemeMetric($hTheme, $iPartId, $iStateId, $iPropId, $hDC = 0)
Local $aRet = DllCall('uxtheme.dll', 'long', 'GetThemeMetric', 'handle', $hTheme, 'handle', $hDC, 'int', $iPartId, _
'int', $iStateId, 'int', $iPropId, 'int*', 0)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return $aRet[6]
EndFunc ;==>_WinAPI_GetThemeMetric
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetThemePartSize($hTheme, $iPartId, $iStateId, $hDC, $tRECT, $iType)
Local $tSIZE = DllStructCreate($tagSIZE)
Local $aRet = DllCall('uxtheme.dll', 'long', 'GetThemePartSize', 'handle', $hTheme, 'handle', $hDC, 'int', $iPartId, _
'int', $iStateId, 'struct*', $tRECT, 'int', $iType, 'struct*', $tSIZE)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return $tSIZE
EndFunc ;==>_WinAPI_GetThemePartSize
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetThemePosition($hTheme, $iPartId, $iStateId, $iPropId)
Local $tPOINT = DllStructCreate($tagPOINT)
Local $aRet = DllCall('uxtheme.dll', 'long', 'GetThemePosition', 'handle', $hTheme, 'int', $iPartId, 'int', $iStateId, _
'int', $iPropId, 'struct*', $tPOINT)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return $tPOINT
EndFunc ;==>_WinAPI_GetThemePosition
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetThemePropertyOrigin($hTheme, $iPartId, $iStateId, $iPropId)
Local $aRet = DllCall('uxtheme.dll', 'long', 'GetThemePropertyOrigin', 'handle', $hTheme, 'int', $iPartId, 'int', $iStateId, _
'int', $iPropId, 'uint*', 0)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return $aRet[5]
EndFunc ;==>_WinAPI_GetThemePropertyOrigin
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetThemeRect($hTheme, $iPartId, $iStateId, $iPropId)
Local $tRECT = DllStructCreate($tagRECT)
Local $aRet = DllCall('uxtheme.dll', 'long', 'GetThemeRect', 'handle', $hTheme, 'int', $iPartId, 'int', $iStateId, _
'int', $iPropId, 'struct*', $tRECT)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return $tRECT
EndFunc ;==>_WinAPI_GetThemeRect
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetThemeString($hTheme, $iPartId, $iStateId, $iPropId)
Local $aRet = DllCall('uxtheme.dll', 'long', 'GetThemeString', 'handle', $hTheme, 'int', $iPartId, 'int', $iStateId, _
'int', $iPropId, 'wstr', '', 'int', 4096)
If @error Then Return SetError(@error, @extended, '')
If $aRet[0] Then Return SetError(10, $aRet[0], '')
Return $aRet[5]
EndFunc ;==>_WinAPI_GetThemeString
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetThemeSysBool($hTheme, $iBoolId)
Local $aRet = DllCall('uxtheme.dll', 'bool', 'GetThemeSysBool', 'handle', $hTheme, 'int', $iBoolId)
If @error Then Return SetError(@error, @extended, 0)
Return $aRet[0]
EndFunc ;==>_WinAPI_GetThemeSysBool
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetThemeSysColor($hTheme, $iColorId)
Local $aRet = DllCall('uxtheme.dll', 'dword', 'GetThemeSysColor', 'handle', $hTheme, 'int', $iColorId)
If @error Then Return SetError(@error, @extended, -1)
Return $aRet[0]
EndFunc ;==>_WinAPI_GetThemeSysColor
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetThemeSysColorBrush($hTheme, $iColorId)
Local $aRet = DllCall('uxtheme.dll', 'handle', 'GetThemeSysColorBrush', 'handle', $hTheme, 'int', $iColorId)
If @error Then Return SetError(@error, @extended, 0)
Return $aRet[0]
EndFunc ;==>_WinAPI_GetThemeSysColorBrush
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetThemeSysFont($hTheme, $iFontId)
Local $tLOGFONT = DllStructCreate($tagLOGFONT)
Local $aRet = DllCall('uxtheme.dll', 'long', 'GetThemeSysFont', 'handle', $hTheme, 'int', $iFontId, 'struct*', $tLOGFONT)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return $tLOGFONT
EndFunc ;==>_WinAPI_GetThemeSysFont
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetThemeSysInt($hTheme, $iIntId)
Local $aRet = DllCall('uxtheme.dll', 'long', 'GetThemeSysInt', 'handle', $hTheme, 'int', $iIntId, 'int*', 0)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return $aRet[3]
EndFunc ;==>_WinAPI_GetThemeSysInt
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetThemeSysSize($hTheme, $iSizeId)
Local $aRet = DllCall('uxtheme.dll', 'int', 'GetThemeSysSize', 'handle', $hTheme, 'int', $iSizeId)
If @error Then Return SetError(@error, @extended, 0)
Return $aRet[0]
EndFunc ;==>_WinAPI_GetThemeSysSize
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetThemeSysString($hTheme, $iStringId)
Local $aRet = DllCall('uxtheme.dll', 'long', 'GetThemeSysString', 'handle', $hTheme, 'int', $iStringId, 'wstr', '', 'int', 4096)
If @error Then Return SetError(@error, @extended, '')
If $aRet[0] Then Return SetError(10, $aRet[0], '')
Return $aRet[3]
EndFunc ;==>_WinAPI_GetThemeSysString
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetThemeTextExtent($hTheme, $iPartId, $iStateId, $hDC, $sText, $tRECT, $iFlags)
Local $tAREA = DllStructCreate($tagRECT)
Local $aRet = DllCall('uxtheme.dll', 'long', 'GetThemeTextExtent', 'handle', $hTheme, 'handle', $hDC, 'int', $iPartId, _
'int', $iStateId, 'wstr', $sText, 'int', -1, 'dword', $iFlags, 'struct*', $tRECT, 'struct*', $tAREA)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return $tAREA
EndFunc ;==>_WinAPI_GetThemeTextExtent
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_GetThemeTextMetrics($hTheme, $iPartId, $iStateId, $hDC = 0)
Local $tTEXTMETRIC = DllStructCreate($tagTEXTMETRIC)
Local $aRet = DllCall('uxtheme.dll', 'long', 'GetThemeTextMetrics', 'handle', $hTheme, 'handle', $hDC, 'int', $iPartId, _
'int', $iStateId, 'struct*', $tTEXTMETRIC)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return $tTEXTMETRIC
EndFunc ;==>_WinAPI_GetThemeTextMetrics
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: Jpm
; ===============================================================================================================================
Func _WinAPI_GetThemeTransitionDuration($hTheme, $iPartId, $iStateIdFrom, $iStateIdTo, $iPropId)
Local $aRet = DllCall('uxtheme.dll', 'long', 'GetThemeTransitionDuration', 'handle', $hTheme, 'int', $iPartId, _
'int', $iStateIdFrom, 'int', $iStateIdTo, 'int', $iPropId, 'dword*', 0)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return $aRet[6]
EndFunc ;==>_WinAPI_GetThemeTransitionDuration
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: Jpm
; ===============================================================================================================================
Func _WinAPI_GetWindowTheme($hWnd)
Local $aRet = DllCall('uxtheme.dll', 'handle', 'GetWindowTheme', 'hwnd', $hWnd)
If @error Then Return SetError(@error, @extended, 0)
Return $aRet[0]
EndFunc ;==>_WinAPI_GetWindowTheme
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_IsThemeActive()
Local $aRet = DllCall('uxtheme.dll', 'bool', 'IsThemeActive')
If @error Then Return SetError(@error, @extended, False)
Return $aRet[0]
EndFunc ;==>_WinAPI_IsThemeActive
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_IsThemeBackgroundPartiallyTransparent($hTheme, $iPartId, $iStateId)
Local $aRet = DllCall('uxtheme.dll', 'bool', 'IsThemeBackgroundPartiallyTransparent', 'handle', $hTheme, 'int', $iPartId, _
'int', $iStateId)
If @error Then Return SetError(@error, @extended, False)
Return $aRet[0]
EndFunc ;==>_WinAPI_IsThemeBackgroundPartiallyTransparent
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_IsThemePartDefined($hTheme, $iPartId)
Local $aRet = DllCall('uxtheme.dll', 'int', 'IsThemePartDefined', 'ptr', $hTheme, 'int', $iPartId, 'int', 0)
If @error Then Return SetError(@error, @extended, False)
Return $aRet[0]
EndFunc ;==>_WinAPI_IsThemePartDefined
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: Jpm
; ===============================================================================================================================
Func _WinAPI_OpenThemeData($hWnd, $sClass)
Local $aRet = DllCall('uxtheme.dll', 'handle', 'OpenThemeData', 'hwnd', $hWnd, 'wstr', $sClass)
If @error Then Return SetError(@error, @extended, 0)
; If Not $aRet[0] Then Return SetError(1000, 0, 0)
Return $aRet[0]
EndFunc ;==>_WinAPI_OpenThemeData
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_SetThemeAppProperties($iFlags)
DllCall('uxtheme.dll', 'none', 'SetThemeAppProperties', 'dword', $iFlags)
If @error Then Return SetError(@error, @extended, 0)
Return 1
EndFunc ;==>_WinAPI_SetThemeAppProperties
; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_SetWindowTheme($hWnd, $sName = 0, $sList = 0)
Local $sTypeOfName = 'wstr', $sTypeOfList = 'wstr'
If Not IsString($sName) Then
$sTypeOfName = 'ptr'
$sName = 0
EndIf
If Not IsString($sList) Then
$sTypeOfList = 'ptr'
$sList = 0
EndIf
Local $aRet = DllCall('uxtheme.dll', 'long', 'SetWindowTheme', 'hwnd', $hWnd, $sTypeOfName, $sName, $sTypeOfList, $sList)
If @error Then Return SetError(@error, @extended, 0)
If $aRet[0] Then Return SetError(10, $aRet[0], 0)
Return 1
EndFunc ;==>_WinAPI_SetWindowTheme
#EndRegion Public Functions