home *** CD-ROM | disk | FTP | other *** search
/ PC World Plus! (NZ) 2001 June / HDC50.iso / Runimage / Delphi50 / Source / Rtl / Win / FLATSB.PAS < prev    next >
Pascal/Delphi Source File  |  1999-08-11  |  5KB  |  131 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       Borland Delphi Runtime Library                  }
  5. {       Win32 flat scrollbar interface unit             }
  6. {                                                       }
  7. {       Copyright (C) 1996,99 Inprise Corporation       }
  8. {                                                       }
  9. {*******************************************************}
  10.  
  11. unit FlatSB;
  12.  
  13. //{$WEAKPACKAGEUNIT}
  14.  
  15. interface
  16.  
  17. uses Windows;
  18.  
  19. function InitializeFlatSB(hWnd: HWND): Bool; stdcall;
  20. {$EXTERNALSYM InitializeFlatSB}
  21. procedure UninitializeFlatSB(hWnd: HWND); stdcall;
  22. {$EXTERNALSYM UninitializeFlatSB}
  23. function FlatSB_GetScrollProp(p1: HWND; propIndex: Integer;
  24.   p3: PInteger): Bool; stdcall;
  25. {$EXTERNALSYM FlatSB_GetScrollProp}
  26. function FlatSB_SetScrollProp(p1: HWND; index: Integer; newValue: Integer;
  27.   p4: Bool): Bool; stdcall;
  28. {$EXTERNALSYM FlatSB_SetScrollProp}
  29.  
  30. var
  31.   FlatSB_EnableScrollBar: function(hWnd: HWND; wSBflags, wArrows: UINT): BOOL; stdcall;
  32.   {$EXTERNALSYM FlatSB_EnableScrollBar}
  33.   FlatSB_ShowScrollBar: function(hWnd: HWND; wBar: Integer; bShow: BOOL): BOOL; stdcall;
  34.   {$EXTERNALSYM FlatSB_ShowScrollBar}
  35.   FlatSB_GetScrollRange: function(hWnd: HWND; nBar: Integer; var lpMinPos,
  36.     lpMaxPos: Integer): BOOL; stdcall;
  37.   {$EXTERNALSYM FlatSB_GetScrollRange}
  38.   FlatSB_GetScrollInfo: function(hWnd: HWND; BarFlag: Integer;
  39.     var ScrollInfo: TScrollInfo): BOOL; stdcall;
  40.   {$EXTERNALSYM FlatSB_GetScrollInfo}
  41.   FlatSB_GetScrollPos: function(hWnd: HWND; nBar: Integer): Integer; stdcall;
  42.   {$EXTERNALSYM FlatSB_GetScrollPos}
  43.   FlatSB_SetScrollPos: function(hWnd: HWND; nBar, nPos: Integer;
  44.     bRedraw: BOOL): Integer; stdcall;
  45.   {$EXTERNALSYM FlatSB_SetScrollPos}
  46.   FlatSB_SetScrollInfo: function(hWnd: HWND; BarFlag: Integer;
  47.     const ScrollInfo: TScrollInfo; Redraw: BOOL): Integer; stdcall;
  48.   {$EXTERNALSYM FlatSB_SetScrollInfo}
  49.   FlatSB_SetScrollRange: function(hWnd: HWND; nBar, nMinPos, nMaxPos: Integer;
  50.     bRedraw: BOOL): BOOL; stdcall;
  51.   {$EXTERNALSYM FlatSB_SetScrollRange}
  52.  
  53. implementation
  54.  
  55. var
  56.   _FlatSB_GetScrollProp: function(p1: HWND; propIndex: Integer;
  57.     p3: PInteger): Bool; stdcall;
  58.   _FlatSB_SetScrollProp: function(p1: HWND; index: Integer; newValue: Integer;
  59.     p4: Bool): Bool; stdcall;
  60.   _InitializeFlatSB: function(hWnd: HWND): Bool; stdcall;
  61.   _UninitializeFlatSB: procedure(hWnd: HWND); stdcall;
  62.  
  63. function FlatSB_GetScrollProp(p1: HWND; propIndex: Integer;
  64.   p3: PInteger): Bool; stdcall;
  65. begin
  66.   Result := Assigned(_FlatSB_GetScrollProp) and
  67.     _FlatSB_GetScrollProp(p1, propIndex, p3);
  68. end;
  69.  
  70. function FlatSB_SetScrollProp(p1: HWND; index: Integer; newValue: Integer;
  71.   p4: Bool): Bool; stdcall;
  72. begin
  73.   Result := Assigned(_FlatSB_SetScrollProp) and
  74.     _FlatSB_SetScrollProp(p1, index, newValue, p4);
  75. end;
  76.  
  77. function InitializeFlatSB(hWnd: HWND): Bool; stdcall;
  78. begin
  79.   Result := Assigned(_InitializeFlatSB) and _InitializeFlatSB(hWnd);
  80. end;
  81.  
  82. procedure UninitializeFlatSB(hWnd: HWND); stdcall;
  83. begin
  84.   if Assigned(_UninitializeFlatSB) then _UninitializeFlatSB(hWnd);
  85. end;
  86.  
  87. procedure InitFlatSB;
  88. const
  89.   cctrl = 'comctl32.dll';
  90. var
  91.   ComCtl32DLL: THandle;
  92. begin
  93.   ComCtl32DLL := GetModuleHandle(cctrl);
  94.   if ComCtl32DLL <> 0 then
  95.   begin
  96.     @_InitializeFlatSB := GetProcAddress(ComCtl32DLL, 'InitializeFlatSB');
  97.     @_UninitializeFlatSB := GetProcAddress(ComCtl32DLL, 'UninitializeFlatSB');
  98.     @_FlatSB_GetScrollProp := GetProcAddress(ComCtl32DLL, 'FlatSB_GetScrollProp');
  99.     @_FlatSB_SetScrollProp := GetProcAddress(ComCtl32DLL, 'FlatSB_SetScrollProp');
  100.     @FlatSB_EnableScrollBar := GetProcAddress(ComCtl32DLL, 'FlatSB_EnableScrollBar');
  101.     if not Assigned(FlatSB_EnableScrollBar) then
  102.       @FlatSB_EnableScrollBar := @EnableScrollBar;
  103.     @FlatSB_ShowScrollBar := GetProcAddress(ComCtl32DLL, 'FlatSB_ShowScrollBar');
  104.     if not Assigned(FlatSB_ShowScrollBar) then
  105.       @FlatSB_ShowScrollBar := @ShowScrollBar;
  106.     @FlatSB_GetScrollRange := GetProcAddress(ComCtl32DLL, 'FlatSB_GetScrollRange');
  107.     if not Assigned(FlatSB_GetScrollRange) then
  108.       @FlatSB_GetScrollRange := @GetScrollRange;
  109.     @FlatSB_GetScrollInfo := GetProcAddress(ComCtl32DLL, 'FlatSB_GetScrollInfo');
  110.     if not Assigned(FlatSB_GetScrollInfo) then
  111.       @FlatSB_GetScrollInfo := @GetScrollInfo;
  112.     @FlatSB_GetScrollPos := GetProcAddress(ComCtl32DLL, 'FlatSB_GetScrollPos');
  113.     if not Assigned(FlatSB_GetScrollPos) then
  114.       @FlatSB_GetScrollPos := @GetScrollPos;
  115.     @FlatSB_SetScrollPos := GetProcAddress(ComCtl32DLL, 'FlatSB_SetScrollPos');
  116.     if not Assigned(FlatSB_SetScrollPos) then
  117.       @FlatSB_SetScrollPos := @SetScrollPos;
  118.     @FlatSB_SetScrollInfo := GetProcAddress(ComCtl32DLL, 'FlatSB_SetScrollInfo');
  119.     if not Assigned(FlatSB_SetScrollInfo) then
  120.       @FlatSB_SetScrollInfo := @SetScrollInfo;
  121.     @FlatSB_SetScrollRange := GetProcAddress(ComCtl32DLL, 'FlatSB_SetScrollRange');
  122.     if not Assigned(FlatSB_SetScrollRange) then
  123.       @FlatSB_SetScrollRange := @SetScrollRange;
  124.   end;
  125. end;
  126.  
  127. initialization
  128.   InitFlatSB;
  129.   
  130. end.
  131.