home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Power Pack / Visual_Basic4_Power_Pack.bin / vb4files / 3dfxplus / 3dfxplus.bas < prev    next >
Encoding:
BASIC Source File  |  1996-11-20  |  11.0 KB  |  265 lines

  1. '3DfxPlus.DLL should be in your Windows\System directory or in the Path
  2.  
  3.  
  4. 'Primary Function
  5. Declare Sub Window3Dfx Lib "3DfxPlus.DLL" (ByVal hWnd%)
  6.  
  7.  
  8. 'Assorted 3DfxPlus Functions
  9. Declare Function Get3DfxPlusVersion% Lib "3DfxPlus.DLL" ()
  10. Declare Sub JustifyLine Lib "3DfxPlus.DLL" (ByVal hDC%, ByVal StartXpixel%, ByVal StartYpixel%, ByVal TheWidthPixels%, ByVal lpString$)
  11. Declare Sub ScreenCenterWindow Lib "3DfxPlus.DLL" (ByVal hWnd%)
  12. Declare Sub SuperTextOut Lib "3DfxPlus.DLL" (ByVal hDC%, ByVal XstartPixel%, ByVal YstartPixel%, ByVal TheString$, ByVal FontName$, ByVal TheStyle$, ByVal The3DStyle$, ByVal AlignmentType$, ByVal PointSize%, ByVal TheColor&, ByVal RotationAngle%)
  13.     'TheStyle$=bold, italic, BoldItalic, or plain
  14.     'The3Dstyle$=raised, sunken, or plain
  15.     'AlignmentType$=left, right, or center
  16.     'RototationAngle= 0- 359
  17.  
  18.  
  19. '3DfxPlus API Functions
  20. Declare Sub AbortIfWin4Used Lib "3DfxPlus.DLL" (ByVal TrueFalse%)
  21.     'True,False
  22. Declare Sub SetBackDropStyle Lib "3DfxPlus.DLL" (ByVal TheStyle$)
  23.     'none,solid,SlickFillLight,SlickFillDark,DiamondsLight,DiamondsDark,HorzLinesLight,HorzLinesDark
  24.         
  25.         'Frame functions
  26. Declare Sub SetFrameBorderStyle Lib "3DfxPlus.DLL" (ByVal lpString$)
  27.     'raised,sunken,RaisedDouble,SunkenDouble,plain,none
  28. Declare Sub SetFrameCaptionAlignment Lib "3DfxPlus.DLL" (ByVal lpString$)
  29.     'left,center,right
  30. Declare Sub SetFrameCaptionStyle Lib "3DfxPlus.DLL" (ByVal lpString$)
  31.     'raised,sunken,plain
  32. Declare Sub SetFrameFontSpecs Lib "3DfxPlus.DLL" (ByVal FaceName$, ByVal FontStyle$, ByVal PointSize%, ByVal FontColor&)
  33.     'fontstyle=bold, bolditalic, italic, or plain
  34.     
  35.         'CheckBox functions
  36. Declare Sub SetCheckBoxCaptionStyle Lib "3DfxPlus.DLL" (ByVal lpString$)
  37.     'raised,sunken,plain
  38. Declare Sub SetCheckBoxFontSpecs Lib "3DfxPlus.DLL" (ByVal FaceName$, ByVal FontStyle$, ByVal PointSize%, ByVal FontColor&)
  39.     'fontstyle=bold, bolditalic, italic, or plain
  40. Declare Sub SetCheckBoxGraphicAlignment Lib "3DfxPlus.DLL" (ByVal lpString$)
  41.     'left,right
  42. Declare Sub SetCheckBoxStyle Lib "3DfxPlus.DLL" (ByVal lpString$)
  43.     'RaisedX,SunkenX,RaisedCheck,SunkenCheck
  44. Declare Sub SetCheckBoxTextAlignment Lib "3DfxPlus.DLL" (ByVal lpString$)
  45.     'left,right
  46.  
  47.         'OptionButton functions
  48. Declare Sub SetOptBtnCaptionStyle Lib "3DfxPlus.DLL" (ByVal lpString$)
  49.     'raised,sunken,plain
  50. Declare Sub SetOptBtnFontSpecs Lib "3DfxPlus.DLL" (ByVal FaceName$, ByVal FontStyle$, ByVal PointSize%, ByVal FontColor&)
  51.     'fontstyle=bold, bolditalic, italic, or plain
  52. Declare Sub SetOptBtnGraphicAlignment Lib "3DfxPlus.DLL" (ByVal lpString$)
  53.     'left,right
  54. Declare Sub SetOptBtnStyle Lib "3DfxPlus.DLL" (ByVal lpString$)
  55.     'RaisedX,SunkenX,RaisedCheck,SunkenCheck
  56. Declare Sub SetOptBtnTextAlignment Lib "3DfxPlus.DLL" (ByVal lpString$)
  57.     'left,right
  58.  
  59.     'VB Controls Border Style Functions
  60. Declare Sub SetCheckBoxBorder Lib "3DfxPlus.DLL" (ByVal lpString$)
  61.     'raised,sunken,none
  62. Declare Sub SetDirBoxBorder Lib "3DfxPlus.DLL" (ByVal lpString$)
  63.     'raised,sunken,none
  64. Declare Sub SetDriveBoxBorder Lib "3DfxPlus.DLL" (ByVal lpString$)
  65.     'raised,sunken,none
  66. Declare Sub SetFileBoxBorder Lib "3DfxPlus.DLL" (ByVal lpString$)
  67.     'raised,sunken,none
  68. Declare Sub SetFrameBorder Lib "3DfxPlus.DLL" (ByVal lpString$)
  69.     'raised,sunken,none
  70. Declare Sub SetOptBtnBorder Lib "3DfxPlus.DLL" (ByVal lpString$)
  71.     'raised,sunken,none
  72. Declare Sub SetPictureBoxBorder Lib "3DfxPlus.DLL" (ByVal lpString$)
  73.     'raised,sunken,none
  74. Declare Sub SetVBComboBoxBorder Lib "3DfxPlus.DLL" (ByVal lpString$)
  75.     'raised,sunken,none
  76. Declare Sub SetVBListBoxBorder Lib "3DfxPlus.DLL" (ByVal lpString$)
  77.     'raised,sunken,none
  78. Declare Sub SetVBHScrollBarBorder Lib "3DfxPlus.DLL" (ByVal lpString$)
  79.     'raised,sunken,none
  80. Declare Sub SetVBTextBoxBorder Lib "3DfxPlus.DLL" (ByVal lpString$)
  81.     'raised,sunken,none
  82. Declare Sub SetVBVScrollBarBorder Lib "3DfxPlus.DLL" (ByVal lpString$)
  83.     'raised,sunken,none
  84.  
  85.     'Dialog Controls Border Style Functions
  86. Declare Sub SetComboBoxBorder Lib "3DfxPlus.DLL" (ByVal lpString$)
  87.     'raised,sunken,none
  88. Declare Sub SetEditBoxBorder Lib "3DfxPlus.DLL" (ByVal lpString$)
  89.     'raised,sunken,none
  90. Declare Sub SetListBoxBorder Lib "3DfxPlus.DLL" (ByVal lpString$)
  91.     'raised,sunken,none
  92. Declare Sub SetScrollBarBorder Lib "3DfxPlus.DLL" (ByVal lpString$)
  93.     'raised,sunken,none
  94. Declare Sub SetStaticBorder Lib "3DfxPlus.DLL" (ByVal lpString$)
  95.     'raised,sunken,none
  96.  
  97.  
  98. 'Box Drawing functions
  99. Declare Sub Draw3Dbox Lib "3DfxPlus.DLL" (ByVal hWnd%, ByVal LeftStartPixel%, ByVal TopStartPixel%, ByVal WidthPixels%, ByVal HeightPixels%, ByVal Style$)
  100.     'style$=raised,sunken,RaisedDouble,SunkenDouble,or plain
  101. Declare Sub Draw3DWindowBox Lib "3DfxPlus.DLL" (ByVal hWnd%, ByVal PixelAmountInside%, ByVal Style$)
  102.     'style$=raised,sunken,RaisedDouble,SunkenDouble,or plain
  103.  
  104.  
  105. 'Assorted WIN API Functions
  106. Declare Function DestroyWindow% Lib "User" (ByVal hWnd%)
  107. Declare Function GetWindowsDirectory% Lib "Kernel" (ByVal lpBuffer$, ByVal nSize%)
  108. Declare Function OutMessage% Lib "User" Alias "SendMessage" (ByVal hWnd%, ByVal wMsg%, ByVal wParam%, lParam As Any)
  109. Declare Function SendMessage& Lib "User" (ByVal hWnd%, ByVal wMsg%, ByVal wParam%, lParam As Any)
  110. Declare Function WinHelp% Lib "User" (ByVal hWnd%, ByVal lpHelpFile$, ByVal wCommand%, ByVal dwData As Any)
  111.     Global Const HELP_CONTENTS = &H3
  112.     Global Const HELP_PARTIALKEY = &H105
  113.  
  114.  
  115. 'program constants
  116. Global Const raised = 1
  117. Global Const sunken = 2
  118.  
  119.  
  120. 'program variables
  121. Global FormPassString As String     'used to pass strings
  122. Global FormPassString2 As String
  123.  
  124. Function AddSeparator (ThePath$)
  125.     If Right$(ThePath$, 1) <> "\" Then
  126.         ThePath$ = ThePath$ + "\"
  127.         End If
  128.     AddSeparator = ThePath$
  129. End Function
  130.  
  131. Sub DoControl3D (Obj As Control, Style%, Thick%)
  132.     If Thick <= 0 Then Thick = 1
  133.     If Thick > 8 Then Thick = 8
  134.     OldMode = Obj.Parent.ScaleMode
  135.     OldWidth = Obj.Parent.DrawWidth
  136.     Obj.Parent.ScaleMode = 3
  137.     Obj.Parent.DrawWidth = 1
  138.     ObjHeight = Obj.Height
  139.     ObjWidth = Obj.Width
  140.     ObjLeft = Obj.Left
  141.     ObjTop = Obj.Top
  142.     
  143.     Select Case Style
  144.         Case sunken:
  145.             TLshade = QBColor(8)
  146.             BRshade = QBColor(15)
  147.         Case raised:
  148.             TLshade = QBColor(15)
  149.             BRshade = QBColor(8)
  150.         End Select
  151.         For i = 1 To Thick
  152.             CurLeft = ObjLeft - i
  153.             CurTop = ObjTop - i
  154.             CurWide = ObjWidth + (i * 2) - 1
  155.             CurHigh = ObjHeight + (i * 2) - 1
  156.             Obj.Parent.Line (CurLeft, CurTop)-Step(CurWide, 0), TLshade
  157.             Obj.Parent.Line -Step(0, CurHigh), BRshade
  158.             Obj.Parent.Line -Step(-CurWide, 0), BRshade
  159.             Obj.Parent.Line -Step(0, -CurHigh), TLshade
  160.             Next i
  161.         If Thick > 2 Then
  162.             CurLeft = ObjLeft - Thick - 1
  163.             CurTop = ObjTop - Thick - 1
  164.             CurWide = ObjWidth + ((Thick + 1) * 2) - 1
  165.             CurHigh = ObjHeight + ((Thick + 1) * 2) - 1
  166.             Obj.Parent.Line (CurLeft, CurTop)-Step(CurWide, 0), QBColor(0)
  167.             Obj.Parent.Line -Step(0, CurHigh), QBColor(0)
  168.             Obj.Parent.Line -Step(-CurWide, 0), QBColor(0)
  169.             Obj.Parent.Line -Step(0, -CurHigh), QBColor(0)
  170.             End If
  171.     Obj.Parent.ScaleMode = OldMode
  172.     Obj.Parent.DrawWidth = OldWidth
  173. End Sub
  174.  
  175. Sub DoForm3D (TheForm As Form, Style%, Thick%, Distance%)
  176.     If Thick <= 0 Then Thick = 1
  177.     If Thick > 8 Then Thick = 8
  178.     If Distance < 0 Then Distance = 0
  179.     If Distance > 8 Then Distance = 8
  180.     OldMode = TheForm.ScaleMode
  181.     OldWidth = TheForm.DrawWidth
  182.     TheForm.ScaleMode = 3
  183.     TheForm.DrawWidth = 1
  184.     FormHeight = TheForm.ScaleHeight
  185.     FormWidth = TheForm.ScaleWidth
  186.     FormLeft = TheForm.ScaleLeft
  187.     FormTop = TheForm.ScaleTop
  188.     
  189.     Select Case Style
  190.         Case sunken:
  191.             TLshade = QBColor(8)
  192.             BRshade = QBColor(15)
  193.         Case raised:
  194.             TLshade = QBColor(15)
  195.             BRshade = QBColor(8)
  196.         End Select
  197.     Select Case TheForm.BorderStyle
  198.         Case 0:
  199.             OLshade = QBColor(0)
  200.             TheForm.Line (0, 0)-(FormWidth, 0), OLshade
  201.             TheForm.Line (0, 0)-(0, FormHeight), OLshade
  202.             TheForm.Line (FormWidth - 1, 0)-(FormWidth - 1, FormHeight + 1), OLshade
  203.             TheForm.Line (0, FormHeight - 1)-(FormWidth, FormHeight - 1), OLshade
  204.             For i = 1 To Thick
  205.                 CurLeft = FormLeft + i + Distance
  206.                 CurTop = FormTop + i + Distance
  207.                 CurWide = FormWidth - (i + Distance) * 2 - 1
  208.                 CurHigh = FormHeight - (i + Distance) * 2 - 1
  209.                 TheForm.Line (CurLeft, CurTop)-Step(CurWide, 0), TLshade
  210.                 TheForm.Line -Step(0, CurHigh), BRshade
  211.                 TheForm.Line -Step(-CurWide, 0), BRshade
  212.                 TheForm.Line -Step(0, -CurHigh), TLshade
  213.                 Next i
  214.         Case 1 To 3:
  215.             If Thickness = 1 Then
  216.                 TheForm.Line (Thick, Thick)-(FormWidth - Thick, Thick), TLshade
  217.                 TheForm.Line (Thick, Thick)-(Thick, FormHeight - Thick), TLshade
  218.                 TheForm.Line (FormWidth - Thick, Thick)-(FormWidth - Thick, FormHeight - Thick + 1), BRshade
  219.                 TheForm.Line (Thick, FormHeight - Thick)-(FormWidth - Thick, FormHeight - Thick), BRshade
  220.                 Else
  221.             For i = 1 To Thick
  222.                 CurLeft = FormLeft + i - 1 + Distance
  223.                 CurTop = FormTop + i - 1 + Distance
  224.                 CurWide = FormWidth - (i + Distance) * 2 + 1
  225.                 CurHigh = FormHeight - (i + Distance) * 2 + 1
  226.                 TheForm.Line (CurLeft, CurTop)-Step(CurWide, 0), TLshade
  227.                 TheForm.Line -Step(0, CurHigh), BRshade
  228.                 TheForm.Line -Step(-CurWide, 0), BRshade
  229.                 TheForm.Line -Step(0, -CurHigh), TLshade
  230.                 Next i
  231.                 End If
  232.         End Select
  233.     TheForm.ScaleMode = OldMode
  234.     TheForm.DrawWidth = OldWidth
  235. End Sub
  236.  
  237. Sub FormCenterForm (TheForm As Form, MainForm As Form)
  238.     TheForm.Move MainForm.Left + (MainForm.Width - TheForm.Width) / 2, MainForm.Top + (MainForm.Height - TheForm.Height) / 2
  239. End Sub
  240.  
  241. Sub FormCenterScreen (TheForm As Form)
  242.     TheForm.Move (Screen.Width - TheForm.Width) / 2, (Screen.Height - TheForm.Height) / 2
  243. End Sub
  244.  
  245. Function GetWinDir ()
  246.      Buffer$ = Space$(255)
  247.      count% = GetWindowsDirectory(Buffer$, 255)
  248.      GetWinDir = Left$(Buffer$, count%)
  249. End Function
  250.  
  251. Sub ListHscroll (TheListBox As Control, CharsWide%)
  252.     If CharsWide% > 15000 Then CharsWide% = 15000
  253.     LongString$ = String$(CharsWide%, "W")
  254.     tppx% = Screen.TwipsPerPixelX
  255.     MaxiWide% = TheListBox.Parent.TextWidth(LongString$) / tppx%
  256.     HscrollLen& = SendMessage(TheListBox.hWnd, 1045, MaxiWide%, 0)
  257. End Sub
  258.  
  259. Sub TrimAtNull (TheWord$)
  260.     pos% = InStr(TheWord$, Chr$(0))
  261.     If pos% = 0 Then Exit Sub
  262.     TheWord$ = Left$(TheWord$, pos% - 1)
  263. End Sub
  264.  
  265.