ffi-wingui-core 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/examples/Command.rbw CHANGED
@@ -19,8 +19,8 @@ def onCreate(hwnd,
19
19
 
20
20
  hbar = CreateMenu()
21
21
  hmenu1 = CreatePopupMenu()
22
- InsertMenu(hmenu1, -1, MF_STRING, ID[:ITEM1], L("Item&1\tAlt+I"))
23
- InsertMenu(hbar, -1, MF_POPUP, hmenu1.to_i, L('Menu&1'))
22
+ AppendMenu(hmenu1, MF_STRING, ID[:ITEM1], L("Item&1\tAlt+I"))
23
+ AppendMenu(hbar, MF_POPUP, hmenu1.to_i, L('Menu&1'))
24
24
  SetMenu(hwnd, hbar)
25
25
 
26
26
  accels = [
data/examples/Menu.rbw CHANGED
@@ -14,32 +14,32 @@ def onCreate(hwnd,
14
14
 
15
15
  hbar = CreateMenu()
16
16
  hmenu1 = CreatePopupMenu()
17
- InsertMenu(hmenu1, -1, MF_STRING, ID[:ITEM1], L('Item&1'))
17
+ AppendMenu(hmenu1, MF_STRING, ID[:ITEM1], L('Item&1'))
18
18
  SetMenuDefaultItem(hmenu1, ID[:ITEM1], 0)
19
19
 
20
- InsertMenu(hmenu1, -1, MF_STRING | MF_GRAYED, ID[:ITEM2], L('Item&2'))
21
- InsertMenu(hmenu1, -1, MF_STRING | MF_CHECKED, ID[:ITEM3], L('Item&3'))
20
+ AppendMenu(hmenu1, MF_STRING | MF_GRAYED, ID[:ITEM2], L('Item&2'))
21
+ AppendMenu(hmenu1, MF_STRING | MF_CHECKED, ID[:ITEM3], L('Item&3'))
22
22
 
23
- InsertMenu(hmenu1, -1, MF_SEPARATOR, 0, nil)
23
+ AppendMenu(hmenu1, MF_SEPARATOR, 0, nil)
24
24
 
25
- InsertMenu(hmenu1, -1, MF_STRING | MF_CHECKED | MFT_RADIOCHECK,
25
+ AppendMenu(hmenu1, MF_STRING | MF_CHECKED | MFT_RADIOCHECK,
26
26
  ID[:ITEM4], L('Item&4'))
27
- InsertMenu(hmenu1, -1, MF_STRING, ID[:ITEM5], L('Item&5'))
27
+ AppendMenu(hmenu1, MF_STRING, ID[:ITEM5], L('Item&5'))
28
28
 
29
- InsertMenu(hmenu1, -1, MF_SEPARATOR, 0, nil)
29
+ AppendMenu(hmenu1, MF_SEPARATOR, 0, nil)
30
30
 
31
31
  hmenu2 = CreatePopupMenu()
32
- InsertMenu(hmenu2, -1, MF_STRING | MF_CHECKED | MFT_RADIOCHECK,
32
+ AppendMenu(hmenu2, MF_STRING | MF_CHECKED | MFT_RADIOCHECK,
33
33
  ID[:ITEM6], L('Item&6'))
34
- InsertMenu(hmenu2, -1, MF_STRING, ID[:ITEM7], L('Item&7'))
35
- InsertMenu(hmenu1, -1, MF_POPUP, hmenu2.to_i, L('Menu&2'))
36
- InsertMenu(hbar, -1, MF_POPUP, hmenu1.to_i, L('Menu&1'))
34
+ AppendMenu(hmenu2, MF_STRING, ID[:ITEM7], L('Item&7'))
35
+ AppendMenu(hmenu1, MF_POPUP, hmenu2.to_i, L('Menu&2'))
36
+ AppendMenu(hbar, MF_POPUP, hmenu1.to_i, L('Menu&1'))
37
37
 
38
- InsertMenu(hbar, -1, MF_STRING, ID[:ITEM8], L('Item&8'))
38
+ AppendMenu(hbar, MF_STRING, ID[:ITEM8], L('Item&8!'))
39
39
 
40
40
  hmenu3 = CreatePopupMenu()
41
- InsertMenu(hmenu3, -1, MF_STRING, ID[:ITEM9], L('Item&9'))
42
- InsertMenu(hbar, -1, MF_POPUP | MF_RIGHTJUSTIFY, hmenu3.to_i, L('Menu&3'))
41
+ AppendMenu(hmenu3, MF_STRING, ID[:ITEM9], L('Item&9'))
42
+ AppendMenu(hbar, MF_POPUP | MF_RIGHTJUSTIFY, hmenu3.to_i, L('Menu&3'))
43
43
  SetMenu(hwnd, hbar)
44
44
 
45
45
  0
@@ -13,7 +13,7 @@ def onCreate(hwnd,
13
13
  xtra = Util::Id2Ref[GetWindowLong(hwnd, GWL_USERDATA)]
14
14
 
15
15
  xtra[:hcm] = CreatePopupMenu()
16
- InsertMenu(xtra[:hcm], -1, MF_STRING, ID[:ITEM1], L('Item&1'))
16
+ AppendMenu(xtra[:hcm], MF_STRING, ID[:ITEM1], L('Item&1'))
17
17
 
18
18
  0
19
19
  end
@@ -31,45 +31,45 @@ def onCreate(hwnd,
31
31
 
32
32
  hbar = CreateMenu()
33
33
  hmenu1 = CreatePopupMenu()
34
- InsertMenu(hmenu1, -1, MF_STRING, ID[:ITEM1], L('Item&1'))
34
+ AppendMenu(hmenu1, MF_STRING, ID[:ITEM1], L('Item&1'))
35
35
  SetMenuDefaultItem(hmenu1, ID[:ITEM1], 0)
36
36
  SetMenuItemInfo(hmenu1, ID[:ITEM1], 0, info)
37
37
 
38
- InsertMenu(hmenu1, -1, MF_STRING | MF_GRAYED, ID[:ITEM2], L('Item&2'))
38
+ AppendMenu(hmenu1, MF_STRING | MF_GRAYED, ID[:ITEM2], L('Item&2'))
39
39
  SetMenuItemInfo(hmenu1, ID[:ITEM2], 0, info)
40
40
 
41
- InsertMenu(hmenu1, -1, MF_STRING | MF_CHECKED, ID[:ITEM3], L('Item&3'))
41
+ AppendMenu(hmenu1, MF_STRING | MF_CHECKED, ID[:ITEM3], L('Item&3'))
42
42
  SetMenuItemInfo(hmenu1, ID[:ITEM3], 0, info)
43
43
 
44
- InsertMenu(hmenu1, -1, MF_SEPARATOR, 0, nil)
44
+ AppendMenu(hmenu1, MF_SEPARATOR, 0, nil)
45
45
 
46
- InsertMenu(hmenu1, -1, MF_STRING | MF_CHECKED | MFT_RADIOCHECK,
46
+ AppendMenu(hmenu1, MF_STRING | MF_CHECKED | MFT_RADIOCHECK,
47
47
  ID[:ITEM4], L('Item&4'))
48
48
  SetMenuItemInfo(hmenu1, ID[:ITEM4], 0, info)
49
49
 
50
- InsertMenu(hmenu1, -1, MF_STRING, ID[:ITEM5], L('Item&5'))
50
+ AppendMenu(hmenu1, MF_STRING, ID[:ITEM5], L('Item&5'))
51
51
  SetMenuItemInfo(hmenu1, ID[:ITEM5], 0, info)
52
52
 
53
- InsertMenu(hmenu1, -1, MF_SEPARATOR, 0, nil)
53
+ AppendMenu(hmenu1, MF_SEPARATOR, 0, nil)
54
54
 
55
55
  hmenu2 = CreatePopupMenu()
56
- InsertMenu(hmenu2, -1, MF_STRING | MF_CHECKED | MFT_RADIOCHECK,
56
+ AppendMenu(hmenu2, MF_STRING | MF_CHECKED | MFT_RADIOCHECK,
57
57
  ID[:ITEM6], L('Item&6'))
58
58
  SetMenuItemInfo(hmenu2, ID[:ITEM6], 0, info)
59
59
 
60
- InsertMenu(hmenu2, -1, MF_STRING, ID[:ITEM7], L('Item&7'))
60
+ AppendMenu(hmenu2, MF_STRING, ID[:ITEM7], L('Item&7'))
61
61
  SetMenuItemInfo(hmenu2, ID[:ITEM7], 0, info)
62
- InsertMenu(hmenu1, -1, MF_POPUP, hmenu2.to_i, L('Menu&2'))
62
+ AppendMenu(hmenu1, MF_POPUP, hmenu2.to_i, L('Menu&2'))
63
63
  SetMenuItemInfo(hmenu1, 7, MF_BYPOSITION, info)
64
- InsertMenu(hbar, -1, MF_POPUP, hmenu1.to_i, L('Menu&1'))
64
+ AppendMenu(hbar, MF_POPUP, hmenu1.to_i, L('Menu&1'))
65
65
  SetMenuItemInfo(hbar, 0, MF_BYPOSITION, info)
66
66
 
67
- InsertMenu(hbar, -1, MF_STRING, ID[:ITEM8], L('Item&8'))
67
+ AppendMenu(hbar, MF_STRING, ID[:ITEM8], L('Item&8!'))
68
68
  SetMenuItemInfo(hbar, ID[:ITEM8], 0, info)
69
69
 
70
70
  hmenu3 = CreatePopupMenu()
71
- InsertMenu(hmenu3, -1, MF_BITMAP, ID[:ITEM9], xtra[:hbmp])
72
- InsertMenu(hbar, -1, MF_POPUP | MF_BITMAP | MF_RIGHTJUSTIFY, hmenu3.to_i, xtra[:hbmp])
71
+ AppendMenu(hmenu3, MF_BITMAP, ID[:ITEM9], xtra[:hbmp])
72
+ AppendMenu(hbar, MF_POPUP | MF_BITMAP | MF_RIGHTJUSTIFY, hmenu3.to_i, xtra[:hbmp])
73
73
  SetMenu(hwnd, hbar)
74
74
 
75
75
  0
@@ -1,7 +1,11 @@
1
+ #tstart = Time.now
1
2
  require 'ffi'
3
+ #tffi = Time.now
2
4
 
5
+ #{ WINGUI_xxx
3
6
  WINGUI_VISUAL_STYLES = true unless defined?(WINGUI_VISUAL_STYLES)
4
7
  WINGUI_DPI_AWARE = true unless defined?(WINGUI_DPI_AWARE)
8
+ #}
5
9
 
6
10
  module WinGUI
7
11
  extend FFI::Library
@@ -295,7 +299,7 @@ module WinGUI
295
299
  :pointer
296
300
  ], :int
297
301
 
298
- if WINVER >= WINXP
302
+ if WINVER >= WINXP # ACTCTX
299
303
  class ACTCTX < FFI::Struct
300
304
  extend Util::ScopedStruct
301
305
 
@@ -432,22 +436,96 @@ module WinGUI
432
436
 
433
437
  module_function :RGB, :GetRValue, :GetGValue, :GetBValue
434
438
 
435
- #{ GetDeviceCaps indices
439
+ attach_function :CreateCompatibleDC, [
440
+ :pointer
441
+ ], :pointer
442
+
443
+ attach_function :DeleteDC, [
444
+ :pointer
445
+ ], :int
446
+
447
+ #{ devCapIndex constants
436
448
  LOGPIXELSX = 88
437
449
  LOGPIXELSY = 90
438
450
  #}
439
451
 
440
452
  attach_function :GetDeviceCaps, [
441
453
  :pointer,
442
- :int
454
+ :int # in devCapIndex
443
455
  ], :int
444
456
 
457
+ attach_function :CreateCompatibleBitmap, [
458
+ :pointer,
459
+ :int,
460
+ :int
461
+ ], :pointer
462
+
445
463
  def DPIAwareFontHeight(pointSize)
446
464
  -MulDiv(pointSize, DPIY, 72)
447
465
  end
448
466
 
449
467
  module_function :DPIAwareFontHeight
450
468
 
469
+ #{ FW_xxx
470
+ FW_DONTCARE = 0
471
+ FW_THIN = 100
472
+ FW_EXTRALIGHT = 200
473
+ FW_LIGHT = 300
474
+ FW_NORMAL = 400
475
+ FW_MEDIUM = 500
476
+ FW_SEMIBOLD = 600
477
+ FW_BOLD = 700
478
+ FW_EXTRABOLD = 800
479
+ FW_HEAVY = 900
480
+ #}
481
+
482
+ #{ xxx_CHARSET
483
+ DEFAULT_CHARSET = 1
484
+ ANSI_CHARSET = 0
485
+ #}
486
+
487
+ #{ OUT_xxx_PRECIS
488
+ OUT_DEFAULT_PRECIS = 0
489
+ OUT_DEVICE_PRECIS = 5
490
+ OUT_RASTER_PRECIS = 6
491
+ OUT_OUTLINE_PRECIS = 8
492
+ OUT_SCREEN_OUTLINE_PRECIS = 9
493
+ OUT_PS_ONLY_PRECIS = 10
494
+ OUT_TT_PRECIS = 4
495
+ OUT_TT_ONLY_PRECIS = 7
496
+ #}
497
+
498
+ #{ CLIP_xxx_PRECIS
499
+ CLIP_DEFAULT_PRECIS = 0
500
+ #}
501
+
502
+ #{ xxx_QUALITY
503
+ DEFAULT_QUALITY = 0
504
+ DRAFT_QUALITY = 1
505
+ PROOF_QUALITY = 2
506
+ NONANTIALIASED_QUALITY = 3
507
+ ANTIALIASED_QUALITY = 4
508
+ if WINVER >= WINXP
509
+ CLEARTYPE_QUALITY = 5
510
+ CLEARTYPE_NATURAL_QUALITY = 6
511
+ end
512
+ #}
513
+
514
+ #{ xxx_PITCH
515
+ DEFAULT_PITCH = 0
516
+ FIXED_PITCH = 1
517
+ VARIABLE_PITCH = 2
518
+ #}
519
+
520
+ #{ FF_xxx
521
+ FF_DONTCARE = 0 << 4
522
+ FF_MODERN = 3 << 4
523
+ FF_SWISS = 2 << 4
524
+ FF_ROMAN = 1 << 4
525
+ FF_SCRIPT = 4 << 4
526
+ FF_DECORATIVE = 5 << 4
527
+ #}
528
+
451
529
  class LOGFONT < FFI::Struct
452
530
  extend Util::ScopedStruct
453
531
 
@@ -472,6 +550,29 @@ module WinGUI
472
550
  LOGFONT.by_ref(:in)
473
551
  ], :pointer
474
552
 
553
+ #{ BS_xxx
554
+ BS_NULL = 1
555
+ BS_SOLID = 0
556
+ BS_HATCHED = 2
557
+ BS_PATTERN = 3
558
+ BS_DIBPATTERN = 5
559
+ BS_DIBPATTERNPT = 6
560
+ #}
561
+
562
+ #{ DIB_xxx
563
+ DIB_RGB_COLORS = 0
564
+ DIB_PAL_COLORS = 1
565
+ #}
566
+
567
+ #{ HS_xxx
568
+ HS_HORIZONTAL = 0
569
+ HS_VERTICAL = 1
570
+ HS_FDIAGONAL = 2
571
+ HS_BDIAGONAL = 3
572
+ HS_CROSS = 4
573
+ HS_DIAGCROSS = 5
574
+ #}
575
+
475
576
  class LOGBRUSH < FFI::Struct
476
577
  extend Util::ScopedStruct
477
578
 
@@ -485,6 +586,29 @@ module WinGUI
485
586
  LOGBRUSH.by_ref(:in)
486
587
  ], :pointer
487
588
 
589
+ #{ PS_xxx
590
+ PS_COSMETIC = 0x00000000
591
+ PS_GEOMETRIC = 0x00010000
592
+
593
+ PS_NULL = 5
594
+ PS_SOLID = 0
595
+ PS_DASH = 1
596
+ PS_DOT = 2
597
+ PS_DASHDOT = 3
598
+ PS_DASHDOTDOT = 4
599
+ PS_ALTERNATE = 8
600
+ PS_USERSTYLE = 7
601
+ PS_INSIDEFRAME = 6
602
+
603
+ PS_ENDCAP_FLAT = 0x00000200
604
+ PS_ENDCAP_SQUARE = 0x00000100
605
+ PS_ENDCAP_ROUND = 0x00000000
606
+
607
+ PS_JOIN_BEVEL = 0x00001000
608
+ PS_JOIN_MITER = 0x00002000
609
+ PS_JOIN_ROUND = 0x00000000
610
+ #}
611
+
488
612
  class LOGPEN < FFI::Struct
489
613
  extend Util::ScopedStruct
490
614
 
@@ -498,6 +622,14 @@ module WinGUI
498
622
  LOGPEN.by_ref(:in)
499
623
  ], :pointer
500
624
 
625
+ attach_function :ExtCreatePen, [
626
+ :ulong,
627
+ :ulong,
628
+ LOGBRUSH.by_ref(:in),
629
+ :ulong,
630
+ :pointer
631
+ ], :pointer
632
+
501
633
  attach_function :CreateRectRgn, [
502
634
  :int,
503
635
  :int,
@@ -521,24 +653,39 @@ module WinGUI
521
653
  :int
522
654
  ], :pointer
523
655
 
524
- #{ POLYFILL_xxx
656
+ #{ polyFillMode constants
525
657
  ALTERNATE = 1
526
658
  WINDING = 2
527
659
  #}
528
660
 
661
+ attach_function :SetPolyFillMode, [
662
+ :pointer,
663
+ :int # in polyFillMode
664
+ ], :int
665
+
666
+ attach_function :GetPolyFillMode, [
667
+ :pointer
668
+ ], :int # polyFillMode
669
+
529
670
  attach_function :CreatePolygonRgn, [
530
671
  :pointer,
531
672
  :int,
532
- :int
673
+ :int # in polyFillMode
533
674
  ], :pointer
534
675
 
535
676
  attach_function :CreatePolyPolygonRgn, [
536
677
  :pointer,
537
678
  :pointer,
538
679
  :int,
539
- :int
680
+ :int # in polyFillMode
540
681
  ], :pointer
541
682
 
683
+ attach_function :OffsetRgn, [
684
+ :pointer,
685
+ :int,
686
+ :int
687
+ ], :int
688
+
542
689
  #{ RGN_xxx
543
690
  RGN_COPY = 5
544
691
  RGN_DIFF = 4
@@ -547,7 +694,7 @@ module WinGUI
547
694
  RGN_XOR = 3
548
695
  #}
549
696
 
550
- #{ xxxREGION
697
+ #{ rgnType constants
551
698
  ERROR = 0
552
699
  NULLREGION = 1
553
700
  SIMPLEREGION = 2
@@ -559,6 +706,41 @@ module WinGUI
559
706
  :pointer,
560
707
  :pointer,
561
708
  :int
709
+ ], :int # rgnType
710
+
711
+ attach_function :GetRgnBox, [
712
+ :pointer,
713
+ RECT.by_ref(:out)
714
+ ], :int
715
+
716
+ attach_function :PtInRegion, [
717
+ :pointer,
718
+ :int,
719
+ :int
720
+ ], :int
721
+
722
+ attach_function :RectInRegion, [
723
+ :pointer,
724
+ RECT.by_ref(:in)
725
+ ], :int
726
+
727
+ attach_function :EqualRgn, [
728
+ :pointer,
729
+ :pointer
730
+ ], :int
731
+
732
+ attach_function :FrameRgn, [
733
+ :pointer,
734
+ :pointer,
735
+ :pointer,
736
+ :int,
737
+ :int
738
+ ], :int
739
+
740
+ attach_function :FillRgn, [
741
+ :pointer,
742
+ :pointer,
743
+ :pointer
562
744
  ], :int
563
745
 
564
746
  attach_function :DeleteObject, [
@@ -571,6 +753,38 @@ module WinGUI
571
753
  :pointer
572
754
  ], :int
573
755
 
756
+ #{ R2_xxx
757
+ R2_BLACK = 1
758
+ R2_WHITE = 16
759
+
760
+ R2_NOP = 11
761
+ R2_NOT = 6
762
+ R2_COPYPEN = 13
763
+ R2_NOTCOPYPEN = 4
764
+
765
+ R2_MERGEPEN = 15
766
+ R2_MERGENOTPEN = 12
767
+ R2_MERGEPENNOT = 14
768
+ R2_NOTMERGEPEN = 2
769
+
770
+ R2_MASKPEN = 9
771
+ R2_MASKNOTPEN = 3
772
+ R2_MASKPENNOT = 5
773
+ R2_NOTMASKPEN = 8
774
+
775
+ R2_XORPEN = 7
776
+ R2_NOTXORPEN = 10
777
+ #}
778
+
779
+ attach_function :SetROP2, [
780
+ :pointer,
781
+ :int
782
+ ], :int
783
+
784
+ attach_function :GetROP2, [
785
+ :pointer
786
+ ], :int
787
+
574
788
  attach_function :SetBkColor, [
575
789
  :pointer,
576
790
  :ulong
@@ -594,6 +808,29 @@ module WinGUI
594
808
  :pointer
595
809
  ], :pointer
596
810
 
811
+ #{ AD_xxx
812
+ AD_COUNTERCLOCKWISE = 1
813
+ AD_CLOCKWISE = 2
814
+ #}
815
+
816
+ attach_function :SetArcDirection, [
817
+ :pointer,
818
+ :int
819
+ ], :int
820
+
821
+ attach_function :GetArcDirection, [
822
+ :int
823
+ ], :int
824
+
825
+ attach_function :SaveDC, [
826
+ :pointer
827
+ ], :int
828
+
829
+ attach_function :RestoreDC, [
830
+ :pointer,
831
+ :int
832
+ ], :int
833
+
597
834
  attach_function :TextOut, :TextOutW, [
598
835
  :pointer,
599
836
  :int,
@@ -614,13 +851,237 @@ module WinGUI
614
851
  :int,
615
852
  :int
616
853
  ], :int
854
+
855
+ attach_function :Polyline, [
856
+ :pointer,
857
+ :pointer,
858
+ :int
859
+ ], :int
860
+
861
+ attach_function :PolylineTo, [
862
+ :pointer,
863
+ :pointer,
864
+ :ulong
865
+ ], :int
866
+
867
+ attach_function :PolyPolyline, [
868
+ :pointer,
869
+ :pointer,
870
+ :pointer,
871
+ :ulong
872
+ ], :int
873
+
874
+ attach_function :Arc, [
875
+ :pointer,
876
+ :int,
877
+ :int,
878
+ :int,
879
+ :int,
880
+ :int,
881
+ :int,
882
+ :int,
883
+ :int,
884
+ ], :int
885
+
886
+ attach_function :ArcTo, [
887
+ :pointer,
888
+ :int,
889
+ :int,
890
+ :int,
891
+ :int,
892
+ :int,
893
+ :int,
894
+ :int,
895
+ :int,
896
+ ], :int
897
+
898
+ attach_function :AngleArc, [
899
+ :pointer,
900
+ :int,
901
+ :int,
902
+ :ulong,
903
+ :float,
904
+ :float
905
+ ], :int
906
+
907
+ attach_function :PolyBezier, [
908
+ :pointer,
909
+ :pointer,
910
+ :ulong
911
+ ], :int
912
+
913
+ attach_function :PolyBezierTo, [
914
+ :pointer,
915
+ :pointer,
916
+ :ulong
917
+ ], :int
918
+
919
+ #{ PT_xxx
920
+ PT_MOVETO = 0x06
921
+ PT_LINETO = 0x02
922
+ PT_BEZIERTO = 0x04
923
+ PT_CLOSEFIGURE = 0x01
924
+ #}
925
+
926
+ attach_function :PolyDraw, [
927
+ :pointer,
928
+ :pointer,
929
+ :pointer,
930
+ :int
931
+ ], :int
932
+
933
+ attach_function :Rectangle, [
934
+ :pointer,
935
+ :int,
936
+ :int,
937
+ :int,
938
+ :int
939
+ ], :int
940
+
941
+ attach_function :RoundRect, [
942
+ :pointer,
943
+ :int,
944
+ :int,
945
+ :int,
946
+ :int,
947
+ :int,
948
+ :int
949
+ ], :int
950
+
951
+ attach_function :Ellipse, [
952
+ :pointer,
953
+ :int,
954
+ :int,
955
+ :int,
956
+ :int
957
+ ], :int
958
+
959
+ attach_function :Pie, [
960
+ :pointer,
961
+ :int,
962
+ :int,
963
+ :int,
964
+ :int,
965
+ :int,
966
+ :int,
967
+ :int,
968
+ :int
969
+ ], :int
970
+
971
+ attach_function :Chord, [
972
+ :pointer,
973
+ :int,
974
+ :int,
975
+ :int,
976
+ :int,
977
+ :int,
978
+ :int,
979
+ :int,
980
+ :int
981
+ ], :int
982
+
983
+ attach_function :Polygon, [
984
+ :pointer,
985
+ :pointer,
986
+ :int
987
+ ], :int
988
+
989
+ attach_function :PolyPolygon, [
990
+ :pointer,
991
+ :pointer,
992
+ :pointer,
993
+ :int
994
+ ], :int
617
995
  #}
618
996
 
619
997
  #{ user32
620
998
  ffi_lib 'user32'
621
999
  ffi_convention :stdcall
622
1000
 
623
- if WINVER >= WINVISTA
1001
+ attach_function :SetRect, [
1002
+ RECT.by_ref(:out),
1003
+ :int,
1004
+ :int,
1005
+ :int,
1006
+ :int
1007
+ ], :int
1008
+
1009
+ attach_function :CopyRect, [
1010
+ RECT.by_ref(:out),
1011
+ RECT.by_ref(:in)
1012
+ ], :int
1013
+
1014
+ attach_function :OffsetRect, [
1015
+ RECT.by_ref,
1016
+ :int,
1017
+ :int
1018
+ ], :int
1019
+
1020
+ attach_function :InflateRect, [
1021
+ RECT.by_ref,
1022
+ :int,
1023
+ :int
1024
+ ], :int
1025
+
1026
+ attach_function :SubtractRect, [
1027
+ RECT.by_ref(:out),
1028
+ RECT.by_ref(:in),
1029
+ RECT.by_ref(:in)
1030
+ ], :int
1031
+
1032
+ attach_function :IntersectRect, [
1033
+ RECT.by_ref(:out),
1034
+ RECT.by_ref(:in),
1035
+ RECT.by_ref(:in)
1036
+ ], :int
1037
+
1038
+ attach_function :UnionRect, [
1039
+ RECT.by_ref(:out),
1040
+ RECT.by_ref(:in),
1041
+ RECT.by_ref(:in)
1042
+ ], :int
1043
+
1044
+ attach_function :IsRectEmpty, [
1045
+ RECT.by_ref(:in)
1046
+ ], :int
1047
+
1048
+ attach_function :PtInRect, [
1049
+ RECT.by_ref(:in),
1050
+ POINT.by_value
1051
+ ], :int
1052
+
1053
+ attach_function :EqualRect, [
1054
+ RECT.by_ref(:in),
1055
+ RECT.by_ref(:in)
1056
+ ], :int
1057
+
1058
+ def NormalizeRect(rect)
1059
+ rect[:left], rect[:right] = rect[:right], rect[:left] if
1060
+ rect[:left] > rect[:right]
1061
+ rect[:top], rect[:bottom] = rect[:bottom], rect[:top] if
1062
+ rect[:top] > rect[:bottom]
1063
+ end
1064
+
1065
+ module_function :NormalizeRect
1066
+
1067
+ attach_function :DrawFocusRect, [
1068
+ :pointer,
1069
+ RECT.by_ref(:in)
1070
+ ], :int
1071
+
1072
+ attach_function :FrameRect, [
1073
+ :pointer,
1074
+ RECT.by_ref(:in),
1075
+ :pointer
1076
+ ], :int
1077
+
1078
+ attach_function :FillRect, [
1079
+ :pointer,
1080
+ RECT.by_ref(:in),
1081
+ :pointer
1082
+ ], :int
1083
+
1084
+ if WINVER >= WINVISTA # SetProcessDPIAware
624
1085
  attach_function :SetProcessDPIAware, [
625
1086
 
626
1087
  ], :int
@@ -628,6 +1089,10 @@ module WinGUI
628
1089
  Detonate(0, :SetProcessDPIAware) if WINGUI_DPI_AWARE
629
1090
  end
630
1091
 
1092
+ attach_function :GetWindowDC, [
1093
+ :pointer
1094
+ ], :pointer
1095
+
631
1096
  attach_function :GetDC, [
632
1097
  :pointer
633
1098
  ], :pointer
@@ -637,8 +1102,7 @@ module WinGUI
637
1102
  :pointer
638
1103
  ], :int
639
1104
 
640
- #{ DPIxxx
641
- Detonate(FFI::Pointer::NULL, :GetDC,
1105
+ Detonate(FFI::Pointer::NULL, :GetDC, # DPIxxx
642
1106
  nil
643
1107
  ).tap { |hdc|
644
1108
  DPIX = GetDeviceCaps(hdc, LOGPIXELSX)
@@ -646,7 +1110,6 @@ module WinGUI
646
1110
 
647
1111
  ReleaseDC(nil, hdc)
648
1112
  }
649
- #}
650
1113
 
651
1114
  def DPIAwareX(x)
652
1115
  MulDiv(x, DPIX, 96)
@@ -761,7 +1224,7 @@ module WinGUI
761
1224
  :uint
762
1225
  ], :int
763
1226
 
764
- if WINVER >= WINXP
1227
+ if WINVER >= WINXP # MessageBoxTimeout
765
1228
  begin
766
1229
  attach_function :MessageBoxTimeout, :MessageBoxTimeoutW, [
767
1230
  :pointer,
@@ -846,7 +1309,11 @@ module WinGUI
846
1309
  :buffer_in
847
1310
  ], :pointer
848
1311
 
849
- begin
1312
+ attach_function :DestroyIcon, [
1313
+ :pointer
1314
+ ], :int
1315
+
1316
+ begin # PrivateExtractIcons
850
1317
  attach_function :PrivateExtractIcons, :PrivateExtractIconsW, [
851
1318
  :buffer_in,
852
1319
  :int,
@@ -861,10 +1328,6 @@ module WinGUI
861
1328
 
862
1329
  end
863
1330
 
864
- attach_function :DestroyIcon, [
865
- :pointer
866
- ], :int
867
-
868
1331
  #{ IDC_xxx
869
1332
  IDC_WAIT = FFI::Pointer.new(32514)
870
1333
  IDC_APPSTARTING = FFI::Pointer.new(32650)
@@ -956,6 +1419,61 @@ module WinGUI
956
1419
  WNDCLASSEX.by_ref(:out)
957
1420
  ], :int
958
1421
 
1422
+ attach_function :FindWindow, :FindWindowW, [
1423
+ :buffer_in,
1424
+ :buffer_in
1425
+ ], :pointer
1426
+
1427
+ callback :WNDENUMPROC, [
1428
+ :pointer,
1429
+ :long
1430
+ ], :int
1431
+
1432
+ attach_function :EnumChildWindows, [
1433
+ :pointer,
1434
+ :WNDENUMPROC,
1435
+ :long
1436
+ ], :int
1437
+
1438
+ attach_function :GetDesktopWindow, [
1439
+
1440
+ ], :pointer
1441
+
1442
+ #{ GW_xxx
1443
+ GW_HWNDFIRST = 0
1444
+ GW_HWNDLAST = 1
1445
+ GW_HWNDNEXT = 2
1446
+ GW_HWNDPREV = 3
1447
+ GW_OWNER = 4
1448
+ GW_ENABLEDPOPUP = 6
1449
+ GW_CHILD = 5
1450
+ #}
1451
+
1452
+ attach_function :GetWindow, [
1453
+ :pointer,
1454
+ :uint
1455
+ ], :pointer
1456
+
1457
+ #{ GA_xxx
1458
+ GA_PARENT = 1
1459
+ GA_ROOT = 2
1460
+ GA_ROOTOWNER = 3
1461
+ #}
1462
+
1463
+ attach_function :GetAncestor, [
1464
+ :pointer,
1465
+ :uint
1466
+ ], :pointer
1467
+
1468
+ attach_function :SetParent, [
1469
+ :pointer,
1470
+ :pointer
1471
+ ], :pointer
1472
+
1473
+ attach_function :GetParent, [
1474
+ :pointer
1475
+ ], :pointer
1476
+
959
1477
  #{ WS_EX_xxx
960
1478
  WS_EX_WINDOWEDGE = 0x00000100
961
1479
  WS_EX_CLIENTEDGE = 0x00000200
@@ -1106,7 +1624,7 @@ module WinGUI
1106
1624
  :ulong
1107
1625
  ], :int
1108
1626
 
1109
- if WINVER >= WINXP
1627
+ if WINVER >= WINXP # GetLayeredWindowAttributes
1110
1628
  attach_function :GetLayeredWindowAttributes, [
1111
1629
  :pointer,
1112
1630
  :pointer,
@@ -1197,6 +1715,24 @@ module WinGUI
1197
1715
  :int
1198
1716
  ], :int
1199
1717
 
1718
+ #{ AW_xxx
1719
+ AW_HIDE = 0x00010000
1720
+ AW_ACTIVATE = 0x00020000
1721
+ AW_CENTER = 0x00000010
1722
+ AW_SLIDE = 0x00040000
1723
+ AW_HOR_POSITIVE = 0x00000001
1724
+ AW_HOR_NEGATIVE = 0x00000002
1725
+ AW_VER_POSITIVE = 0x00000004
1726
+ AW_VER_NEGATIVE = 0x00000008
1727
+ AW_BLEND = 0x00080000
1728
+ #}
1729
+
1730
+ attach_function :AnimateWindow, [
1731
+ :pointer,
1732
+ :ulong,
1733
+ :ulong
1734
+ ], :int
1735
+
1200
1736
  #{ HWND_xxx
1201
1737
  HWND_TOP = FFI::Pointer.new(0)
1202
1738
  HWND_BOTTOM = FFI::Pointer.new(1)
@@ -1243,6 +1779,98 @@ module WinGUI
1243
1779
  :pointer
1244
1780
  ], :int
1245
1781
 
1782
+ #{ SB_xxx
1783
+ SB_HORZ = 0
1784
+ SB_VERT = 1
1785
+ SB_BOTH = 3
1786
+ SB_CTL = 2
1787
+ #}
1788
+
1789
+ #{ SIF_xxx
1790
+ SIF_RANGE = 0x0001
1791
+ SIF_PAGE = 0x0002
1792
+ SIF_POS = 0x0004
1793
+ SIF_TRACKPOS = 0x0010
1794
+ SIF_ALL = SIF_RANGE | SIF_PAGE | SIF_POS | SIF_TRACKPOS
1795
+ SIF_DISABLENOSCROLL = 0x0008
1796
+ #}
1797
+
1798
+ class SCROLLINFO < FFI::Struct
1799
+ extend Util::ScopedStruct
1800
+
1801
+ layout \
1802
+ :cbSize, :uint,
1803
+ :fMask, :uint,
1804
+ :nMin, :int,
1805
+ :nMax, :int,
1806
+ :nPage, :uint,
1807
+ :nPos, :int,
1808
+ :nTrackPos, :int
1809
+ end
1810
+
1811
+ attach_function :SetScrollInfo, [
1812
+ :pointer,
1813
+ :int,
1814
+ SCROLLINFO.by_ref(:in),
1815
+ :int
1816
+ ], :int
1817
+
1818
+ attach_function :GetScrollInfo, [
1819
+ :pointer,
1820
+ :int,
1821
+ SCROLLINFO.by_ref
1822
+ ], :int
1823
+
1824
+ #{ ESB_xxx
1825
+ ESB_DISABLE_LEFT = 0x0001
1826
+ ESB_DISABLE_RIGHT = 0x0002
1827
+ ESB_DISABLE_UP = 0x0001
1828
+ ESB_DISABLE_DOWN = 0x0002
1829
+
1830
+ ESB_ENABLE_BOTH = 0x0000
1831
+ ESB_DISABLE_BOTH = 0x0003
1832
+ #}
1833
+
1834
+ attach_function :EnableScrollBar, [
1835
+ :pointer,
1836
+ :uint,
1837
+ :uint
1838
+ ], :int
1839
+
1840
+ attach_function :ShowScrollBar, [
1841
+ :pointer,
1842
+ :int,
1843
+ :int
1844
+ ], :int
1845
+
1846
+ attach_function :ScrollDC, [
1847
+ :pointer,
1848
+ :int,
1849
+ :int,
1850
+ RECT.by_ref(:in),
1851
+ RECT.by_ref(:in),
1852
+ :pointer,
1853
+ RECT.by_ref(:out)
1854
+ ], :int
1855
+
1856
+ #{ SW_xxx
1857
+ SW_INVALIDATE = 0x0002
1858
+ SW_ERASE = 0x0004
1859
+ SW_SCROLLCHILDREN = 0x0001
1860
+ SW_SMOOTHSCROLL = 0x0010
1861
+ #}
1862
+
1863
+ attach_function :ScrollWindowEx, [
1864
+ :pointer,
1865
+ :int,
1866
+ :int,
1867
+ RECT.by_ref(:in),
1868
+ RECT.by_ref(:in),
1869
+ :pointer,
1870
+ RECT.by_ref(:out),
1871
+ :uint
1872
+ ], :int
1873
+
1246
1874
  attach_function :GetWindowRect, [
1247
1875
  :pointer,
1248
1876
  RECT.by_ref(:out)
@@ -1313,6 +1941,114 @@ module WinGUI
1313
1941
 
1314
1942
  ], :pointer
1315
1943
 
1944
+ attach_function :SetKeyboardState, [
1945
+ :pointer
1946
+ ], :int
1947
+
1948
+ attach_function :GetKeyboardState, [
1949
+ :pointer
1950
+ ], :int
1951
+
1952
+ attach_function :GetKeyState, [
1953
+ :int
1954
+ ], :short
1955
+
1956
+ attach_function :GetAsyncKeyState, [
1957
+ :int
1958
+ ], :short
1959
+
1960
+ #{ INPUT_xxx
1961
+ INPUT_MOUSE = 0
1962
+ INPUT_KEYBOARD = 1
1963
+ INPUT_HARDWARE = 2
1964
+ #}
1965
+
1966
+ #{ MOUSEEVENTF_xxx
1967
+ MOUSEEVENTF_LEFTDOWN = 0x0002
1968
+ MOUSEEVENTF_LEFTUP = 0x0004
1969
+
1970
+ MOUSEEVENTF_RIGHTDOWN = 0x0008
1971
+ MOUSEEVENTF_RIGHTUP = 0x0010
1972
+
1973
+ MOUSEEVENTF_MIDDLEDOWN = 0x0020
1974
+ MOUSEEVENTF_MIDDLEUP = 0x0040
1975
+
1976
+ MOUSEEVENTF_XDOWN = 0x0080
1977
+ MOUSEEVENTF_XUP = 0x0100
1978
+
1979
+ MOUSEEVENTF_WHEEL = 0x0800
1980
+ if WINVER >= WINVISTA
1981
+ MOUSEEVENTF_HWHEEL = 0x01000
1982
+ end
1983
+
1984
+ MOUSEEVENTF_MOVE = 0x0001
1985
+ if WINVER >= WINVISTA
1986
+ MOUSEEVENTF_MOVE_NOCOALESCE = 0x2000
1987
+ end
1988
+
1989
+ MOUSEEVENTF_ABSOLUTE = 0x8000
1990
+ MOUSEEVENTF_VIRTUALDESK = 0x4000
1991
+ #}
1992
+
1993
+ class MOUSEINPUT < FFI::Struct
1994
+ extend Util::ScopedStruct
1995
+
1996
+ layout \
1997
+ :dx, :long,
1998
+ :dy, :long,
1999
+ :mouseData, :ulong,
2000
+ :dwFlags, :ulong,
2001
+ :time, :ulong,
2002
+ :dwExtraInfo, :ulong
2003
+ end
2004
+
2005
+ #{ KEYEVENTF_xxx
2006
+ KEYEVENTF_SCANCODE = 0x0008
2007
+ KEYEVENTF_EXTENDEDKEY = 0x0001
2008
+ KEYEVENTF_KEYUP = 0x0002
2009
+ KEYEVENTF_UNICODE = 0x0004
2010
+ #}
2011
+
2012
+ class KEYBDINPUT < FFI::Struct
2013
+ extend Util::ScopedStruct
2014
+
2015
+ layout \
2016
+ :wVk, :ushort,
2017
+ :wScan, :ushort,
2018
+ :dwFlags, :ulong,
2019
+ :time, :ulong,
2020
+ :dwExtraInfo, :ulong
2021
+ end
2022
+
2023
+ class HARDWAREINPUT < FFI::Struct
2024
+ extend Util::ScopedStruct
2025
+
2026
+ layout \
2027
+ :uMsg, :ulong,
2028
+ :wParamL, :ushort,
2029
+ :wParamH, :ushort
2030
+ end
2031
+
2032
+ class INPUT < FFI::Struct
2033
+ extend Util::ScopedStruct
2034
+
2035
+ layout \
2036
+ :type, :ulong,
2037
+
2038
+ :_, Class.new(FFI::Union) {
2039
+ layout \
2040
+ :mi, MOUSEINPUT,
2041
+ :ki, KEYBDINPUT,
2042
+ :hi, HARDWAREINPUT
2043
+ }
2044
+ end
2045
+
2046
+ attach_function :SendInput, [
2047
+ :uint,
2048
+ :pointer,
2049
+ :int
2050
+ ], :uint
2051
+
1316
2052
  attach_function :GetSystemMenu, [
1317
2053
  :pointer,
1318
2054
  :int
@@ -1371,6 +2107,8 @@ module WinGUI
1371
2107
  WM_DESTROY = 0x0002
1372
2108
  WM_NCDESTROY = 0x0082
1373
2109
 
2110
+ WM_QUIT = 0x0012
2111
+
1374
2112
  #{ ENDSESSION_xxx
1375
2113
  ENDSESSION_CLOSEAPP = 0x00000001
1376
2114
  ENDSESSION_CRITICAL = 0x40000000
@@ -1380,8 +2118,6 @@ module WinGUI
1380
2118
  WM_QUERYENDSESSION = 0x0011
1381
2119
  WM_ENDSESSION = 0x0016
1382
2120
 
1383
- WM_QUIT = 0x0012
1384
-
1385
2121
  class STYLESTRUCT < FFI::Struct
1386
2122
  extend Util::ScopedStruct
1387
2123
 
@@ -1470,6 +2206,31 @@ module WinGUI
1470
2206
 
1471
2207
  WM_SIZE = 0x0005
1472
2208
 
2209
+ #{ SB_xxx
2210
+ SB_LEFT = 6
2211
+ SB_TOP = 6
2212
+ SB_RIGHT = 7
2213
+ SB_BOTTOM = 7
2214
+
2215
+ SB_PAGELEFT = 2
2216
+ SB_PAGERIGHT = 3
2217
+ SB_PAGEUP = 2
2218
+ SB_PAGEDOWN = 3
2219
+
2220
+ SB_LINELEFT = 0
2221
+ SB_LINERIGHT = 1
2222
+ SB_LINEUP = 0
2223
+ SB_LINEDOWN = 1
2224
+
2225
+ SB_THUMBPOSITION = 4
2226
+ SB_THUMBTRACK = 5
2227
+
2228
+ SB_ENDSCROLL = 8
2229
+ #}
2230
+
2231
+ WM_HSCROLL = 0x0114
2232
+ WM_VSCROLL = 0x0115
2233
+
1473
2234
  #{ ICON_xxx
1474
2235
  ICON_SMALL = 0
1475
2236
  ICON_BIG = 1
@@ -1492,6 +2253,18 @@ module WinGUI
1492
2253
 
1493
2254
  WM_PAINT = 0x000f
1494
2255
 
2256
+ #{ PRF_xxx
2257
+ PRF_CHECKVISIBLE = 0x00000001
2258
+ PRF_NONCLIENT = 0x00000002
2259
+ PRF_CLIENT = 0x00000004
2260
+ PRF_ERASEBKGND = 0x00000008
2261
+ PRF_CHILDREN = 0x00000010
2262
+ PRF_OWNED = 0x00000020
2263
+ #}
2264
+
2265
+ WM_PRINT = 0x0317
2266
+ WM_PRINTCLIENT = 0x0318
2267
+
1495
2268
  WM_CAPTURECHANGED = 0x0215
1496
2269
 
1497
2270
  #{ MK_xxx
@@ -1500,6 +2273,7 @@ module WinGUI
1500
2273
  MK_MBUTTON = 0x0010
1501
2274
  MK_XBUTTON1 = 0x0020
1502
2275
  MK_XBUTTON2 = 0x0040
2276
+
1503
2277
  MK_CONTROL = 0x0008
1504
2278
  MK_SHIFT = 0x0004
1505
2279
  #}
@@ -1530,12 +2304,24 @@ module WinGUI
1530
2304
  #}
1531
2305
 
1532
2306
  WM_MOUSEWHEEL = 0x020a
1533
- if WINVER >= WINVISTA
2307
+ if WINVER >= WINVISTA # WM_MOUSEHWHEEL
1534
2308
  WM_MOUSEHWHEEL = 0x020e
1535
2309
  end
1536
2310
 
1537
2311
  WM_MOUSEMOVE = 0x0200
1538
2312
 
2313
+ WM_SYSKEYDOWN = 0x0104
2314
+ WM_SYSKEYUP = 0x0105
2315
+
2316
+ WM_SYSCHAR = 0x0106
2317
+ WM_SYSDEADCHAR = 0x0107
2318
+
2319
+ WM_KEYDOWN = 0x0100
2320
+ WM_KEYUP = 0x0101
2321
+
2322
+ WM_CHAR = 0x0102
2323
+ WM_DEADCHAR = 0x0103
2324
+
1539
2325
  WM_CONTEXTMENU = 0x007b
1540
2326
 
1541
2327
  WM_INITMENU = 0x0116
@@ -1579,8 +2365,6 @@ module WinGUI
1579
2365
  private :[]=, :store
1580
2366
 
1581
2367
  def [](key)
1582
- return key if key.is_a?(Integer)
1583
-
1584
2368
  (id = fetch(key, nil)) ?
1585
2369
  id :
1586
2370
  self[key] = (@last -= 1) << 4
@@ -1596,8 +2380,6 @@ module WinGUI
1596
2380
  private :[]=, :store
1597
2381
 
1598
2382
  def [](key)
1599
- return key if key.is_a?(Integer)
1600
-
1601
2383
  (id = fetch(key, nil)) ?
1602
2384
  id :
1603
2385
  self[key] = @last += 1
@@ -1617,6 +2399,12 @@ module WinGUI
1617
2399
 
1618
2400
  WM_NOTIFY = 0x004e
1619
2401
 
2402
+ WM_CTLCOLORBTN = 0x0135
2403
+ WM_CTLCOLORSTATIC = 0x0138
2404
+ WM_CTLCOLOREDIT = 0x0133
2405
+ WM_CTLCOLORLISTBOX = 0x0134
2406
+ WM_CTLCOLORSCROLLBAR = 0x0137
2407
+
1620
2408
  attach_function :RegisterWindowMessage, :RegisterWindowMessageW, [
1621
2409
  :buffer_in
1622
2410
  ], :uint
@@ -1736,6 +2524,13 @@ module WinGUI
1736
2524
  MFS_GRAYED = 0x00000003
1737
2525
  #}
1738
2526
 
2527
+ attach_function :AppendMenu, :AppendMenuW, [
2528
+ :pointer,
2529
+ :uint,
2530
+ :uint,
2531
+ :buffer_in
2532
+ ], :int
2533
+
1739
2534
  attach_function :InsertMenu, :InsertMenuW, [
1740
2535
  :pointer,
1741
2536
  :uint,
@@ -1744,6 +2539,14 @@ module WinGUI
1744
2539
  :buffer_in
1745
2540
  ], :int
1746
2541
 
2542
+ attach_function :ModifyMenu, :ModifyMenuW, [
2543
+ :pointer,
2544
+ :uint,
2545
+ :uint,
2546
+ :uint,
2547
+ :buffer_in
2548
+ ], :int
2549
+
1747
2550
  attach_function :GetMenuItemID, [
1748
2551
  :pointer,
1749
2552
  :int
@@ -1908,6 +2711,91 @@ module WinGUI
1908
2711
  FALT = 0x10
1909
2712
  #}
1910
2713
 
2714
+ #{ VK_xxx
2715
+ VK_LBUTTON = 0x01
2716
+ VK_RBUTTON = 0x02
2717
+ VK_MBUTTON = 0x04
2718
+ VK_XBUTTON1 = 0x05
2719
+ VK_XBUTTON2 = 0x06
2720
+
2721
+ VK_CONTROL = 0x11
2722
+ VK_SHIFT = 0x10
2723
+ VK_MENU = 0x12
2724
+
2725
+ VK_LCONTROL = 0xa2
2726
+ VK_RCONTROL = 0xa3
2727
+ VK_LSHIFT = 0xa0
2728
+ VK_RSHIFT = 0xa1
2729
+ VK_LMENU = 0xa4
2730
+ VK_RMENU = 0xa5
2731
+ VK_LWIN = 0x5b
2732
+ VK_RWIN = 0x5c
2733
+
2734
+ VK_F1 = 0x70
2735
+ VK_F2 = 0x71
2736
+ VK_F3 = 0x72
2737
+ VK_F4 = 0x73
2738
+ VK_F5 = 0x74
2739
+ VK_F6 = 0x75
2740
+ VK_F7 = 0x76
2741
+ VK_F8 = 0x77
2742
+ VK_F9 = 0x78
2743
+ VK_F10 = 0x79
2744
+ VK_F11 = 0x7a
2745
+ VK_F12 = 0x7b
2746
+
2747
+ VK_SNAPSHOT = 0x2c
2748
+ VK_PAUSE = 0x13
2749
+ VK_CANCEL = 0x03
2750
+
2751
+ VK_CAPITAL = 0x14
2752
+ VK_NUMLOCK = 0x90
2753
+ VK_SCROLL = 0x91
2754
+
2755
+ VK_ESCAPE = 0x1b
2756
+ VK_RETURN = 0x0d
2757
+ VK_TAB = 0x09
2758
+ VK_SPACE = 0x20
2759
+
2760
+ VK_INSERT = 0x2d
2761
+ VK_DELETE = 0x2e
2762
+ VK_BACK = 0x08
2763
+
2764
+ VK_HOME = 0x24
2765
+ VK_END = 0x23
2766
+ VK_PRIOR = 0x21
2767
+ VK_NEXT = 0x22
2768
+ VK_LEFT = 0x25
2769
+ VK_RIGHT = 0x27
2770
+ VK_UP = 0x26
2771
+ VK_DOWN = 0x28
2772
+
2773
+ VK_NUMPAD0 = 0x60
2774
+ VK_NUMPAD1 = 0x61
2775
+ VK_NUMPAD2 = 0x62
2776
+ VK_NUMPAD3 = 0x63
2777
+ VK_NUMPAD4 = 0x64
2778
+ VK_NUMPAD5 = 0x65
2779
+ VK_NUMPAD6 = 0x66
2780
+ VK_NUMPAD7 = 0x67
2781
+ VK_NUMPAD8 = 0x68
2782
+ VK_NUMPAD9 = 0x69
2783
+ VK_DECIMAL = 0x6e
2784
+ VK_ADD = 0x6b
2785
+ VK_SUBTRACT = 0x6d
2786
+ VK_MULTIPLY = 0x6a
2787
+ VK_DIVIDE = 0x6f
2788
+
2789
+ VK_MEDIA_PLAY_PAUSE = 0xb3
2790
+ VK_MEDIA_STOP = 0xb2
2791
+ VK_MEDIA_NEXT_TRACK = 0xb0
2792
+ VK_MEDIA_PREV_TRACK = 0xb1
2793
+
2794
+ VK_VOLUME_MUTE = 0xad
2795
+ VK_VOLUME_UP = 0xaf
2796
+ VK_VOLUME_DOWN = 0xae
2797
+ #}
2798
+
1911
2799
  class ACCEL < FFI::Struct
1912
2800
  extend Util::ScopedStruct
1913
2801
 
@@ -1925,5 +2813,584 @@ module WinGUI
1925
2813
  attach_function :DestroyAcceleratorTable, [
1926
2814
  :pointer
1927
2815
  ], :int
2816
+
2817
+ attach_function :CopyAcceleratorTable, :CopyAcceleratorTableW, [
2818
+ :pointer,
2819
+ :pointer,
2820
+ :int
2821
+ ], :int
2822
+
2823
+ #{ BS_xxx
2824
+ BS_PUSHBUTTON = 0x00000000
2825
+ BS_DEFPUSHBUTTON = 0x00000001
2826
+
2827
+ BS_CHECKBOX = 0x00000002
2828
+ BS_AUTOCHECKBOX = 0x00000003
2829
+
2830
+ BS_3STATE = 0x00000005
2831
+ BS_AUTO3STATE = 0x00000006
2832
+
2833
+ BS_RADIOBUTTON = 0x00000004
2834
+ BS_AUTORADIOBUTTON = 0x00000009
2835
+
2836
+ BS_GROUPBOX = 0x00000007
2837
+
2838
+ BS_TEXT = 0x00000000
2839
+ BS_BITMAP = 0x00000080
2840
+ BS_ICON = 0x00000040
2841
+ BS_OWNERDRAW = 0x0000000b
2842
+
2843
+ BS_LEFT = 0x00000100
2844
+ BS_CENTER = 0x00000300
2845
+ BS_RIGHT = 0x00000200
2846
+
2847
+ BS_TOP = 0x00000400
2848
+ BS_VCENTER = 0x00000c00
2849
+ BS_BOTTOM = 0x00000800
2850
+
2851
+ BS_MULTILINE = 0x00002000
2852
+
2853
+ BS_LEFTTEXT = 0x00000020
2854
+
2855
+ BS_FLAT = 0x00008000
2856
+ BS_PUSHLIKE = 0x00001000
2857
+
2858
+ BS_NOTIFY = 0x00004000
2859
+ #}
2860
+
2861
+ #{ BM_xxx
2862
+ BM_SETSTYLE = 0x00f4
2863
+
2864
+ BM_SETIMAGE = 0x00f7
2865
+ BM_GETIMAGE = 0x00f6
2866
+
2867
+ #{ BST_xxx
2868
+ BST_FOCUS = 0x0008
2869
+ BST_PUSHED = 0x0004
2870
+ BST_UNCHECKED = 0x0000
2871
+ BST_CHECKED = 0x0001
2872
+ BST_INDETERMINATE = 0x0002
2873
+ #}
2874
+
2875
+ BM_SETSTATE = 0x00f3
2876
+ BM_GETSTATE = 0x00f2
2877
+
2878
+ BM_SETCHECK = 0x00f1
2879
+ BM_GETCHECK = 0x00f0
2880
+
2881
+ BM_CLICK = 0x00f5
2882
+ if WINVER >= WINVISTA
2883
+ BM_SETDONTCLICK = 0x00f8
2884
+ end
2885
+ #}
2886
+
2887
+ #{ BN_xxx
2888
+ BN_SETFOCUS = 6
2889
+ BN_KILLFOCUS = 7
2890
+
2891
+ BN_CLICKED = 0
2892
+ BN_DBLCLK = 5
2893
+ #}
2894
+
2895
+ #{ SS_xxx
2896
+ SS_NOPREFIX = 0x00000080
2897
+ SS_ENDELLIPSIS = 0x00004000
2898
+ SS_WORDELLIPSIS = 0x0000c000
2899
+ SS_PATHELLIPSIS = 0x00008000
2900
+ SS_EDITCONTROL = 0x00002000
2901
+
2902
+ SS_SIMPLE = 0x0000000b
2903
+ SS_BITMAP = 0x0000000e
2904
+ SS_ICON = 0x00000003
2905
+ SS_OWNERDRAW = 0x0000000d
2906
+
2907
+ SS_LEFT = 0x00000000
2908
+ SS_LEFTNOWORDWRAP = 0x0000000c
2909
+ SS_CENTER = 0x00000001
2910
+ SS_CENTERIMAGE = 0x00000200
2911
+ SS_RIGHT = 0x00000002
2912
+ SS_RIGHTJUST = 0x00000400
2913
+
2914
+ SS_SUNKEN = 0x00001000
2915
+
2916
+ SS_ETCHEDHORZ = 0x00000010
2917
+ SS_ETCHEDVERT = 0x00000011
2918
+ SS_ETCHEDFRAME = 0x00000012
2919
+
2920
+ SS_BLACKFRAME = 0x00000007
2921
+ SS_GRAYFRAME = 0x00000008
2922
+ SS_WHITEFRAME = 0x00000009
2923
+
2924
+ SS_BLACKRECT = 0x00000004
2925
+ SS_GRAYRECT = 0x00000005
2926
+ SS_WHITERECT = 0x00000006
2927
+
2928
+ if WINVER >= WINXP
2929
+ SS_REALSIZECONTROL = 0x00000040
2930
+ end
2931
+ SS_REALSIZEIMAGE = 0x00000800
2932
+
2933
+ SS_NOTIFY = 0x00000100
2934
+ #}
2935
+
2936
+ #{ STM_xxx
2937
+ STM_SETIMAGE = 0x0172
2938
+ STM_GETIMAGE = 0x0173
2939
+
2940
+ STM_SETICON = 0x0170
2941
+ STM_GETICON = 0x0171
2942
+ #}
2943
+
2944
+ #{ STN_xxx
2945
+ STN_ENABLE = 2
2946
+ STN_DISABLE = 3
2947
+
2948
+ STN_CLICKED = 0
2949
+ STN_DBLCLK = 1
2950
+ #}
2951
+
2952
+ #{ ES_xxx
2953
+ ES_NUMBER = 0x2000
2954
+ ES_LOWERCASE = 0x0010
2955
+ ES_UPPERCASE = 0x0008
2956
+ ES_PASSWORD = 0x0020
2957
+ ES_MULTILINE = 0x0004
2958
+ ES_WANTRETURN = 0x1000
2959
+
2960
+ ES_LEFT = 0x0000
2961
+ ES_CENTER = 0x0001
2962
+ ES_RIGHT = 0x0002
2963
+
2964
+ ES_AUTOHSCROLL = 0x0080
2965
+ ES_AUTOVSCROLL = 0x0040
2966
+ ES_NOHIDESEL = 0x0100
2967
+ ES_READONLY = 0x0800
2968
+ #}
2969
+
2970
+ #{ EM_xxx
2971
+ EM_SETLIMITTEXT = 0x00c5
2972
+ EM_GETLIMITTEXT = 0x00d5
2973
+
2974
+ EM_SETPASSWORDCHAR = 0x00cc
2975
+ EM_GETPASSWORDCHAR = 0x00d2
2976
+
2977
+ EM_SETTABSTOPS = 0x00cb
2978
+ EM_FMTLINES = 0x00c8
2979
+
2980
+ EM_SETSEL = 0x00b1
2981
+ EM_GETSEL = 0x00b0
2982
+
2983
+ EM_REPLACESEL = 0x00c2
2984
+
2985
+ EM_SETRECT = 0x00b3
2986
+ EM_SETRECTNP = 0x00b4
2987
+ EM_GETRECT = 0x00b2
2988
+
2989
+ #{ EC_xxx
2990
+ EC_LEFTMARGIN = 0x0001
2991
+ EC_RIGHTMARGIN = 0x0002
2992
+ EC_USEFONTINFO = 0xffff
2993
+ #}
2994
+
2995
+ EM_SETMARGINS = 0x00d3
2996
+ EM_GETMARGINS = 0x00d4
2997
+
2998
+ EM_SETHANDLE = 0x00bc
2999
+ EM_GETHANDLE = 0x00bd
3000
+
3001
+ #{ WB_xxx
3002
+ WB_LEFT = 0
3003
+ WB_RIGHT = 1
3004
+ WB_ISDELIMITER = 2
3005
+ #}
3006
+
3007
+ callback :EDITWORDBREAKPROC, [
3008
+ :buffer_in,
3009
+ :int,
3010
+ :int,
3011
+ :int
3012
+ ], :int
3013
+
3014
+ EM_SETWORDBREAKPROC = 0x00d0
3015
+ EM_GETWORDBREAKPROC = 0x00d1
3016
+
3017
+ EM_SETMODIFY = 0x00b9
3018
+ EM_GETMODIFY = 0x00b8
3019
+
3020
+ EM_CANUNDO = 0x00c6
3021
+ EM_UNDO = 0x00c7
3022
+ EM_EMPTYUNDOBUFFER = 0x00cd
3023
+
3024
+ EM_SCROLL = 0x00b5
3025
+ EM_LINESCROLL = 0x00b6
3026
+ EM_SCROLLCARET = 0x00b7
3027
+ EM_GETTHUMB = 0x00be
3028
+
3029
+ EM_GETLINECOUNT = 0x00ba
3030
+ EM_LINELENGTH = 0x00c1
3031
+ EM_GETLINE = 0x00c4
3032
+ EM_GETFIRSTVISIBLELINE = 0x00ce
3033
+ EM_LINEINDEX = 0x00bb
3034
+ EM_LINEFROMCHAR = 0x00c9
3035
+
3036
+ EM_POSFROMCHAR = 0x00d6
3037
+ EM_CHARFROMPOS = 0x00d7
3038
+
3039
+ EM_SETREADONLY = 0x00cf
3040
+ #}
3041
+
3042
+ #{ EN_xxx
3043
+ EN_ERRSPACE = 0x0500
3044
+ EN_MAXTEXT = 0x0501
3045
+
3046
+ EN_SETFOCUS = 0x0100
3047
+ EN_KILLFOCUS = 0x0200
3048
+
3049
+ EN_UPDATE = 0x0400
3050
+ EN_CHANGE = 0x0300
3051
+
3052
+ EN_HSCROLL = 0x0601
3053
+ EN_VSCROLL = 0x0602
3054
+ #}
3055
+
3056
+ #{ LBS_xxx
3057
+ LBS_USETABSTOPS = 0x0080
3058
+ LBS_MULTICOLUMN = 0x0200
3059
+ LBS_MULTIPLESEL = 0x0008
3060
+ LBS_EXTENDEDSEL = 0x0800
3061
+ LBS_WANTKEYBOARDINPUT = 0x0400
3062
+ LBS_COMBOBOX = 0x8000
3063
+
3064
+ LBS_HASSTRINGS = 0x0040
3065
+ LBS_OWNERDRAWFIXED = 0x0010
3066
+ LBS_OWNERDRAWVARIABLE = 0x0020
3067
+
3068
+ LBS_SORT = 0x0002
3069
+
3070
+ LBS_DISABLENOSCROLL = 0x1000
3071
+ LBS_NOINTEGRALHEIGHT = 0x0100
3072
+ LBS_NODATA = 0x2000
3073
+ LBS_NOSEL = 0x4000
3074
+ LBS_NOREDRAW = 0x0004
3075
+
3076
+ LBS_NOTIFY = 0x0001
3077
+
3078
+ LBS_STANDARD = WS_BORDER | WS_VSCROLL | LBS_SORT | LBS_NOTIFY
3079
+ #}
3080
+
3081
+ attach_function :GetListBoxInfo, [
3082
+ :pointer
3083
+ ], :ulong
3084
+
3085
+ #{ DDL_xxx
3086
+ DDL_DRIVES = 0x4000
3087
+ DDL_DIRECTORY = 0x0010
3088
+ DDL_EXCLUSIVE = 0x8000
3089
+
3090
+ DDL_READWRITE = 0x0000
3091
+ DDL_READONLY = 0x0001
3092
+ DDL_HIDDEN = 0x0002
3093
+ DDL_SYSTEM = 0x0004
3094
+ DDL_ARCHIVE = 0x0020
3095
+
3096
+ DDL_POSTMSGS = 0x2000
3097
+ #}
3098
+
3099
+ attach_function :DlgDirList, :DlgDirListW, [
3100
+ :pointer,
3101
+ :buffer_inout,
3102
+ :int,
3103
+ :int,
3104
+ :uint
3105
+ ], :int
3106
+
3107
+ attach_function :DlgDirSelectEx, :DlgDirSelectExW, [
3108
+ :pointer,
3109
+ :buffer_out,
3110
+ :int,
3111
+ :int
3112
+ ], :int
3113
+
3114
+ #{ LB_xxx
3115
+ LB_OKAY = 0
3116
+ LB_ERR = -1
3117
+ LB_ERRSPACE = -2
3118
+
3119
+ LB_INITSTORAGE = 0x01a8
3120
+
3121
+ LB_SETCOUNT = 0x01a7
3122
+ LB_GETCOUNT = 0x018b
3123
+
3124
+ LB_ADDSTRING = 0x0180
3125
+ LB_INSERTSTRING = 0x0181
3126
+ LB_DIR = 0x018d
3127
+ LB_ADDFILE = 0x0196
3128
+
3129
+ LB_DELETESTRING = 0x0182
3130
+ LB_RESETCONTENT = 0x0184
3131
+
3132
+ LB_SETCURSEL = 0x0186
3133
+ LB_GETCURSEL = 0x0188
3134
+
3135
+ LB_SELECTSTRING = 0x018c
3136
+
3137
+ LB_FINDSTRING = 0x018f
3138
+ LB_FINDSTRINGEXACT = 0x01a2
3139
+
3140
+ LB_GETTEXTLEN = 0x018a
3141
+ LB_GETTEXT = 0x0189
3142
+
3143
+ LB_SETITEMDATA = 0x019a
3144
+ LB_GETITEMDATA = 0x0199
3145
+
3146
+ LB_SETSEL = 0x0185
3147
+ LB_GETSEL = 0x0187
3148
+
3149
+ LB_GETSELCOUNT = 0x0190
3150
+ LB_GETSELITEMS = 0x0191
3151
+
3152
+ LB_SELITEMRANGEEX = 0x0183
3153
+
3154
+ LB_SETLOCALE = 0x01a5
3155
+ LB_GETLOCALE = 0x01a6
3156
+
3157
+ LB_SETTABSTOPS = 0x0192
3158
+ LB_SETCOLUMNWIDTH = 0x0195
3159
+ if WINVER >= WINXP
3160
+ LB_GETLISTBOXINFO = 0x01b2
3161
+ end
3162
+
3163
+ LB_SETHORIZONTALEXTENT = 0x0194
3164
+ LB_GETHORIZONTALEXTENT = 0x0193
3165
+
3166
+ LB_SETTOPINDEX = 0x0197
3167
+ LB_GETTOPINDEX = 0x018e
3168
+
3169
+ LB_SETANCHORINDEX = 0x019c
3170
+ LB_GETANCHORINDEX = 0x019d
3171
+
3172
+ LB_SETCARETINDEX = 0x019e
3173
+ LB_GETCARETINDEX = 0x019f
3174
+
3175
+ LB_SETITEMHEIGHT = 0x01a0
3176
+ LB_GETITEMHEIGHT = 0x01a1
3177
+
3178
+ LB_GETITEMRECT = 0x0198
3179
+ LB_ITEMFROMPOINT = 0x01a9
3180
+ #}
3181
+
3182
+ #{ LBN_xxx
3183
+ LBN_ERRSPACE = -2
3184
+
3185
+ LBN_SETFOCUS = 4
3186
+ LBN_KILLFOCUS = 5
3187
+
3188
+ LBN_SELCHANGE = 1
3189
+ LBN_SELCANCEL = 3
3190
+
3191
+ LBN_DBLCLK = 2
3192
+ #}
3193
+
3194
+ #{ CBS_xxx
3195
+ CBS_SIMPLE = 0x0001
3196
+ CBS_DROPDOWN = 0x0002
3197
+ CBS_DROPDOWNLIST = 0x0003
3198
+ CBS_LOWERCASE = 0x4000
3199
+ CBS_UPPERCASE = 0x2000
3200
+
3201
+ CBS_HASSTRINGS = 0x0200
3202
+ CBS_OWNERDRAWFIXED = 0x0010
3203
+ CBS_OWNERDRAWVARIABLE = 0x0020
3204
+
3205
+ CBS_SORT = 0x0100
3206
+
3207
+ CBS_AUTOHSCROLL = 0x0040
3208
+ CBS_DISABLENOSCROLL = 0x0800
3209
+ CBS_NOINTEGRALHEIGHT = 0x0400
3210
+ #}
3211
+
3212
+ class COMBOBOXINFO < FFI::Struct
3213
+ extend Util::ScopedStruct
3214
+
3215
+ layout \
3216
+ :cbSize, :ulong,
3217
+ :rcItem, RECT,
3218
+ :rcButton, RECT,
3219
+ :stateButton, :ulong,
3220
+ :hwndCombo, :pointer,
3221
+ :hwndItem, :pointer,
3222
+ :hwndList, :pointer
3223
+ end
3224
+
3225
+ attach_function :GetComboBoxInfo, [
3226
+ :pointer,
3227
+ COMBOBOXINFO.by_ref
3228
+ ], :int
3229
+
3230
+ attach_function :DlgDirListComboBox, :DlgDirListComboBoxW, [
3231
+ :pointer,
3232
+ :buffer_inout,
3233
+ :int,
3234
+ :int,
3235
+ :uint
3236
+ ], :int
3237
+
3238
+ attach_function :DlgDirSelectComboBoxEx, :DlgDirSelectComboBoxExW, [
3239
+ :pointer,
3240
+ :buffer_out,
3241
+ :int,
3242
+ :int
3243
+ ], :int
3244
+
3245
+ #{ CB_xxx
3246
+ CB_OKAY = 0
3247
+ CB_ERR = -1
3248
+ CB_ERRSPACE = -2
3249
+
3250
+ CB_LIMITTEXT = 0x0141
3251
+
3252
+ CB_INITSTORAGE = 0x0161
3253
+
3254
+ CB_GETCOUNT = 0x0146
3255
+
3256
+ CB_ADDSTRING = 0x0143
3257
+ CB_INSERTSTRING = 0x014a
3258
+ CB_DIR = 0x0145
3259
+
3260
+ CB_DELETESTRING = 0x0144
3261
+ CB_RESETCONTENT = 0x014b
3262
+
3263
+ CB_SETCURSEL = 0x014e
3264
+ CB_GETCURSEL = 0x0147
3265
+
3266
+ CB_SELECTSTRING = 0x014d
3267
+
3268
+ CB_FINDSTRING = 0x014c
3269
+ CB_FINDSTRINGEXACT = 0x0158
3270
+
3271
+ CB_GETLBTEXTLEN = 0x0149
3272
+ CB_GETLBTEXT = 0x0148
3273
+
3274
+ CB_SETITEMDATA = 0x0151
3275
+ CB_GETITEMDATA = 0x0150
3276
+
3277
+ CB_SETEDITSEL = 0x0142
3278
+ CB_GETEDITSEL = 0x0140
3279
+
3280
+ CB_SETLOCALE = 0x0159
3281
+ CB_GETLOCALE = 0x015a
3282
+
3283
+ if WINVER >= WINXP
3284
+ CB_GETCOMBOBOXINFO = 0x0164
3285
+ end
3286
+
3287
+ CB_SETHORIZONTALEXTENT = 0x015e
3288
+ CB_GETHORIZONTALEXTENT = 0x015d
3289
+
3290
+ CB_SETTOPINDEX = 0x015c
3291
+ CB_GETTOPINDEX = 0x015b
3292
+
3293
+ CB_SETITEMHEIGHT = 0x0153
3294
+ CB_GETITEMHEIGHT = 0x0154
3295
+
3296
+ CB_SETDROPPEDWIDTH = 0x0160
3297
+ CB_GETDROPPEDWIDTH = 0x015f
3298
+
3299
+ CB_GETDROPPEDSTATE = 0x0157
3300
+ CB_GETDROPPEDCONTROLRECT = 0x0152
3301
+
3302
+ CB_SHOWDROPDOWN = 0x014f
3303
+
3304
+ CB_SETEXTENDEDUI = 0x0155
3305
+ CB_GETEXTENDEDUI = 0x0156
3306
+ #}
3307
+
3308
+ #{ CBN_xxx
3309
+ CBN_ERRSPACE = -1
3310
+
3311
+ CBN_SETFOCUS = 3
3312
+ CBN_KILLFOCUS = 4
3313
+
3314
+ CBN_EDITUPDATE = 6
3315
+ CBN_EDITCHANGE = 5
3316
+
3317
+ CBN_SELCHANGE = 1
3318
+ CBN_SELENDOK = 9
3319
+ CBN_SELENDCANCEL = 10
3320
+
3321
+ CBN_DBLCLK = 2
3322
+
3323
+ CBN_DROPDOWN = 7
3324
+ CBN_CLOSEUP = 8
3325
+ #}
3326
+
3327
+ #{ SBS_xxx
3328
+ SBS_HORZ = 0x0000
3329
+ SBS_VERT = 0x0001
3330
+
3331
+ SBS_TOPALIGN = 0x0002
3332
+ SBS_BOTTOMALIGN = 0x0004
3333
+ SBS_LEFTALIGN = 0x0002
3334
+ SBS_RIGHTALIGN = 0x0004
3335
+
3336
+ SBS_SIZEBOX = 0x0008
3337
+ SBS_SIZEGRIP = 0x0010
3338
+
3339
+ SBS_SIZEBOXTOPLEFTALIGN = 0x0002
3340
+ SBS_SIZEBOXBOTTOMRIGHTALIGN = 0x0004
3341
+ #}
3342
+
3343
+ #{ OBJID_xxx
3344
+ OBJID_HSCROLL = 0xffff_fffa - 0x1_0000_0000
3345
+ OBJID_VSCROLL = 0xffff_fffb - 0x1_0000_0000
3346
+ OBJID_CLIENT = 0xffff_fffc - 0x1_0000_0000
3347
+ #}
3348
+
3349
+ class SCROLLBARINFO < FFI::Struct
3350
+ extend Util::ScopedStruct
3351
+
3352
+ layout \
3353
+ :cbSize, :ulong,
3354
+ :rcScrollBar, RECT,
3355
+ :dxyLineButton, :int,
3356
+ :xyThumbTop, :int,
3357
+ :xyThumbBottom, :int,
3358
+ :reserved, :int,
3359
+
3360
+ # 0 - scroll bar itself
3361
+ # 1 - top/right arrow button
3362
+ # 2 - page up/page right region
3363
+ # 3 - scroll box
3364
+ # 4 - page down/page left region
3365
+ # 5 - bottom/left arrow button
3366
+ :rgstate, [:ulong, 6]
3367
+ end
3368
+
3369
+ attach_function :GetScrollBarInfo, [
3370
+ :pointer,
3371
+ :long,
3372
+ SCROLLBARINFO.by_ref
3373
+ ], :int
3374
+
3375
+ #{ SBM_xxx
3376
+ SBM_ENABLE_ARROWS = 0x00e4
3377
+
3378
+ SBM_SETRANGE = 0x00e2
3379
+ SBM_SETRANGEREDRAW = 0x00e6
3380
+ SBM_GETRANGE = 0x00e3
3381
+
3382
+ SBM_SETPOS = 0x00e0
3383
+ SBM_GETPOS = 0x00e1
3384
+
3385
+ SBM_SETSCROLLINFO = 0x00e9
3386
+ SBM_GETSCROLLINFO = 0x00ea
3387
+
3388
+ if WINVER >= WINXP
3389
+ SBM_GETSCROLLBARINFO = 0x00eb
3390
+ end
3391
+ #}
1928
3392
  #}
1929
3393
  end
3394
+
3395
+ #tend = Time.now
3396
+ #p "ffi: #{tffi - tstart}, rest: #{tend - tffi}, total: #{tend - tstart}"