-
Notifications
You must be signed in to change notification settings - Fork 63
/
Aero_Lib.ahk
970 lines (925 loc) · 28.8 KB
/
Aero_Lib.ahk
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
/*
Aero_Libary
DWM - - Desktop Window Manager
Name: Aero_Lib
Autors:= Bentschi ; RaptorOne ;
Beta From 11.10.10
Funktions:
Aero_StartUp() ; Load important dll Files for more perfomance. ; Line: 52
Aero_Enable() ; Enable or disable the DWM. ; Line: 82
Aero_IsEnabled() ; Return True if DWM is enabled, False if it disabled. ; Line: 104
Aero_BlurWindow() ; Set a Blur behind a window. ; Line: 135
Aero_GuiBlurWindow() ; Set a Blur behind a window. ; Line: 174
Aero_ChangeFrameArea() ; Extend the Frame Area into the Client Area. ; Line: 220
Aero_GuiChangeFrameArea() ; Extend the Frame Area into the Client Area. ; Line: 261
Aero_ChangeFrameAreaAll() ; Extend the Frame Area into the whole Client Area. ; Line: 291
Aero_GuiChangeFrameAreaAll() ; Extend the Frame Area into the whole Client Area. ; Line: 316
Aero_GetDWMColor() ; Gets the Color of the current DWM options. ; Line: 337
Aero_GetDWMTrans() ; Gets the Transparent of the Current DWM options. ; Line: 362
Aero_SetDWMColor() ; Set´s the DWM Window Color. ; Line: 389
Aero_SetTrans() ; Set´s the DWM Transparent value. ; Line: 416
Aero_DrawPicture() ; Draws a Picture onto a DWM Gui. ; Line: 454
Aero_CreateBuffer() ; Creates a buffer from a Handle. ; Line: 481
Aero_CreateGuiBuffer() ; Creates a buffer from a GuiCount. ; Line: 502
Aero_DeleteBuffer() ; Deletes a buffer. ; Line: 523
Aero_UpdateWindow() ; Updates a window where is a DWM draw. ; Line: 550
Aero_UpdateGui() ; Updates a window where is a DWM draw. ; Line: 574
Aero_AutoRepaint() ; Set a Buffer to Autoredraw, everytime it is need it. ; Line: 598
Aero_AutoRepaintGui() ; Set a Buffer to Autoredraw, everytime it is need it. ;Line: 622
Aero_DisableAutoRepaint() ; Disables the AutoRedraw. ; Line: 643
Aero_DisableAutoRepaintGui() ; Disables the AutoRedraw. ; Line: 664
Aero_ClearBuffer() ; Clears a Buffer. ; Line: 685
Aero_LoadImage() ; Load image in a variable. ; Line: 714
Aero_DeleteImage() ; Deletes a loaded image. ; Line: 745
Aero_DrawImage() ; Draw the Picture on the Window. ; Line: 779
Aero_End() ; Unload the dll Files. ; Line: 805
*/
;============================================================================
; Funktion
; Api Name: LoadLibary (Kernel32.dll)
;
; Aero_StartUp()
;
; Load important dll Files for more perfomance.
;
;
; Return: Module Id´s (splittet with "|") (or false if OS is not compatible)
;
Aero_StartUp(){
global
If(A_OSVersion=="WIN_VISTA" || A_OSVersion=="WIN_7")
{
MODULEID3:=DllCall("LoadLibrary", "str", "dwmapi")
MODULEID2:=DllCall("LoadLibrary", "str", "uxtheme") ;zwar noch nicht gebraucht aber egal
MODULEID:=MODULEID3 . "|" . MODULEID2
Return,MODULEID
}Else{
MsgBox, 4112, DWM Stop, Dwm cannot applied with these OS version.
Return,False
}
}
;============================================================================
;============================================================================
; Funktion
; Api Name: DwmEnableComposition (dwmapi.dll)
;
; Aero_Enable()
;
; Enable or disable the DWM.
;
; Params:
;
; 1. enableBool (True == 1)
; TRUE change to Aero Theme, False change to Windows Basic Theme.
;
; Return: A_LastError
;
Aero_Enable(enableBool=1){
global
If(!MODULEID)
Aero_StartUp()
If(A_OSVersion=="WIN_VISTA" || A_OSVersion=="WIN_7")
DllCall("dwmapi\DwmEnableComposition","UInt",enableBool)
Else
MsgBox, 4112, DWM Stop, Dwm cannot applied with these OS version.
Return,A_LastError
}
;============================================================================
;============================================================================
; Funktion
; Api Name: DwmIsCompositionEnabled (dwmapi.dll)
;
; Aero_IsEnabled()
;
; Return True if DWM is enabled, False if it disabled.
;
; Return: EnabledBool
;
Aero_IsEnabled(){
global
If(!MODULEID)
Aero_StartUp()
VarSetCapacity(_ISENABLED,4)
DllCall("dwmapi\DwmIsCompositionEnabled","UInt",&_ISENABLED)
Return,NumGet(&_ISENABLED,0)
}
;============================================================================
;============================================================================
; Funktion
; Api Name: DwmEnableBlurBehindWindow (dwmapi.dll)
;
; Aero_BlurWindow()
;
; Set a Blur behind a window.
;
; Params:
;
; 1. hwndWin
; The handle to the window on which the blur behind data is applied.
;
; 2. enableBool (True == 1)
; TRUE to register the window handle to DWM blur behind; FALSE to unregister the window handle from DWM blur behind.
;
; 3. region (False == 0)
; The region within the client area to apply the blur behind. A NULL value will apply the blur behind the entire client area.
;
; Return: A_LastError
;
Aero_BlurWindow(hwndWin ,enableBool=1 ,region=0){
global
If(!MODULEID)
Aero_StartUp()
If(region)
dwmConstant:=0x00000001 | 0x00000002 ;DWM_BB_ENABLE | DWM_BB_BLURREGION
Else
dwmConstant:=0x00000001 ;DWM_BB_ENABLE
VarSetCapacity(DWM_BLURBEHIND,16)
NumPut(dwmConstant,&DWM_BLURBEHIND,0,"UInt")
NumPut(enableBool,&DWM_BLURBEHIND,4,"UInt")
NumPut(region,&DWM_BLURBEHIND,8,"UInt")
NumPut(False,&DWM_BLURBEHIND,12,"UInt")
DllCall("dwmapi\DwmEnableBlurBehindWindow","UInt",hwndWin,"UInt",&DWM_BLURBEHIND)
Return,A_LastError
}
;============================================================================
;============================================================================
; Funktion
; Api Name: DwmEnableBlurBehindWindow (dwmapi.dll)
;
; Aero_GuiBlurWindow()
;
; Set a Blur behind a window.
;
; Params:
;
; 1. GuiNum (deafult == current Gui)
; Gui Number.
;
; 2. enableBool (True == 1)
; TRUE to register the window handle to DWM blur behind; FALSE to unregister the window handle from DWM blur behind.
;
; 3. region (False == 0)
; The region within the client area to apply the blur behind. A NULL value will apply the blur behind the entire client area.
;
; Return: A_LastError
;
Aero_GuiBlurWindow(GuiNum="default" ,enableBool=1 ,region=0){
global
If(!MODULEID)
Aero_StartUp()
If(region)
dwmConstant:=0x00000001 | 0x00000002 ;DWM_BB_ENABLE | DWM_BB_BLURREGION
Else
dwmConstant:=0x00000001 ;DWM_BB_ENABLE
VarSetCapacity(DWM_BLURBEHIND,16)
NumPut(dwmConstant,&DWM_BLURBEHIND,0,"UInt")
NumPut(enableBool,&DWM_BLURBEHIND,4,"UInt")
NumPut(region,&DWM_BLURBEHIND,8,"UInt")
NumPut(False,&DWM_BLURBEHIND,12,"UInt")
Gui, % ((GuiNum="default") ? "" : GuiNum ":") "+LastFound"
DllCall("dwmapi\DwmEnableBlurBehindWindow","UInt",WinExist(),"UInt",&DWM_BLURBEHIND)
Return,A_LastError
}
;============================================================================
;============================================================================
; Funktion
; Api Name: DwmExtendFrameIntoClientArea (dwmapi.dll)
;
; Aero_ChangeFrameArea()
;
; Extend the Frame Area into the Client Area.
;
; Params:
;
; 1. hwndWin
; The handle to the window for which the frame is extended into the client area.
;
; 2. leftPos (0)
; Width of the left border that retains its size.
;
; 3. rightPos (0)
; Width of the right border that retains its size.
;
; 2. topPos (0)
; Height of the top border that retains its size.
;
; 3. bottomPos (0)
; Height of the bottom border that retains its size.
;
; Return: A_LastError
;
Aero_ChangeFrameArea(hwndWin, leftPos=0, rightPos=0, topPos=0, bottomPos=0){
global
If(!MODULEID)
Aero_StartUp()
VarSetCapacity(_MARGINS,16)
NumPut(leftPos,&_MARGINS,0,"UInt")
NumPut(rightPos,&_MARGINS,4,"UInt")
NumPut(topPos,&_MARGINS,8,"UInt")
NumPut(bottomPos,&_MARGINS,12,"UInt")
DllCall("dwmapi\DwmExtendFrameIntoClientArea", "UInt", hwndWin, "UInt", &_MARGINS)
Return,A_LastError
}
;============================================================================
;============================================================================
; Funktion
; Api Name: DwmExtendFrameIntoClientArea (dwmapi.dll)
;
; Aero_GuiChangeFrameArea()
;
; Extend the Frame Area into the Client Area.
;
; Params:
;
; 1. GuiNum (default == current Gui)
; Gui Number.
;
; 2. leftPos (0)
; Width of the left border that retains its size.
;
; 3. rightPos (0)
; Width of the right border that retains its size.
;
; 2. topPos (0)
; Height of the top border that retains its size.
;
; 3. bottomPos (0)
; Height of the bottom border that retains its size.
;
; Return: A_LastError
;
Aero_GuiChangeFrameArea(GuiNum="default", leftPos=0, rightPos=0, topPos=0, bottomPos=0){
global
If(!MODULEID)
Aero_StartUp()
VarSetCapacity(_MARGINS,16)
NumPut(leftPos,&_MARGINS,0,"UInt")
NumPut(rightPos,&_MARGINS,4,"UInt")
NumPut(topPos,&_MARGINS,8,"UInt")
NumPut(bottomPos,&_MARGINS,12,"UInt")
Gui, % ((GuiNum="default") ? "" : GuiNum ":") "+LastFound"
DllCall("dwmapi\DwmExtendFrameIntoClientArea", "UInt", WinExist(), "UInt", &_MARGINS)
Return,A_LastError
}
;============================================================================
;============================================================================
; Funktion
; Api Name: DwmExtendFrameIntoClientArea (dwmapi.dll)
;
; Aero_ChangeFrameAreaAll()
;
; Extend the Frame Area into the whole Client Area.
;
; Params:
;
; 1. hwndWin
; The handle to the window for which the frame is extended into the client area.
;
; Return: A_LastError
;
Aero_ChangeFrameAreaAll(hwndWin){
global
If(!MODULEID)
Aero_StartUp()
VarSetCapacity(_AllMARGINS,16,-1)
DllCall("dwmapi\DwmExtendFrameIntoClientArea", "UInt", hwndWin, "UInt", &_AllMARGINS)
Return,A_LastError
}
;============================================================================
;============================================================================
; Funktion
; Api Name: DwmExtendFrameIntoClientArea (dwmapi.dll)
;
; Aero_GuiChangeFrameAreaAll()
;
; Extend the Frame Area into the whole Client Area.
;
; Params:
;
; 1. GuiNum (default == current Gui)
; Number of a Gui
;
; Return: A_LastError
;
Aero_GuiChangeFrameAreaAll(GuiNum="deafult"){
global
If(!MODULEID)
Aero_StartUp()
VarSetCapacity(_AllMARGINS,16,-1)
Gui, % ((GuiNum="default") ? "" : GuiNum ":") "+LastFound"
DllCall("dwmapi\DwmExtendFrameIntoClientArea", "UInt", WinExist(), "UInt", &_AllMARGINS)
Return,A_LastError
}
;============================================================================
;============================================================================
; Funktion
; Api Name: DwmGetColorizationColor (dwmapi.dll)
;
; Aero_GetDWMColor()
;
; Gets the Color of the current DWM options.
;
; Return: dwmColor (0xAARRGGBB)
;
Aero_GetDWMColor(){
global
If(!MODULEID)
Aero_StartUp()
VarSetCapacity(dwmColor,16)
VarSetCapacity(subend,4)
DllCall("dwmapi\DwmGetColorizationColor", "UInt", &dwmColor, "UInt", &subend)
SetFormat,integer,hex
dwmColor2:=NumGet(&dwmColor,0)+0
SetFormat,IntegerFast,d
Return,dwmColor2
}
;============================================================================
;============================================================================
; Funktion
; Api Name: DwmGetColorizationColor (dwmapi.dll)
;
; Aero_GetDWMTrans()
;
; Gets the Transparent of the Current DWM options.
;
; Return: dwmTransparent (False==Transparent ; True==Not Transparent)
;
Aero_GetDWMTrans(){
global
If(!MODULEID)
Aero_StartUp()
VarSetCapacity(subend,16)
VarSetCapacity(dwmTrans,4)
DllCall("dwmapi\DwmGetColorizationColor", "UInt", &subend, "UInt", &dwmTrans)
Return,NumGet(&dwmTrans,0,"UInt")
}
;============================================================================
;============================================================================
; Funktion
; Api Name: none ()
;
; Aero_SetDWMColor()
;
; Set´s the DWM Window Color.
;
; Params:
;
; 1. dwmColor
; A 32 bit Color (0xAARRGGBB)
;
; Return: A_LastError
;
Aero_SetDWMColor(dwmColor=0x910047ab){
global
If(!MODULEID)
Aero_StartUp()
RegWrite,REG_DWORD,HKCU,Software\Microsoft\Windows\DWM,ColorizationColor,%dwmColor%
RegWrite,REG_DWORD,HKCU,Software\Microsoft\Windows\DWM,ColorizationAfterglow,%dwmColor%
DllCall("dwmapi\DwmEnableComposition","UInt",False)
DllCall("dwmapi\DwmEnableComposition","UInt",True)
Return,A_LastError
}
;============================================================================
;============================================================================
; Funktion
; Api Name: none ()
;
; Aero_SetTrans()
;
; Set´s the DWM Transparent value.
;
; Params:
;
; 1. dwmTrans
; A Bool. False is transparent, True is not Transparent.
;
; Return: A_LastError
;
Aero_SetTrans(dwmTrans){
global
If(!MODULEID)
Aero_StartUp()
RegWrite,REG_DWORD,HKCU,Software\Microsoft\Windows\DWM,ColorizationOpaqueBlend,%dwmTrans%
DllCall("dwmapi\DwmEnableComposition","UInt",False)
DllCall("dwmapi\DwmEnableComposition","UInt",True)
Return,A_LastError
}
;============================================================================
;============================================================================
; Funktion
; Api Name: many xD (view in source)
;
; Aero_DrawPicture()
;
; Draws a Picture onto a DWM Gui.
;
; Params:
;
; 1. hwnd
; Handle of the Window which the Picture is to draw.
;
; 2. picturePath
; Path to a Picture (All supportet Gdi32 Pictures (also Transparent Pictures))
;
; 3. xPos (0)
; X Position where the Picture is to draw.
;
; 4. yPos (0)
; Y Position where the Picture is to draw.
;
; 5. autoUpdate (True==1)
; Redraw the Picture everytime need it.
;
; Return: The Buffer of the Picture.
;
Aero_DrawPicture(hwnd,picturePath,xPos=0,yPos=0,autoUpdate=1){
hBuffer := Aero_CreateBuffer(hwnd)
hImage := Aero_LoadImage(picturePath)
Aero_DrawImage(hBuffer, hImage, xPos, yPos)
If(autoUpdate)
Aero_AutoRepaintGui(hBuffer)
Aero_DeleteImage(hImage)
Return,hBuffer
}
;============================================================================
;============================================================================
; Funktion
; Api Name: many (view in source)
;
; Aero_CreateBuffer()
;
; Creates a buffer from a Handle.
;
; Params:
;
; 1. hWnd
; Handle of the Window which the buffer is applied.
;
; Return: Created buffer.
;
Aero_CreateBuffer(hWnd){
hDC := DllCall("GetDC", "uint", hWnd)
Return Aero_CreateBufferFromBuffer(hDC)
}
;============================================================================
;============================================================================
; Funktion
; Api Name: many (view in source)
;
; Aero_CreateGuiBuffer()
;
; Creates a buffer from a GuiCount.
;
; Params:
;
; 1. GuiNum (default==current Gui)
; Gui number
;
; Return: Created buffer.
;
Aero_CreateGuiBuffer(GuiNum="default"){
Gui, % ((GuiNum="default") ? "" : GuiNum ":") "+LastFound"
Return Aero_CreateBuffer(WinExist())
}
;============================================================================
;============================================================================
; Funktion
; Api Name: many (view in source)
;
; Aero_DeleteBuffer()
;
; Deletes a buffer.
;
; Params:
;
; 1. hBuffer
; Handle of a Buffer.
;
; Return: True
;
Aero_DeleteBuffer(byref hBuffer){
hBitmap := DllCall("GetCurrentObject", "uint", hBuffer, "uint", 7)
DllCall("DeleteDC", "uint", hBuffer)
DllCall("DeleteObject", "uint", hBitmap)
hBuffer := 0
Return 1
}
;============================================================================
;============================================================================
; Funktion
; Api Name: many (view in source)
;
; Aero_UpdateWindow()
;
; Updates a window where is a DWM draw.
;
; Params:
;
; 1. hWnd
; Handle of the window who is to update.
;
; 2. hBuffer
; A handle of a Buffer
;
; Return: NonZero if succes otherwise NULL
;
Aero_UpdateWindow(hWnd, hBuffer){
hDC := DllCall("GetDC", "uint", hWnd)
Return Aero_Blit(hDC, hBuffer)
}
;============================================================================
;============================================================================
; Funktion
; Api Name: many (view in source)
;
; Aero_UpdateGui()
;
; Updates a window where is a DWM draw.
;
; Params:
;
; 1. hBuffer
; Handle of a Buffer.
;
; 2. GuiNum (default == current Gui)
; Gui number.
;
; Return: NonZero if succes otherwise NULL
;
Aero_UpdateGui(hBuffer, GuiNum="default"){
Gui, % ((GuiNum="default") ? "" : GuiNum ":") "+LastFound"
Return Aero_UpdateWindow(WinExist(), hBuffer)
}
;============================================================================
;============================================================================
; Funktion
; Api Name: many (view in source)
;
; Aero_AutoRepaint()
;
; Set a Buffer to Autoredraw, everytime it is need it.
;
; Params:
;
; 1. hWnd
; Handle of a Window.
;
; 2. hBuffer
; handle of a Buffer.
;
; Return: Errorlevel
;
Aero_AutoRepaint(hWnd, hBuffer){
OnMessage(0x0F, "Aero_AutoRepaintCallback")
Return Aero_AutoRepaintCallback(hBuffer, 0, "register", hWnd)
}
;============================================================================
;============================================================================
; Funktion
; Api Name: many (view in source)
;
; Aero_AutoRepaintGui()
;
; Set a Buffer to Autoredraw, everytime it is need it.
;
; Params:
;
; 1. hBuffer
; Handle of a buffer.
;
; 2. GuiNum (default == current Gui)
; Gui Number.
;
; Return: ErrorLevel
;
Aero_AutoRepaintGui(hBuffer, GuiNum="default"){
Gui, % ((GuiNum="default") ? "" : GuiNum ":") "+LastFound"
Return Aero_AutoRepaint(WinExist(), hBuffer)
}
;============================================================================
;============================================================================
; Funktion
; Api Name: many (view in source)
;
; Aero_DisableAutoRepaint()
;
; Disables the AutoRedraw.
;
; Params:
;
; 1. hWnd
; Handle of the Window.
;
; Return: True
;
Aero_DisableAutoRepaint(hWnd){
Aero_AutoRepaint(hWnd, "")
Return 1
}
;============================================================================
;============================================================================
; Funktion
; Api Name: many (view in source)
;
; Aero_DisableAutoRepaintGui()
;
; Disables the AutoRedraw.
;
; Params:
;
; 1. GuiNum (default == current Gui)
; Gui Number.
;
; Return: True
;
Aero_DisableAutoRepaintGui(GuiNum="default"){
Gui, % ((GuiNum="default") ? "" : GuiNum ":") "+LastFound"
Return Aero_DisableAutoRepaint(WinExist())
}
;============================================================================
;============================================================================
; Funktion
; Api Name: many (view in source)
;
; Aero_ClearBuffer()
;
; Clears a Buffer.
;
; Params:
;
; 1. hBuffer
; Handle of a Buffer.
;
; Return: True for succes otherwise False
;
Aero_ClearBuffer(hBuffer){
VarSetCapacity(Img, 24, 0)
hBitmap := DllCall("GetCurrentObject", "uint", hBuffer, "uint", 7)
DllCall("GetObject", "uInt", hBitmap "uInt", 24, "uInt", &Img)
VarSetCapacity(rect, 16, 0)
NumPut(((NumGet(Img, 4)=0) ? A_ScreenWidth : NumGet(Img, 4)), rect, 8, "int")
NumPut(((NumGet(Img, 8)=0) ? A_ScreenHeight : NumGet(Img, 8)), rect, 12, "int")
hBrush := DllCall("CreateSolidBrush", "uint", 0)
retval := DllCall("FillRect", "uint", hBuffer, "uint", &rect, "uint", hBrush)
DllCall("DeleteObject", "uint", hBrush)
Return ((retval!=0) ? 1 : 0)
}
;============================================================================
;============================================================================
; Funktion
; Api Name: many (view in source)
;
; Aero_LoadImage()
;
; Load image in a variable.
;
; Params:
;
; 1. FileName
; Path to a Picture (All suportet Gdi32 Pictures)
;
; Return: The Image.
;
Aero_LoadImage(Filename){
DllCall("LoadLibrary", "str", "gdiplus")
VarSetCapacity(pGdiplusToken, 4, 0)
VarSetCapacity(pGdiplusInput, 16, 0)
NumPut(1, pGdiplusInput)
DllCall("gdiplus\GdiplusStartup", "uint", &pGdiplusToken, "uint", &pGdiplusInput, "uint", 0)
Aero_MultibyteToWide(Filename, WideFilename)
DllCall("gdiplus\GdipCreateBitmapFromFile", "uint", &WideFilename, "uint*", GdiplusBitmap)
DllCall("gdiplus\GdipCreateHBITMAPFromBitmap", "uint", GdiplusBitmap, "uint*", hImage, "uint", 0xFF000000)
DllCall("gdiplus\GdipDisposeImage", "uint", GdiplusBitmap)
DllCall("gdiplus\GdiplusShutdown", "uint", NumGet(pGdiplusToken))
DllCall("FreeLibrary", "uint", DllCall("GetModuleHandle", "str", "gdiplus"))
Return hImage
}
;============================================================================
;============================================================================
; Funktion
; Api Name: DeleteObject (Gdi32.dll)
;
; Aero_DeleteImage()
;
; Deletes a loaded image.
;
; Params:
;
; 1. hImage
; A Image in a variable.
;
; Return: True
;
Aero_DeleteImage(byref hImage){
DllCall("DeleteObject", "uint", hImage)
hImage := 0
Return 1
}
;============================================================================
;============================================================================
; Funktion
; Api Name: many (view in source)
;
; Aero_DrawImage()
;
; Draw the Picture on the Window.
;
; Params:
;
; 1. hBuffer
; Handle to a Buffer
;
; 2. hImage
; An Image.
;
; 3. x (0)
; X Position of the Picture
;
; 3. y (0)
; Y Position of the Picture
;
; 3. alpha (256 (0xFF))
; Alpha Value.
;
; Return: Selected Buffer.
;
Aero_DrawImage(hBuffer, hImage, x=0, y=0, alpha=0xFF){
If (hImage = 0)
Return 0
hBufferSrc := DllCall("CreateCompatibleDC", "uint", hBuffer)
DllCall("SelectObject", "uint", hBufferSrc, "uint", hImage)
retval := Aero_AlphaBlend(hBuffer, hBufferSrc, x, y, alpha)
DllCall("DeleteDC", "uint", hBufferSrc)
Return retval
}
;============================================================================
;============================================================================
; Funktion
; Api Name: FreeLibary (Kernel32.dll)
;
; Aero_End()
;
; Unload the dll Files.
;
; Params:
;
; 1. MODUELIDPARAM_ (""nonzero"")
; The Return MODULID from Aero_StartUp() .
;
; Return: True for succes otherwise False for fail
;
Aero_End(MODUELIDPARAM_=""){
global
If(MODUELIDPARAM_)
{
StringSplit,MODULEIDARRAY,MODULEID,% "|"
Loop,%MODULEIDARRAY0%
DllCall("FreeLibary", "Uint", MODULEIDARRAY%A_Index%)
Return,True
}Else{
If(MODULEID)
{
StringSplit,MODULEIDARRAY,MODULEID,% "|"
Loop,%MODULEIDARRAY0%
DllCall("FreeLibary", "Uint", MODULEIDARRAY%A_Index%)
Return,True
}Else{
MsgBox, 4144, DWM Stop, No Loaded Libarys found.`n`nAero_End() fail !
Return,False
}
}
}
;============================================================================
;============================================================================
;============================================================================
;============================================================================
;=============================PRIVATE FUNKTIONS==============================
;============================================================================
;============================================================================
Aero_CreateBufferFromBuffer(hBuffer)
{
hNewBuffer := DllCall("CreateCompatibleDC", "uint", hBuffer)
if (hBufferOut=0)
Return 0
w := DllCall("GetDeviceCaps", "uint", hBuffer, "int", 8)
h := DllCall("GetDeviceCaps", "uint", hBuffer, "int", 10)
VarSetCapacity(bmi, 40, 0)
NumPut(40, bmi, 0, "uint")
NumPut(((w=0) ? A_ScreenWidth : w), bmi, 4, "int")
NumPut(((h=0) ? A_ScreenHeight : h), bmi, 8, "int")
NumPut(1, bmi, 12, "ushort")
NumPut(32, bmi, 14, "ushort")
hBitmap := DllCall("CreateDIBSection", "uint", hBuffer, "uint", &bmi, "uint", 0, "uint*", diBits, "uint", 0, "uint", 0)
if (hBitmap=0)
Return 0
DllCall("SelectObject", "uint", hNewBuffer, "uint", hBitmap)
Return hNewBuffer
}
;============================================================================
Aero_AutoRepaintCallback(wParam, lParam, msg, hWnd)
{
static
SetFormat, Integer, h
hWnd += 0
SetFormat, Integer, d
if (msg="register")
{
Buffer%hWnd% := wParam
Return Aero_UpdateWindow(hWnd, wParam)
}
if ((Buffer%hWnd%!=""))
{
Aero_UpdateWindow(hWnd, Buffer%hWnd%)
SendMessage, % msg, % wParam, % lParam,, ahk_id %hWnd%
Return errorlevel
}
SendMessage, % msg, % wParam, % lParam,, ahk_id %hWnd%
Return errorlevel
}
;============================================================================
Aero_AlphaBlend(hBufferDst, hBufferSrc, x=0, y=0, alpha=0xFF)
{
VarSetCapacity(ImgSrc, 24, 0)
VarSetCapacity(ImgDst, 24, 0)
hBitmapSrc := DllCall("GetCurrentObject", "uint", hBufferSrc, "uint", 7)
hBitmapDst := DllCall("GetCurrentObject", "uint", hBufferDst, "uint", 7)
DllCall("GetObject", "uInt", hBitmapSrc, "uInt", 24, "uInt", &ImgSrc)
DllCall("GetObject", "uInt", hBitmapDst, "uInt", 24, "uInt", &ImgDst)
w := ((NumGet(ImgSrc, 4)<=NumGet(ImgDst, 4)) ? NumGet(ImgSrc, 4) : NumGet(ImgDst, 4))
h := ((NumGet(ImgSrc, 8)<=NumGet(ImgDst, 8)) ? NumGet(ImgSrc, 8) : NumGet(ImgDst, 8))
alpha := ((alpha>0xFF) ? 0xFF : (alpha<0) ? 0 : alpha)
Return DllCall("GdiAlphaBlend", "uint", hBufferDst, "int", x, "int", y, "int", w, "int", h, "uint", hBufferSrc
, "int", 0, "int", 0, "int", w, "int", h, "uint", 0x01000000 | (alpha*0x10000))
}
;============================================================================
Aero_Blit(hBufferDst, hBufferSrc, x=0, y=0)
{
VarSetCapacity(ImgSrc, 24, 0)
VarSetCapacity(ImgDst, 24, 0)
hBitmapSrc := DllCall("GetCurrentObject", "uint", hBufferSrc, "uint", 7)
hBitmapDst := DllCall("GetCurrentObject", "uint", hBufferDst, "uint", 7)
DllCall("GetObject", "uInt", hBitmapSrc, "uInt", 24, "uInt", &ImgSrc)
DllCall("GetObject", "uInt", hBitmapDst, "uInt", 24, "uInt", &ImgDst)
w := ((NumGet(ImgSrc, 4)<=NumGet(ImgDst, 4)) ? NumGet(ImgSrc, 4) : NumGet(ImgDst, 4))
h := ((NumGet(ImgSrc, 8)<=NumGet(ImgDst, 8)) ? NumGet(ImgSrc, 8) : NumGet(ImgDst, 8))
Return DllCall("BitBlt", "uint", hBufferDst, "int", x, "int", y, "int", w, "int", h, "uint", hBufferSrc
, "int", 0, "int", 0, "uint", 0xCC0020)
}
;============================================================================
Aero_MultibyteToWide(Multibyte, byref Wide)
{
SizeOfString := DllCall("MultiByteToWideChar", "uInt", 0, "uInt", 0, "uInt", &Multibyte, "Int", -1, "uInt", 0, "Int", 0) * 2
VarSetCapacity(Wide, SizeOfString, 0)
Return DllCall("MultiByteToWideChar", "uInt", 0, "uInt", 0, "uInt", &Multibyte, "Int", -1, "uInt", &Wide, "uInt", SizeOfString)
}
;============================================================================
Aero_DrawText(hBuffer, Text, x=10, y=10, color="", glowsize=14) ;BUGGY , DONT WORK , DONT USE IT
{
Gui, +LastFound ;Zum verwenden des Theme
Aero_MultibyteToWide("CompositedWindow::Window", WideClass)
hTheme := DllCall("uxtheme\OpenThemeData", "uint", WinExist(), "uint", &WideClass)
hTmpBuffer := Aero_CreateBufferFromBuffer(hBuffer)
hFont := DllCall("GetCurrentObject", "uint", hBuffer, "uint", 6)
DllCall("SelectObject", "uint", hTmpBuffer, "uint", hFont)
VarSetCapacity(Img, 24, 0)
hBitmap := DllCall("GetCurrentObject", "uint", hBuffer, "uint", 7)
DllCall("GetObject", "uInt", hBitmap, "uint", 24, "uint", &Img)
VarSetCapacity(rect, 16, 0)
NumPut(x, rect, 0, "int")
NumPut(y, rect, 4, "int")
NumPut(NumGet(Img, 4)-x, rect, 8, "int")
NumPut(NumGet(Img, 8)-y, rect, 12, "int")
VarSetCapacity(dttopts, 64, 0)
NumPut(64, dttopts, 0, "uint") ;dwSize
NumPut(0x2800 + ((color!="") ? 1 : 0), dttopts, 4, "uint") ;dwFlags (DTT_COMPOSITED | DTT_GLOWSIZE)
if (color!="")
NumPut(((color&0xFF0000)>>16) | (color&0xFF00) | ((color&0xFF)<<16), dttopts, 8, "uint") ;RGB to BGR
NumPut(glowsize, dttopts, 52, "int")
Aero_MultibyteToWide(Text, WideText)
DllCall("uxtheme\DrawThemeTextEx", "uint", hTheme, "uint", hTmpBuffer, "int", 0, "int", 0, "uint", &WideText, "int", -1, "uint", 0x40000, "uint", &rect, "uint", &dttopts)
Aero_AlphaBlend(hBuffer, hTmpBuffer)
Aero_DeleteBuffer(hTmpBuffer)
}
Aero_UseFont(hWnd, hBuffer)
{
hDC := DllCall("GetDC", "uint", hWnd)
hFont := DllCall("GetCurrentObject", "uint", hDC, "uint", 6)
DllCall("SelectObject", "uint", hBuffer, "uint", hFont)
return 1
}
Aero_UseGuiFont(hBuffer, GuiNum="default")
{
Gui, % ((GuiNum="default") ? "" : GuiNum ":") "+LastFound"
return Aero_UseFont(WinExist(), hBuffer)
}
IDE_DrawTransImage(hwnd,Path="")
{
If(!Path)
Return,False
hDC := DllCall("GetDC", "uint", hwnd)
hBuffer:=Aero_CreateBuffer(hwnd)
hImage:=Aero_LoadImage(Path)
hBuffer:=Aero_DrawImage(hBuffer, hImage)
Aero_Blit(hDC, hBuffer)
Aero_DeleteImage(hImage)
}