forked from thesunRider/Reubus
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathANYGUIv2.8.au3
1116 lines (1096 loc) · 53.9 KB
/
ANYGUIv2.8.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
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
#include-once
#include <guiconstants.au3>
#include <guilistbox.au3>
#region Version and Author(s)...And CREDITS!!
#cs -------Version and Author Data------------------------------------------------------------------
; ***************************************************
; ****ANYGUI.au3 v 2.8 5 MAR 2007**************************
; ************Author: Quaizywabbit*******************
; *Credits: Many thanks to Valik(especially!) and Larry!!!!!!!!!!*
; _TargetSetStyle courtesy of Xenogis!!
; ***************************************************
;Changes in this version: all func's (except _EndTarget)
;have basic error handling(return 0 and set @error)
**18 July 2005 added MonthCal and Obj(embedded ActiveX) to the lineup
*NOTE: Beta-Only Functions (Graphic, MonthCal, and Obj) are commented for ease of use with the production release!!!!
**3 AUG 2005 fixed _TargetSetStyle "Remove" to operate properly
**7 AUG 2005 Renamed _TargetSetStyle() to _TargetStyle()
when called with no params, returns the current Styles and Exstyles
changed "Action" verbs to "set", "unset", and "replace"
**8 AUG 2005 fixed _TargetStyle Select/Case Logic (messed it up from v2.2_____ooops!)
**10 AUG 2005 added "toggle" to _TargetStyle()
**12 AUG 2005 added _WinMenuGetHandle() and _WinMenuSetState()
**22 FEB 2007 added _TargetAddDraglist() with associated auxiliary functions, and uncommented previous Beta functions
**05 MAR 2007 modified _GuiTarget() to allow passing coord array in place of ControlId(for .net controls that don't play nice)
#ce ;-------------------------------------------------------------------------------------------------
#endregion
#region GuiTarget;
;===============================================================================
; Function Name: _GuiTarget()
; Description: Targets any existing Window/Control for Control/Child window additions
; Parameter(s): $wintitle - Window Title
; $mode [optional] 1 = "Single Window";
; [Default]==> all else = "Multiple"
; $wintext [optional] - Text in "Target" window
; $controlid [optional] - "Targeted" Control in window **OR** array containing x and y coords
; Requirement(s): #include <guiconstants.au3>
; Return Value(s): On Success - Mode = 1: Global hWnd to window or control
; - Mode = "", or any value that isn't 1: Local hWnd to _
; window or control.
; On Failure: returns 0 and @error set to 1
; Author(s): Quaizywabbit
;===============================================================================
Func _GuiTarget($wintitle, $mode = 0, $wintext = 0, $controlid = 0)
Local $hWnd
WinWait($wintitle)
$hWnd = WinGetHandle($wintitle)
If Not ($controlid = 0) Then
Select
Case IsArray($controlid)
$ctlhwnd = DllCall("user32.dll", "hwnd", "ChildWindowFromPoint", "hwnd", $hWnd, "int", $controlid[0], "int", $controlid[1])
If IsHWnd($ctlhwnd[0]) And $ctlhwnd[0] <> 0x00000000 And $ctlhwnd[0] <> $hWnd Then ;checks for valid control hwnd
$ID = DllCall("User32.dll", "int", "GetDlgCtrlID", "hwnd", $ctlhwnd[0])
ConsoleWrite("ControlId = " & $ID[0] & @CRLF)
$hWnd = $ctlhwnd[0]
Else
ConsoleWrite("invalid coordinates" & "(" & $controlid[0] & " ," & $controlid[1] & ")" & @CRLF)
Exit
EndIf
Case Else
$hWnd = ControlGetHandle($wintitle, $wintext, $controlid)
EndSelect
EndIf
If Not IsHWnd($hWnd) Then SetError(1)
Select
Case @error = 1
ConsoleWrite("could not get hwnd" & @CRLF)
_EndTarget()
Return 0
Case $mode = 1
Global $TargethWnd = $hWnd
Return $TargethWnd
Case Else
Local $LocTargethWnd = $hWnd
Return $LocTargethWnd
EndSelect
EndFunc ;==>_GuiTarget
#endregion
#region EndTarget;
;===============================================================================
; Function Name: _EndTarget()
; Description: Resets _GuiTarget GLOBAL variable value to 0 (when used with Mode 1)
; Parameter(s): None
; Requirement(s): #include <guiconstants.au3>
; Return Value(s): None
; Author(s): Quaizywabbit
;===============================================================================
Func _EndTarget()
Global $TargethWnd = 0
Return $TargethWnd
EndFunc ;==>_EndTarget
#endregion
#region _TargetaddChild;
;===============================================================================
; Function Name: _TargetaddChild()
; Description: Adds a Child window to the "Targeted" existing control/window
; Parameter(s): $text - Child window title text
; $PosX - 'X' horiz. position coordinate
; $PosY - 'Y' vert. position coordinate
; $SizeX - 'X' horiz. Size value
; $SizeY - 'Y' vert. Size value
; $LocTargethWnd [optional] - 'Local' _GuiTarget assigned variable
; Requirement(s): #include <guiconstants.au3>
; Return Value(s): On Success - Returns hWnd of Child window
; On Failure - Returns 0 and @error set to 1
; Author(s): Quaizywabbit
;===============================================================================
Func _TargetaddChild($text, $PosX, $PosY, $SizeX, $SizeY, $LocTargethWnd = 0);
If Not ($LocTargethWnd = 0) Then
$TargethWnd = $LocTargethWnd
Else
ConsoleWrite("invalid or nonexisting target hwnd" & @CRLF)
Return 0
EndIf
If IsHWnd($TargethWnd) Then
Local $a = GUICreate($text, $SizeX, $SizeY, $PosX, $PosY, $WS_CHILD, -1, $TargethWnd)
Else
ConsoleWrite("invalid or nonexisting target hwnd" & @CRLF)
EndIf
If $a = 0 Then SetError(1)
Return $a
EndFunc ;==>_TargetaddChild
#endregion
#region _TargetaddAvi;
;===============================================================================
; Function Name: _TargetaddAvi()
; Description: Add Avi to existing control/window
; Parameter(s): $filename - The filename of the video. Only .avi files are supported.
; $subfileid - id of the subfile to be used. If the file only contains one video then use -1.
; $PosX - 'X' horiz. position coordinate
; $PosY - 'Y' vert. position coordinate
; $SizeX - 'X' horiz. Size value
; $SizeY - 'Y' vert. Size value
; $style [optional] - 'style' of Avi control
; $exstyle[optional]- 'exstyle' of Avi control
; $LocTargethWnd [optional] - 'Local' _GuiTarget assigned variable
; Requirement(s): #include <guiconstants.au3>
; Return Value(s): On Success - Returns 3 element array:
; $a[0] = ControlId of Avi control
; $a[1] = hWnd of Avi control
; $a[2] = hWnd of Avi controls Child window
; On Failure - returns 0, @error set to 1
; Author(s): Quaizywabbit
;===============================================================================
Func _TargetaddAvi($filename, $subfileid, $PosX, $PosY, $SizeX, $SizeY, $style = -1, $exstyle = -1, $LocTargethWnd = 0)
If Not ($LocTargethWnd = 0) Then $TargethWnd = $LocTargethWnd
Local $text = $filename
Local $a[3]
$a[2] = _TargetaddChild($text, $PosX, $PosY, $SizeX, $SizeY, $TargethWnd)
$a[0] = GUICtrlCreateAvi($filename, $subfileid, 0, 0, $SizeX, $SizeY, $style, $exstyle)
$a[1] = ControlGetHandle($a[2], "", $a[0])
If $a[2] = 0 Or $a[0] = 0 Or $a[1] = "" Then
SetError(1)
Return 0
Else
Return $a
EndIf
EndFunc ;==>_TargetaddAvi
#endregion
#region _TargetaddButton;
;===============================================================================
; Function Name: _TargetaddButton()
; Description: Add Button to existing control/window
; Parameter(s): $text - text to display on button
; $PosX - 'X' horiz. position coordinate
; $PosY - 'Y' vert. position coordinate
; $SizeX - 'X' horiz. Size value
; $SizeY - 'Y' vert. Size value
; $style [optional] - 'style' of Button control
; $exstyle [optional] - 'exstyle' of Button control
; $LocTargethWnd [optional] - 'Local' _GuiTarget assigned variable
; Requirement(s): #include <guiconstants.au3>
; Return Value(s): On Success - Returns 3 element array:
; $a[0] = ControlId of Button control
; $a[1] = hWnd of Button control
; $a[2] = hWnd of Button controls Child window
; On Failure - returns 0, @error set to 1
; Author(s): Quaizywabbit
;===============================================================================
Func _TargetaddButton($text, $PosX, $PosY, $SizeX, $SizeY, $style = -1, $exstyle = -1, $LocTargethWnd = 0)
If Not ($LocTargethWnd = 0) Then $TargethWnd = $LocTargethWnd
Local $a[3]
$a[2] = _TargetaddChild($text, $PosX, $PosY, $SizeX, $SizeY, $TargethWnd)
$a[0] = GUICtrlCreateButton($text, 0, 0, $SizeX, $SizeY, $style, $exstyle)
$a[1] = ControlGetHandle($a[2], "", $a[0])
If $a[2] = 0 Or $a[0] = 0 Or $a[1] = "" Then
SetError(1)
Return 0
Else
Return $a
EndIf
EndFunc ;==>_TargetaddButton
#endregion
#region _TargetaddCheckbox;
;===============================================================================
; Function Name: _TargetaddCheckbox()
; Description: Add Checkbox to existing control/window
; Parameter(s): $text - Checkbox label text
; $PosX - 'X' horiz. position coordinate
; $PosY - 'Y' vert. position coordinate
; $SizeX - 'X' horiz. Size value
; $SizeY - 'Y' vert. Size value
; $style [optional] - 'style' of Checkbox control
; $exstyle [optional] - 'exstyle' of Checkbox control
; $LocTargethWnd [optional] - 'Local' _GuiTarget assigned variable
; Requirement(s): #include <guiconstants.au3>
; Return Value(s): On Success - Returns 3 element array:
; $a[0] = ControlId of Checkbox control
; $a[1] = hWnd of Checkbox control
; $a[2] = hWnd of Checkbox controls Child window
; On Failure - returns 0, @error set to 1
; Author(s): Quaizywabbit
;===============================================================================
Func _TargetaddCheckbox($text, $PosX, $PosY, $SizeX, $SizeY, $style = -1, $exstyle = -1, $LocTargethWnd = 0)
If Not ($LocTargethWnd = 0) Then $TargethWnd = $LocTargethWnd
Local $a[3]
$a[2] = _TargetaddChild($text, $PosX, $PosY, $SizeX, $SizeY, $TargethWnd)
$a[0] = GUICtrlCreateCheckbox($text, 0, 0, $SizeX, $SizeY, $style, $exstyle)
$a[1] = ControlGetHandle($a[2], "", $a[0])
If $a[2] = 0 Or $a[0] = 0 Or $a[1] = "" Then
SetError(1)
Return 0
Else
Return $a
EndIf
EndFunc ;==>_TargetaddCheckbox
#endregion
#region _TargetaddCombo;
;===============================================================================
; Function Name: _TargetaddCombo()
; Description: Add Combo to existing control/window
; Parameter(s): $text - text which will appear in the combo control
; $PosX - 'X' horiz. position coordinate
; $PosY - 'Y' vert. position coordinate
; $SizeX - 'X' horiz. Size value
; $SizeY - 'Y' vert. Size value
; $style [optional] - 'style' of Combo control
; $exstyle [optional] - 'exstyle' of Combo control
; $LocTargethWnd [optional] - 'Local' _GuiTarget assigned variable
; Requirement(s): #include <guiconstants.au3>
; Return Value(s): On Success - Returns 3 element array:
; $a[0] = ControlId of Combo control
; $a[1] = hWnd of Combo control
; $a[2] = hWnd of Combo controls Child window
; On Failure - returns 0, @error set to 1
; Author(s): Quaizywabbit
;===============================================================================
Func _TargetaddCombo($text, $PosX, $PosY, $SizeX, $SizeY, $style = -1, $exstyle = -1, $LocTargethWnd = 0)
If Not ($LocTargethWnd = 0) Then $TargethWnd = $LocTargethWnd
Local $a[3]
$a[2] = _TargetaddChild($text, $PosX, $PosY, $SizeX, $SizeY, $TargethWnd)
$a[0] = GUICtrlCreateCombo($text, 0, 0, $SizeX, $SizeY, $style, $exstyle)
$a[1] = ControlGetHandle($a[2], "", $a[0])
If $a[2] = 0 Or $a[0] = 0 Or $a[1] = "" Then
SetError(1)
Return 0
Else
Return $a
EndIf
EndFunc ;==>_TargetaddCombo
#endregion
#region _TargetaddDate;
;===============================================================================
; Function Name: _TargetaddDate()
; Description: Add Date control to existing control/window
; Parameter(s): $text - the preselected date
; $PosX - 'X' horiz. position coordinate
; $PosY - 'Y' vert. position coordinate
; $SizeX - 'X' horiz. Size value
; $SizeY - 'Y' vert. Size value
; $style [optional] - 'style' of Date control
; $exstyle [optional] - 'exstyle' of Date control
; $LocTargethWnd [optional] - 'Local' _GuiTarget assigned variable
; Requirement(s): #include <guiconstants.au3>
; Return Value(s): On Success - Returns 3 element array:
; $a[0] = ControlId of Date control
; $a[1] = hWnd of Date control
; $a[2] = hWnd of Date controls Child window
; On Failure - returns 0, @error set to 1
; Author(s): Quaizywabbit
;===============================================================================
Func _TargetaddDate($text, $PosX, $PosY, $SizeX, $SizeY, $style = -1, $exstyle = -1, $LocTargethWnd = 0)
If Not ($LocTargethWnd = 0) Then $TargethWnd = $LocTargethWnd
Local $a[3]
$a[2] = _TargetaddChild($text, $PosX, $PosY, $SizeX, $SizeY, $TargethWnd)
$a[0] = GUICtrlCreateDate($text, 0, 0, $SizeX, $SizeY, $style, $exstyle)
$a[1] = ControlGetHandle($a[2], "", $a[0])
If $a[2] = 0 Or $a[0] = 0 Or $a[1] = "" Then
SetError(1)
Return 0
Else
Return $a
EndIf
EndFunc ;==>_TargetaddDate
#endregion
#region _TargetaddEdit;
;===============================================================================
; Function Name: _TargetaddEdit()
; Description: Add Edit control to existing control/window
; Parameter(s): $text - the text of the control
; $PosX - 'X' horiz. position coordinate
; $PosY - 'Y' vert. position coordinate
; $SizeX - 'X' horiz. Size value
; $SizeY - 'Y' vert. Size value
; $style [optional] - 'style' of Edit control
; $exstyle [optional] - 'exstyle' of Edit control
; $LocTargethWnd [optional] - 'Local' _GuiTarget assigned variable
; Requirement(s): #include <guiconstants.au3>
; Return Value(s): On Success - Returns 3 element array:
; $a[0] = ControlId of Edit control
; $a[1] = hWnd of Edit control
; $a[2] = hWnd of Edit controls Child window
; On Failure - returns 0, @error set to 1
; Author(s): Quaizywabbit
;===============================================================================
Func _TargetaddEdit($text, $PosX, $PosY, $SizeX, $SizeY, $style = -1, $exstyle = -1, $LocTargethWnd = 0)
If Not ($LocTargethWnd = 0) Then $TargethWnd = $LocTargethWnd
Local $a[3]
$a[2] = _TargetaddChild($text, $PosX, $PosY, $SizeX, $SizeY, $TargethWnd)
$a[0] = GUICtrlCreateEdit($text, 0, 0, $SizeX, $SizeY, $style, $exstyle)
$a[1] = ControlGetHandle($a[2], "", $a[0])
If $a[2] = 0 Or $a[0] = 0 Or $a[1] = "" Then
SetError(1)
Return 0
Else
Return $a
EndIf
EndFunc ;==>_TargetaddEdit
#endregion
#region _TargetaddGraphic;
;===============================================================================
; Function Name: _TargetaddGraphic()
; Description: Add Graphic to existing control/window
; Parameter(s): $PosX - 'X' horiz. position coordinate
; $PosY - 'Y' vert. position coordinate
; $SizeX - 'X' horiz. Size value
; $SizeY - 'Y' vert. Size value
; $style [optional] - 'style' of Graphic control
; $LocTargethWnd [optional] - 'Local' _GuiTarget assigned variable
; Requirement(s): #include <guiconstants.au3>
; Return Value(s): On Success - Returns 3 element array:
; $a[0] = ControlId of Graphic control
; $a[1] = hWnd of Graphic control
; $a[2] = hWnd of Graphic controls Child window
; On Failure - returns 0, @error set to 1
; Author(s): Quaizywabbit
;===============================================================================
Func _TargetaddGraphic($PosX, $PosY, $SizeX, $SizeY, $style = -1, $LocTargethWnd = 0)
If Not ($LocTargethWnd = 0) Then $TargethWnd = $LocTargethWnd
Local $a[3]
$a[2] = _TargetaddChild("", $PosX, $PosY, $SizeX, $SizeY, $TargethWnd)
$a[0] = GUICtrlCreateGraphic($PosX, $PosY, $SizeX, $SizeY, $style)
$a[1] = ControlGetHandle($a[2], "", $a[0])
If $a[2] = 0 Or $a[0] = 0 Or $a[1] = "" Then
SetError(1)
Return 0
Else
Return $a
EndIf
EndFunc ;==>_TargetaddGraphic
#endregion
#region _TargetaddGroup;
;===============================================================================
; Function Name: _TargetaddGroup()
; Description: Add Group control to existing control/window
; Parameter(s): $text - Group label text
; $PosX - 'X' horiz. position coordinate
; $PosY - 'Y' vert. position coordinate
; $SizeX - 'X' horiz. Size value
; $SizeY - 'Y' vert. Size value
; $style [optional] - 'style' of Group control
; $exstyle [optional] - 'exstyle' of Group control
; $LocTargethWnd [optional] - 'Local' _GuiTarget assigned variable
; Requirement(s): #include <guiconstants.au3>
; Return Value(s): On Success - Returns 3 element array:
; $a[0] = ControlId of Group control
; $a[1] = hWnd of Group control
; $a[2] = hWnd of Group controls Child window
; On Failure - returns 0, @error set to 1
; Author(s): Quaizywabbit
;===============================================================================
Func _TargetaddGroup($text, $PosX, $PosY, $SizeX, $SizeY, $style = -1, $exstyle = -1, $LocTargethWnd = 0)
If Not ($LocTargethWnd = 0) Then $TargethWnd = $LocTargethWnd
Local $a[3]
$a[2] = _TargetaddChild($text, $PosX, $PosY, $SizeX, $SizeY, $TargethWnd)
$a[0] = GUICtrlCreateGroup($text, 0, 0, $SizeX, $SizeY, $style, $exstyle)
$a[1] = ControlGetHandle($a[2], "", $a[0])
If $a[2] = 0 Or $a[0] = 0 Or $a[1] = "" Then
SetError(1)
Return 0
Else
Return $a
EndIf
EndFunc ;==>_TargetaddGroup
#endregion
#region _TargetaddIcon;
;===============================================================================
; Function Name: _TargetaddIcon()
; Description: Add Icon to existing control/window
; Parameter(s): $filename - filename of the icon to be loaded
; $iconID - Icon identifier if the file contain multiple icon. Otherwise -1.
; $PosX - 'X' horiz. position coordinate
; $PosY - 'Y' vert. position coordinate
; $SizeX - 'X' horiz. Size value
; $SizeY - 'Y' vert. Size value
; $style [optional] - 'style' of Icon control
; $exstyle [optional] - 'exstyle' of Icon control
; $LocTargethWnd [optional] - 'Local' _GuiTarget assigned variable
; Requirement(s): #include <guiconstants.au3>
; Return Value(s): On Success - Returns 3 element array:
; $a[0] = ControlId of Icon control
; $a[1] = hWnd of Icon control
; $a[2] = hWnd of Icon controls Child window
; On Failure - returns 0, @error set to 1
; Author(s): Quaizywabbit
;===============================================================================
Func _TargetaddIcon($filename, $iconID, $PosX, $PosY, $SizeX, $SizeY, $style = -1, $exstyle = -1, $LocTargethWnd = 0)
If Not ($LocTargethWnd = 0) Then $TargethWnd = $LocTargethWnd
Local $a[3]
$a[2] = _TargetaddChild("", $PosX, $PosY, $SizeX, $SizeY, $TargethWnd)
$a[0] = GUICtrlCreateIcon($filename, $iconID, 0, 0, $SizeX, $SizeY, $style, $exstyle)
$a[1] = ControlGetHandle($a[2], "", $a[0])
If $a[2] = 0 Or $a[0] = 0 Or $a[1] = "" Then
SetError(1)
Return 0
Else
Return $a
EndIf
EndFunc ;==>_TargetaddIcon
#endregion
#region _TargetaddInput;
;===============================================================================
; Function Name: _TargetaddInput()
; Description: Add Input control to existing control/window
; Parameter(s): $text - The text of the control
; $PosX - 'X' horiz. position coordinate
; $PosY - 'Y' vert. position coordinate
; $SizeX - 'X' horiz. Size value
; $SizeY - 'Y' vert. Size value
; $style [optional] - 'style' of Input control
; $exstyle [optional] - 'exstyle' of Input control
; $LocTargethWnd [optional] - 'Local' _GuiTarget assigned variable
; Requirement(s): #include <guiconstants.au3>
; Return Value(s): On Success - Returns 3 element array:
; $a[0] = ControlId of Input control
; $a[1] = hWnd of Input control
; $a[2] = hWnd of Input controls Child window
; On Failure - returns 0, @error set to 1
; Author(s): Quaizywabbit
;===============================================================================
Func _TargetaddInput($text, $PosX, $PosY, $SizeX, $SizeY, $style = -1, $exstyle = -1, $LocTargethWnd = 0)
If Not ($LocTargethWnd = 0) Then $TargethWnd = $LocTargethWnd
Local $a[3]
$a[2] = _TargetaddChild($text, $PosX, $PosY, $SizeX, $SizeY, $TargethWnd)
$a[0] = GUICtrlCreateInput($text, 0, 0, $SizeX, $SizeY, $style, $exstyle)
$a[1] = ControlGetHandle($a[2], "", $a[0])
If $a[2] = 0 Or $a[0] = 0 Or $a[1] = "" Then
SetError(1)
Return 0
Else
Return $a
EndIf
EndFunc ;==>_TargetaddInput
#endregion
#region _TargetaddLabel;
;===============================================================================
; Function Name: _TargetaddLabel()
; Description: Add Label to existing control/window
; Parameter(s): $text - The text of the control.
; $PosX - 'X' horiz. position coordinate
; $PosY - 'Y' vert. position coordinate
; $SizeX - 'X' horiz. Size value
; $SizeY - 'Y' vert. Size value
; $style [optional] - 'style' of Label control
; $exstyle [optional] - 'exstyle' of Label control
; $LocTargethWnd [optional] - 'Local' _GuiTarget assigned variable
; Requirement(s): #include <guiconstants.au3>
; Return Value(s): On Success - Returns 3 element array:
; $a[0] = ControlId of Label control
; $a[1] = hWnd of Label control
; $a[2] = hWnd of Label controls Child window
; On Failure - returns 0, @error set to 1
; Author(s): Quaizywabbit
;===============================================================================
Func _TargetaddLabel($text, $PosX, $PosY, $SizeX, $SizeY, $style = -1, $exstyle = -1, $LocTargethWnd = 0)
If Not ($LocTargethWnd = 0) Then $TargethWnd = $LocTargethWnd
Local $a[3]
$a[2] = _TargetaddChild($text, $PosX, $PosY, $SizeX, $SizeY, $TargethWnd)
$a[0] = GUICtrlCreateLabel($text, 0, 0, $SizeX, $SizeY, $style, $exstyle)
$a[1] = ControlGetHandle($a[2], "", $a[0])
If $a[2] = 0 Or $a[0] = 0 Or $a[1] = "" Then
SetError(1)
Return 0
Else
Return $a
EndIf
EndFunc ;==>_TargetaddLabel
#endregion
#region _TargetaddList;
;===============================================================================
; Function Name: _TargetaddList()
; Description: Add List control to existing control/window
; Parameter(s): $text - The text of the control.
; $PosX - 'X' horiz. position coordinate
; $PosY - 'Y' vert. position coordinate
; $SizeX - 'X' horiz. Size value
; $SizeY - 'Y' vert. Size value
; $style [optional] - 'style' of List control
; $exstyle [optional] - 'exstyle' of List control
; $LocTargethWnd [optional] - 'Local' _GuiTarget assigned variable
; Requirement(s): #include <guiconstants.au3>
; Return Value(s): On Success - Returns 3 element array:
; $a[0] = ControlId of List control
; $a[1] = hWnd of List control
; $a[2] = hWnd of List controls Child window
; On Failure - returns 0, @error set to 1
; Author(s): Quaizywabbit
;===============================================================================
Func _TargetaddList($text, $PosX, $PosY, $SizeX, $SizeY, $style = -1, $exstyle = -1, $LocTargethWnd = 0)
If Not ($LocTargethWnd = 0) Then $TargethWnd = $LocTargethWnd
Local $a[3]
$a[2] = _TargetaddChild($text, $PosX, $PosY, $SizeX, $SizeY, $TargethWnd)
$a[0] = GUICtrlCreateList($text, 0, 0, $SizeX, $SizeY, $style, $exstyle)
$a[1] = ControlGetHandle($a[2], "", $a[0])
If $a[2] = 0 Or $a[0] = 0 Or $a[1] = "" Then
SetError(1)
Return 0
Else
Return $a
EndIf
EndFunc ;==>_TargetaddList
#endregion
#region _TargetaddDragList;
;===============================================================================
; Function Name: _TargetaddDragList()
; Description: Adds DragList control to existing control/window
; Parameter(s): $text - The text of the control.
; $PosX - 'X' horiz. position coordinate
; $PosY - 'Y' vert. position coordinate
; $SizeX - 'X' horiz. Size value
; $SizeY - 'Y' vert. Size value
; $style [optional] - 'style' of List control
; $exstyle [optional] - 'exstyle' of List control
; $LocTargethWnd [optional] - 'Local' _GuiTarget assigned variable
; Requirement(s): #include <guiconstants.au3> and <guilist.au3>
; Return Value(s): On Success - Returns 3 element array:
; $a[0] = ControlId of List control
; $a[1] = hWnd of List control
; $a[2] = hWnd of List controls Child window
; On Failure - returns 0, @error set to 1
; Author(s): Quaizywabbit
;===============================================================================
Func _TargetaddDragList($text, $PosX, $PosY, $SizeX, $SizeY, $style = -1, $exstyle = -1, $LocTargethWnd = 0)
If Not ($LocTargethWnd = 0) Then $TargethWnd = $LocTargethWnd
Local $a[3]
$a[2] = _TargetaddChild($text, $PosX, $PosY, $SizeX, $SizeY, $TargethWnd)
$a[0] = GUICtrlCreateList($text, 15, 2, $SizeX - 15, $SizeY - 2, $style, $exstyle)
$a[1] = ControlGetHandle($a[2], "", $a[0])
_Makedraglist($a[1])
If $a[2] = 0 Or $a[0] = 0 Or $a[1] = "" Then
SetError(1)
Return 0
Else
Return $a
EndIf
EndFunc ;==>_TargetaddDragList
#endregion
#region _TargetaddListview;
;===============================================================================
; Function Name: _TargetaddListview()
; Description: Add Listview control to existing control/window
; Parameter(s): $text - definition of column heading.
; $PosX - 'X' horiz. position coordinate
; $PosY - 'Y' vert. position coordinate
; $SizeX - 'X' horiz. Size value
; $SizeY - 'Y' vert. Size value
; $style [optional] - 'style' of Listview control
; $exstyle [optional] - 'exstyle' of Listview control
; $LocTargethWnd [optional] - 'Local' _GuiTarget assigned variable
; Requirement(s): #include <guiconstants.au3>
; Return Value(s): On Success - Returns 3 element array:
; $a[0] = ControlId of Listview control
; $a[1] = hWnd of Listview control
; $a[2] = hWnd of Listview controls Child window
; On Failure - returns 0, @error set to 1
; Author(s): Quaizywabbit
;===============================================================================
Func _TargetaddListview($text, $PosX, $PosY, $SizeX, $SizeY, $style = -1, $exstyle = -1, $LocTargethWnd = 0)
If Not ($LocTargethWnd = 0) Then $TargethWnd = $LocTargethWnd
Local $a[3]
$a[2] = _TargetaddChild($text, $PosX, $PosY, $SizeX, $SizeY, $TargethWnd)
$a[0] = GUICtrlCreateListView($text, 0, 0, $SizeX, $SizeY, $style, $exstyle)
$a[1] = ControlGetHandle($a[2], "", $a[0])
If $a[2] = 0 Or $a[0] = 0 Or $a[1] = "" Then
SetError(1)
Return 0
Else
Return $a
EndIf
EndFunc ;==>_TargetaddListview
#endregion
#region _TargetaddMonthCal;
;===============================================================================
; Function Name: _TargetaddMonthCal()
; Description: Adds MonthCal control to existing control/window
; Parameter(s): $text - The text of the control.
; $PosX - 'X' horiz. position coordinate
; $PosY - 'Y' vert. position coordinate
; $SizeX - 'X' horiz. Size value
; $SizeY - 'Y' vert. Size value
; $style [optional] - 'style' of MonthCal control
; $exstyle [optional] - 'exstyle' of MonthCal control
; $LocTargethWnd [optional] - 'Local' _GuiTarget assigned variable
; Requirement(s): #include <guiconstants.au3>
; Return Value(s): On Success - Returns 3 element array:
; $a[0] = ControlId of MonthCal control
; $a[1] = hWnd of MonthCal control
; $a[2] = hWnd of MonthCal controls Child window
; On Failure - returns 0, @error set to 1
; Author(s): Quaizywabbit
;===============================================================================
Func _TargetaddMonthCal($text, $PosX, $PosY, $SizeX, $SizeY, $style = -1, $exstyle = -1, $LocTargethWnd = 0)
If Not ($LocTargethWnd = 0) Then $TargethWnd = $LocTargethWnd
Local $a[3]
$a[2] = _TargetaddChild($text, $PosX, $PosY, $SizeX, $SizeY, $TargethWnd)
$a[0] = GUICtrlCreateMonthCal($text, 0, 0, $SizeX, $SizeY, $style, $exstyle)
$a[1] = ControlGetHandle($a[2], "", $a[0])
If $a[2] = 0 Or $a[0] = 0 Or $a[1] = "" Then
SetError(1)
Return 0
Else
Return $a
EndIf
EndFunc ;==>_TargetaddMonthCal
#endregion
#region _TargetaddObj;
;===============================================================================
; Function Name: _TargetaddObj()
; Description: Adds ActiveX Object control to existing control/window
; Parameter(s): $ObjVar - A variable pointing to a previously opened object
; $PosX - 'X' horiz. position coordinate
; $PosY - 'Y' vert. position coordinate
; $SizeX - 'X' horiz. Size value
; $SizeY - 'Y' vert. Size value
; $LocTargethWnd [optional] - 'Local' _GuiTarget assigned variable
; Requirement(s): #include <guiconstants.au3>
; Return Value(s): On Success - Returns 3 element array:
; $a[0] = ControlId of ActiveX Object control
; $a[1] = hWnd of ActiveX Object control
; $a[2] = hWnd of ActiveX Object controls Child window
; On Failure - returns 0, @error set to 1
; Author(s): Quaizywabbit
;===============================================================================
Func _TargetaddObj($ObjVar, $PosX, $PosY, $SizeX, $SizeY, $LocTargethWnd = 0)
If Not ($LocTargethWnd = 0) Then $TargethWnd = $LocTargethWnd
Local $a[3]
$a[2] = _TargetaddChild("ActiveXObj", $PosX, $PosY, $SizeX, $SizeY, $TargethWnd)
$a[0] = GUICtrlCreateObj($ObjVar, 0, 0, $SizeX, $SizeY)
$a[1] = ControlGetHandle($a[2], "", $a[0])
If $a[2] = 0 Or $a[0] = 0 Or $a[1] = "" Then
SetError(1)
Return 0
Else
Return $a
EndIf
EndFunc ;==>_TargetaddObj
#endregion
#region _TargetaddPic;
;===============================================================================
; Function Name: _TargetaddPic()
; Description: Add Pic to existing control/window
; Parameter(s): $filename - filename of the icon to be loaded.
; $PosX - 'X' horiz. position coordinate
; $PosY - 'Y' vert. position coordinate
; $SizeX - 'X' horiz. Size value
; $SizeY - 'Y' vert. Size value
; $style [optional] - 'style' of Pic control
; $exstyle [optional] - 'exstyle' of Pic control
; $LocTargethWnd [optional] - 'Local' _GuiTarget assigned variable
; Requirement(s): #include <guiconstants.au3>
; Return Value(s): On Success - Returns 3 element array:
; $a[0] = ControlId of Pic control
; $a[1] = hWnd of Pic control
; $a[2] = hWnd of Pic controls Child window
; On Failure - returns 0, @error set to 1
; Author(s): Quaizywabbit
;===============================================================================
Func _TargetaddPic($filename, $PosX, $PosY, $SizeX, $SizeY, $style = -1, $exstyle = -1, $LocTargethWnd = 0)
If Not ($LocTargethWnd = 0) Then $TargethWnd = $LocTargethWnd
Local $a[3]
$a[2] = _TargetaddChild("", $PosX, $PosY, $SizeX, $SizeY, $TargethWnd)
$a[0] = GUICtrlCreatePic($filename, 0, 0, $SizeX, $SizeY, $style, $exstyle)
$a[1] = ControlGetHandle($a[2], "", $a[0])
If $a[2] = 0 Or $a[0] = 0 Or $a[1] = "" Then
SetError(1)
Return 0
Else
Return $a
EndIf
EndFunc ;==>_TargetaddPic
#endregion
#region _TargetaddProgress;
;===============================================================================
; Function Name: _TargetaddProgress()
; Description: Add Progress control to existing control/window
; Parameter(s): $PosX - 'X' horiz. position coordinate
; $PosY - 'Y' vert. position coordinate
; $SizeX - 'X' horiz. Size value
; $SizeY - 'Y' vert. Size value
; $style [optional] - 'style' of Progress control
; $exstyle [optional] - 'exstyle' of Progress control
; $LocTargethWnd [optional] - 'Local' _GuiTarget assigned variable
; Requirement(s): #include <guiconstants.au3>
; Return Value(s): On Success - Returns 3 element array:
; $a[0] = ControlId of Progress control
; $a[1] = hWnd of Progress control
; $a[2] = hWnd of Progress controls Child window
; On Failure - returns 0, @error set to 1
; Author(s): Quaizywabbit
;===============================================================================
Func _TargetaddProgress($PosX, $PosY, $SizeX, $SizeY, $style = -1, $exstyle = -1, $LocTargethWnd = 0)
If Not ($LocTargethWnd = 0) Then $TargethWnd = $LocTargethWnd
Local $a[3]
$a[2] = _TargetaddChild("", $PosX, $PosY, $SizeX, $SizeY, $TargethWnd)
$a[0] = GUICtrlCreateProgress($PosX, $PosY, $SizeX, $SizeY, $style, $exstyle)
$a[1] = ControlGetHandle($a[2], "", $a[0])
If $a[2] = 0 Or $a[0] = 0 Or $a[1] = "" Then
SetError(1)
Return 0
Else
Return $a
EndIf
EndFunc ;==>_TargetaddProgress
#endregion
#region _TargetaddSlider;
;===============================================================================
; Function Name: _TargetaddSlider()
; Description: Add Slider to existing control/window
; Parameter(s): $PosX - 'X' horiz. position coordinate
; $PosY - 'Y' vert. position coordinate
; $SizeX - 'X' horiz. Size value
; $SizeY - 'Y' vert. Size value
; $style [optional] - 'style' of Slider control
; $exstyle [optional] - 'exstyle' of Slider control
; $LocTargethWnd [optional] - 'Local' _GuiTarget assigned variable
; Requirement(s): #include <guiconstants.au3>
; Return Value(s): On Success - Returns 3 element array:
; $a[0] = ControlId of Slider control
; $a[1] = hWnd of Slider control
; $a[2] = hWnd of Slider controls Child window
; On Failure - returns 0, @error set to 1
; Author(s): Quaizywabbit
;===============================================================================
Func _TargetaddSlider($PosX, $PosY, $SizeX, $SizeY, $style = -1, $exstyle = -1, $LocTargethWnd = 0)
If Not ($LocTargethWnd = 0) Then $TargethWnd = $LocTargethWnd
Local $a[3]
$a[2] = _TargetaddChild("", $PosX, $PosY, $SizeX, $SizeY, $TargethWnd)
$a[0] = GUICtrlCreateSlider(0, 0, $SizeX, $SizeY, $style, $exstyle)
$a[1] = ControlGetHandle($a[2], "", $a[0])
If $a[2] = 0 Or $a[0] = 0 Or $a[1] = "" Then
SetError(1)
Return 0
Else
Return $a
EndIf
EndFunc ;==>_TargetaddSlider
#endregion
#region _TargetaddTab;
;===============================================================================
; Function Name: _TargetaddTab()
; Description: Add Tab control to existing control/window
; Parameter(s): $PosX - 'X' horiz. position coordinate
; $PosY - 'Y' vert. position coordinate
; $SizeX - 'X' horiz. Size value
; $SizeY - 'Y' vert. Size value
; $style [optional] - 'style' of Tab control
; $exstyle [optional] - 'exstyle' of Tab control
; $LocTargethWnd [optional] - 'Local' _GuiTarget assigned variable
; Requirement(s): #include <guiconstants.au3>
; Return Value(s): On Success - Returns 3 element array:
; $a[0] = ControlId of Tab control
; $a[1] = hWnd of Tab control
; $a[2] = hWnd of Tab controls Child window
; On Failure - returns 0, @error set to 1
; Author(s): Quaizywabbit
;===============================================================================
Func _TargetaddTab($PosX, $PosY, $SizeX, $SizeY, $style = -1, $exstyle = -1, $LocTargethWnd = 0)
If Not ($LocTargethWnd = 0) Then $TargethWnd = $LocTargethWnd
Local $a[3]
$a[2] = _TargetaddChild("", $PosX, $PosY, $SizeX, $SizeY, $TargethWnd)
$a[0] = GUICtrlCreateTab(0, 0, $SizeX, $SizeY, $style, $exstyle)
$a[1] = ControlGetHandle($a[2], "", $a[0])
If $a[2] = 0 Or $a[0] = 0 Or $a[1] = "" Then
SetError(1)
Return 0
Else
Return $a
EndIf
EndFunc ;==>_TargetaddTab
#endregion
#region _TargetaddTreeview;
;===============================================================================
; Function Name: _TargetaddTreeview()
; Description: Add Treeview control to existing control/window
; Parameter(s): $PosX - 'X' horiz. position coordinate
; $PosY - 'Y' vert. position coordinate
; $SizeX - 'X' horiz. Size value
; $SizeY - 'Y' vert. Size value
; $style [optional] - 'style' of Treeview control
; $exstyle [optional] - 'exstyle' of Treeview control
; $LocTargethWnd [optional] - 'Local' _GuiTarget assigned variable
; Requirement(s): #include <guiconstants.au3>
; Return Value(s): On Success - Returns 3 element array:
; $a[0] = ControlId of Treeview control
; $a[1] = hWnd of Treeview control
; $a[2] = hWnd of Treeview controls Child window
; On Failure - returns 0, @error set to 1
; Author(s): Quaizywabbit
;===============================================================================
Func _TargetaddTreeview($PosX, $PosY, $SizeX, $SizeY, $style = -1, $exstyle = -1, $LocTargethWnd = 0)
If Not ($LocTargethWnd = 0) Then $TargethWnd = $LocTargethWnd
Local $a[3]
$a[2] = _TargetaddChild("", $PosX, $PosY, $SizeX, $SizeY, $TargethWnd)
$a[0] = GUICtrlCreateTreeView(0, 0, $SizeX, $SizeY, $style, $exstyle)
$a[1] = ControlGetHandle($a[2], "", $a[0])
If $a[2] = 0 Or $a[0] = 0 Or $a[1] = "" Then
SetError(1)
Return 0
Else
Return $a
EndIf
EndFunc ;==>_TargetaddTreeview
#endregion
#region _TargetSetStyle;
;===============================================================================
; Function Name: _TargetStyle()
; Description: Retrieves/Sets/Unsets/Replaces Styles and/or Exstyles of 'targeted' control/window
; When called with no parameters returns the current Styles/Exstyles for the window/control
; Parameter(s): $action[optional] - "set", "unset", "toggle", and "replace"
; $Bool[optional] - 1 to Update window/control when finished
; $Style[optional] - New window style (multiple styles can be BitOr'd)
; $ExStyle[optional] - New window exstyle (multiple styles can be BitOr'd)
; $LocTargethWnd[optional] - 'Local' _GuiTarget assigned variable
; Requirement(s): #include <guiconstants.au3>
; Return Value(s): On success: $action left blank-returns an array with $array[0] as the current Style and $array[1] as the current Exstyle
; otherwise it returns previous style and exstyle
; If style and exstyle are changed the function will return an array
; with $Array[0] as the previous style and
; $Array[1] as the previous exstyle
; On Error:affected array element returns 0, error flag set to 1 if Style, 2 if ExStyle.
; MsgBox displayed for either.
; Msgbox displayed for incorrect 'action' verb, returns 0 and sets error
; Author(s): Chase/Xenogis- - -Modified by Quaizywabbit
; 3 AUG 2005: corrected "Remove" to operate properly(Thanks Valik and Nutster!)
; 7 AUG 2005: changed 'action' verbs to "set", "unset", and "replace"
; 8 AUG 2005 fixed _TargetStyle() Select/Case logic (messed it up from v2.2___ooops!!)
; 10 AUG 2005 added "toggle"
; Comments: can only do a single 'verb' during each call, so required Style/Exstyle combinations may require
; additional _TargetStyle() calls with the last call setting $Bool to 1 to update the 'target'
;===============================================================================
Func _TargetStyle($action = 0, $Bool = 0, $style = -1, $exstyle = -1, $LocTargethWnd = 0)
If Not ($LocTargethWnd = 0) Then $TargethWnd = $LocTargethWnd
Local $ostyle = DllCall("user32.dll", "long", "GetWindowLong", "hwnd", $TargethWnd, "int", -16);get existing Style
Local $oexstyle = DllCall("user32.dll", "long", "GetWindowLong", "hwnd", $TargethWnd, "int", -20);get existing ExStyle
Select
Case $action = "set"
If $style <> -1 Then Local $scall = DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $TargethWnd, "int", -16, "long", BitOR($ostyle[0], $style));add Style to old style
If $exstyle <> -1 Then Local $exscall = DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $TargethWnd, "int", -20, "long", BitOR($oexstyle[0], $exstyle));add Exstyle to old exstyle
Case $action = "unset"
If $style <> -1 Then Local $scall = DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $TargethWnd, "int", -16, "long", BitAND($ostyle[0], BitNOT($style)));remove Style from old style
If $exstyle <> -1 Then Local $exscall = DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $TargethWnd, "int", -20, "long", BitAND($oexstyle[0], BitNOT($exstyle)));remove Exstyle from old exstyle
Case $action = "toggle"
If $style <> -1 Then Local $scall = DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $TargethWnd, "int", -16, "long", BitXOR($ostyle[0], $style));Toggle Style(s) on or off
If $exstyle <> -1 Then Local $exscall = DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $TargethWnd, "int", -20, "long", BitXOR($oexstyle[0], $exstyle));Toggle ExStyle(s) on or off
Case $action = "replace"
If $style <> -1 Then Local $scall = DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $TargethWnd, "int", -16, "long", $style);replace Style
If $exstyle <> -1 Then Local $exscall = DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $TargethWnd, "int", -20, "long", $exstyle);replace Exstyle
Case Else
Dim $ret[2]
$ret[0] = $ostyle[0]
$ret[1] = $oexstyle[0]
Return $ret
EndSelect
Dim $return[2]
If $style <> -1 And $scall[0] <> $ostyle[0] Then
SetError(1)
$return[0] = 0
MsgBox(4096, "Error setting Style", "Please check your Style settings and try again")
ElseIf $exstyle <> -1 And $exscall[0] <> $oexstyle[0] Then
SetError(2)
$return[1] = 0
MsgBox(4096, "Error setting ExStyle", "Please check your ExStyle settings and try again")
Else
If $style <> -1 Then
$return[0] = $scall[0]
Else
$return[0] = $ostyle[0]
EndIf
If $exstyle <> -1 Then
$return[1] = $exscall[0]
Else
$return[1] = $oexstyle[0]
EndIf
EndIf
If $Bool = 1 Then _Refresh($TargethWnd)
Return $return
EndFunc ;==>_TargetStyle
#endregion
#region _WinMenuGetHandle()
;===============================================================================
; Function Name: _WinMenuGetHandle()
; Description: Retrieves handle to a Window Menu
; Parameter(s): $hwnd - Window handle
; Requirement(s): none
; Return Value(s): On Success - $ret[0] = Window handle
; $ret[1] = Menu handle
; On Failure: returns 0 and @error set to 1
; MsgBox shown explaining possible reasons for failure
; Author(s): Quaizywabbit
; Comments: Child windows cannot have menu's. Not all Non-Child windows have menu's.
;===============================================================================
Func _WinMenuGetHandle($window)
Local $menu = DllCall("user32.dll", "hwnd", "GetMenu", "hwnd", $window)
Local $test = DllCall("user32.dll", "int", "IsMenu", "hwnd", $menu[0])
If $test[0] <> 0 Then
Dim $ret[2]
$ret[0] = $window
$ret[1] = $menu[0]
Return $ret
Else
SetError(1)
MsgBox(4096, "Error-_WinMenuGetHandle", "Could not retrieve Menu handle:window is child, or has no menu")
Return 0
EndIf
EndFunc ;==>_WinMenuGetHandle
#endregion
#region _WinMenuSetState()
;===============================================================================
; Function Name: _WinMenuSetState()
; Description: 'shows' or 'hides' a Window Menu's visibility
; Parameter(s): $window - initial call = Non-Child Window handle(that has a Menu)
; subsequent calls = returned array variable from initial call
; $state - "show" [default]
; "hide"
; Requirement(s): _WinMenuGetHandle()
; Return Value(s): On Success(initial call only) - $ret[0] = Window handle
; $ret[1] = Menu handle
; On Failure: returns 0 and @error set to 1
; MsgBox shown explaining possible reasons for failure
; Author(s): Quaizywabbit
; Comments: Must "hide" before "show", when "show"ing use the initial "hide" call variable
; Child windows cannot have menu's("show" won't work). Not all Non-Child windows have menu's.
;===============================================================================
Func _WinMenuSetState($window, $state = "show");
;is this the initial call?
If IsArray($window) Then ; 'old call
Local $windowhwnd = $window[0]
Local $menuhwnd = $window[1]
Else
Local $get = _WinMenuGetHandle($window); 'new call
$windowhwnd = $get[0]
$menuhwnd = $get[1]
EndIf
Select
Case $state = "hide"
Local $menu = 0
Local $menusetsucceed_fail = DllCall("user32.dll", "int", "SetMenu", "hwnd", $windowhwnd, "hwnd", $menu)
If $menusetsucceed_fail[0] = 0 Then
SetError(1)
MsgBox(4096, "Error!", " 'hide' update failed!")
Return 0
EndIf
Case $state = "show"
Local $menusetsucceed_fail = DllCall("user32.dll", "int", "SetMenu", "hwnd", $window[0], "hwnd", $window[1])
If $menusetsucceed_fail[0] = 0 Then
SetError(1)
MsgBox(4096, "Error!", "'show' update failed!")
Return 0
EndIf
EndSelect
If Not IsArray($window) Then ;( Return only on initial call)
Dim $ret[2]
$ret[0] = $windowhwnd
$ret[1] = $menuhwnd
Return $ret
EndIf
EndFunc ;==>_WinMenuSetState
#endregion
#region aux-func's
;===============================================================================