home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l407 / 1.ddi / CALLDLLS.FR_ / CALLDLLS.bin (.txt)
Encoding:
Visual Basic Form  |  1993-04-28  |  16.6 KB  |  518 lines

  1. VERSION 2.00
  2. Begin Form frmCallDlls 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Calling DLL Procedures"
  5.    ClipControls    =   0   'False
  6.    Height          =   2310
  7.    Left            =   900
  8.    LinkTopic       =   "Form1"
  9.    MaxButton       =   0   'False
  10.    ScaleHeight     =   1905
  11.    ScaleWidth      =   5505
  12.    Top             =   1080
  13.    Width           =   5625
  14.    Begin PictureBox picSprite 
  15.       AutoRedraw      =   -1  'True
  16.       AutoSize        =   -1  'True
  17.       Height          =   510
  18.       Left            =   960
  19.       Picture         =   CALLDLLS.FRX:0000
  20.       ScaleHeight     =   32
  21.       ScaleMode       =   3  'Pixel
  22.       ScaleWidth      =   32
  23.       TabIndex        =   25
  24.       Top             =   1920
  25.       Visible         =   0   'False
  26.       Width           =   510
  27.    End
  28.    Begin PictureBox picCopy 
  29.       AutoRedraw      =   -1  'True
  30.       BorderStyle     =   0  'None
  31.       Height          =   495
  32.       Left            =   1680
  33.       ScaleHeight     =   33
  34.       ScaleMode       =   3  'Pixel
  35.       ScaleWidth      =   33
  36.       TabIndex        =   24
  37.       Top             =   1920
  38.       Visible         =   0   'False
  39.       Width           =   495
  40.    End
  41.    Begin PictureBox picMask 
  42.       AutoRedraw      =   -1  'True
  43.       AutoSize        =   -1  'True
  44.       Height          =   510
  45.       Left            =   240
  46.       Picture         =   CALLDLLS.FRX:0302
  47.       ScaleHeight     =   32
  48.       ScaleMode       =   3  'Pixel
  49.       ScaleWidth      =   32
  50.       TabIndex        =   23
  51.       Top             =   1920
  52.       Visible         =   0   'False
  53.       Width           =   510
  54.    End
  55.    Begin CommandButton cmdBitBlt 
  56.       Caption         =   "BitBlt"
  57.       Height          =   495
  58.       Left            =   4680
  59.       TabIndex        =   22
  60.       Top             =   1320
  61.       Width           =   735
  62.    End
  63.    Begin Frame fraInfo 
  64.       Caption         =   "Instructions"
  65.       ClipControls    =   0   'False
  66.       Height          =   1695
  67.       Index           =   0
  68.       Left            =   120
  69.       TabIndex        =   0
  70.       Top             =   120
  71.       Width           =   4455
  72.       Begin Label lblInfo 
  73.          Caption         =   "Click the right mouse button on the icons to the right."
  74.          Height          =   495
  75.          Index           =   1
  76.          Left            =   840
  77.          TabIndex        =   1
  78.          Top             =   480
  79.          Width           =   2415
  80.       End
  81.    End
  82.    Begin Timer tmrBounce 
  83.       Enabled         =   0   'False
  84.       Interval        =   1
  85.       Left            =   4080
  86.       Top             =   1920
  87.    End
  88.    Begin Frame fraInfo 
  89.       Caption         =   "General Info"
  90.       ClipControls    =   0   'False
  91.       Height          =   1695
  92.       Index           =   4
  93.       Left            =   120
  94.       TabIndex        =   13
  95.       Top             =   120
  96.       Visible         =   0   'False
  97.       Width           =   4455
  98.       Begin Label lblInfo 
  99.          Caption         =   "Keyboard:"
  100.          Height          =   435
  101.          Index           =   14
  102.          Left            =   120
  103.          TabIndex        =   17
  104.          Top             =   1080
  105.          Width           =   4230
  106.       End
  107.       Begin Label lblInfo 
  108.          AutoSize        =   -1  'True
  109.          Caption         =   "Language:"
  110.          Height          =   195
  111.          Index           =   13
  112.          Left            =   120
  113.          TabIndex        =   16
  114.          Top             =   840
  115.          Width           =   915
  116.       End
  117.       Begin Label lblInfo 
  118.          AutoSize        =   -1  'True
  119.          Caption         =   "Mouse:"
  120.          Height          =   195
  121.          Index           =   12
  122.          Left            =   120
  123.          TabIndex        =   15
  124.          Top             =   360
  125.          Width           =   630
  126.       End
  127.       Begin Label lblInfo 
  128.          AutoSize        =   -1  'True
  129.          Caption         =   "Network:"
  130.          Height          =   195
  131.          Index           =   11
  132.          Left            =   120
  133.          TabIndex        =   14
  134.          Top             =   600
  135.          Width           =   780
  136.       End
  137.    End
  138.    Begin Frame fraInfo 
  139.       Caption         =   "Operating System"
  140.       ClipControls    =   0   'False
  141.       Height          =   1695
  142.       Index           =   1
  143.       Left            =   120
  144.       TabIndex        =   2
  145.       Top             =   120
  146.       Visible         =   0   'False
  147.       Width           =   4455
  148.       Begin Label lblInfo 
  149.          AutoSize        =   -1  'True
  150.          Caption         =   "(Enhanced mode)"
  151.          Height          =   195
  152.          Index           =   3
  153.          Left            =   360
  154.          TabIndex        =   8
  155.          Top             =   600
  156.          Width           =   1500
  157.       End
  158.       Begin Label lblInfo 
  159.          AutoSize        =   -1  'True
  160.          Caption         =   "Disk Operating System 5.0"
  161.          Height          =   195
  162.          Index           =   4
  163.          Left            =   240
  164.          TabIndex        =   4
  165.          Top             =   960
  166.          Width           =   2265
  167.       End
  168.       Begin Label lblInfo 
  169.          AutoSize        =   -1  'True
  170.          Caption         =   "Microsoft Windows Version 3.1"
  171.          Height          =   195
  172.          Index           =   2
  173.          Left            =   240
  174.          TabIndex        =   3
  175.          Top             =   360
  176.          Width           =   2640
  177.       End
  178.    End
  179.    Begin Frame fraInfo 
  180.       Caption         =   "Processor, Memory, and System Resources"
  181.       ClipControls    =   0   'False
  182.       Height          =   1695
  183.       Index           =   2
  184.       Left            =   120
  185.       TabIndex        =   5
  186.       Top             =   120
  187.       Visible         =   0   'False
  188.       Width           =   4455
  189.       Begin Timer tmrSysInfo 
  190.          Interval        =   1
  191.          Left            =   3840
  192.          Top             =   240
  193.       End
  194.       Begin Shape shpFrame 
  195.          Height          =   255
  196.          Index           =   1
  197.          Left            =   1080
  198.          Top             =   960
  199.          Width           =   3135
  200.       End
  201.       Begin Shape shpBar 
  202.          BackStyle       =   1  'Opaque
  203.          DrawMode        =   7  'Xor Pen
  204.          Height          =   255
  205.          Index           =   1
  206.          Left            =   1080
  207.          Top             =   960
  208.          Width           =   1695
  209.       End
  210.       Begin Shape shpFrame 
  211.          Height          =   255
  212.          Index           =   2
  213.          Left            =   1080
  214.          Top             =   1320
  215.          Width           =   3135
  216.       End
  217.       Begin Shape shpBar 
  218.          BackStyle       =   1  'Opaque
  219.          DrawMode        =   7  'Xor Pen
  220.          Height          =   255
  221.          Index           =   2
  222.          Left            =   1080
  223.          Top             =   1320
  224.          Width           =   1695
  225.       End
  226.       Begin Label lblResInfo 
  227.          Alignment       =   2  'Center
  228.          Caption         =   "user"
  229.          Height          =   255
  230.          Index           =   2
  231.          Left            =   1080
  232.          TabIndex        =   21
  233.          Top             =   1320
  234.          Width           =   3135
  235.       End
  236.       Begin Label lblResInfo 
  237.          Alignment       =   2  'Center
  238.          Caption         =   "gdi"
  239.          Height          =   255
  240.          Index           =   1
  241.          Left            =   1080
  242.          TabIndex        =   20
  243.          Top             =   960
  244.          Width           =   3135
  245.       End
  246.       Begin Label lblR 
  247.          Caption         =   "GDI"
  248.          Height          =   255
  249.          Index           =   1
  250.          Left            =   240
  251.          TabIndex        =   19
  252.          Top             =   960
  253.          Width           =   855
  254.       End
  255.       Begin Label lblR 
  256.          Caption         =   "User"
  257.          Height          =   255
  258.          Index           =   2
  259.          Left            =   240
  260.          TabIndex        =   18
  261.          Top             =   1320
  262.          Width           =   855
  263.       End
  264.       Begin Label lblInfo 
  265.          AutoSize        =   -1  'True
  266.          Caption         =   "CPU: 486 (with Math Coprocessor)"
  267.          Height          =   195
  268.          Index           =   5
  269.          Left            =   240
  270.          TabIndex        =   7
  271.          Top             =   360
  272.          Width           =   2940
  273.       End
  274.       Begin Label lblInfo 
  275.          AutoSize        =   -1  'True
  276.          Caption         =   "Memory Free"
  277.          Height          =   195
  278.          Index           =   6
  279.          Left            =   240
  280.          TabIndex        =   6
  281.          Top             =   600
  282.          Width           =   1095
  283.       End
  284.    End
  285.    Begin Frame fraInfo 
  286.       Caption         =   "Video"
  287.       ClipControls    =   0   'False
  288.       Height          =   1695
  289.       Index           =   3
  290.       Left            =   120
  291.       TabIndex        =   9
  292.       Top             =   120
  293.       Visible         =   0   'False
  294.       Width           =   4455
  295.       Begin Label lblInfo 
  296.          AutoSize        =   -1  'True
  297.          Caption         =   "Colors:"
  298.          Height          =   195
  299.          Index           =   10
  300.          Left            =   240
  301.          TabIndex        =   12
  302.          Top             =   1320
  303.          Width           =   600
  304.       End
  305.       Begin Label lblInfo 
  306.          AutoSize        =   -1  'True
  307.          Caption         =   "Resolution"
  308.          Height          =   195
  309.          Index           =   9
  310.          Left            =   240
  311.          TabIndex        =   11
  312.          Top             =   960
  313.          Width           =   915
  314.       End
  315.       Begin Label lblInfo 
  316.          Caption         =   "Video Driver:"
  317.          Height          =   495
  318.          Index           =   8
  319.          Left            =   240
  320.          TabIndex        =   10
  321.          Top             =   360
  322.          Width           =   3975
  323.       End
  324.    End
  325.    Begin Image ImgIcon 
  326.       Height          =   480
  327.       Index           =   1
  328.       Left            =   4800
  329.       Picture         =   CALLDLLS.FRX:0604
  330.       Top             =   720
  331.       Width           =   480
  332.    End
  333.    Begin Image ImgIcon 
  334.       Height          =   480
  335.       Index           =   0
  336.       Left            =   4800
  337.       Picture         =   CALLDLLS.FRX:0906
  338.       Top             =   120
  339.       Width           =   480
  340.    End
  341. Option Explicit
  342. Dim dx As Integer, dy As Integer, X As Integer, Y As Integer
  343. Dim PicWidth As Integer, PicHeight As Integer
  344. Dim RightEdge As Integer, BottomEdge As Integer
  345. Sub cmdBitBlt_Click ()
  346. Dim t As Integer
  347.     If tmrBounce.Enabled Then
  348.     tmrBounce.Enabled = False
  349.     Refresh
  350.     Else
  351.     ScaleMode = PIXELS
  352.     dx = 15
  353.     dy = 15
  354.     tmrBounce.Enabled = True
  355.     PicWidth = picSprite.ScaleWidth
  356.     PicHeight = picSprite.ScaleHeight
  357.     picCopy.Width = PicWidth
  358.     picCopy.Height = PicHeight
  359.     t = BitBlt(picCopy.hDC, 0, 0, PicWidth, PicHeight, hDC, X, Y, SRCCOPY)
  360.     End If
  361. End Sub
  362. Sub FillSysInfo ()
  363. Dim WinFlags As Long, FreeSpace As Currency, FreeBlock As Currency, temp
  364. ' Operating System Info.
  365.     WinFlags = GetWinFlags()
  366.     lblinfo(2).Caption = "Microsoft Windows Version " & WindowsVersion()
  367.     If WinFlags And WF_ENHANCED Then
  368.     lblinfo(3).Caption = "(Enhanced Mode)"
  369.     Else
  370.     lblinfo(3).Caption = "(Standard Mode)"
  371.     End If
  372.     lblinfo(4).Caption = "Disk Operating System " & DosVersion()
  373. ' CPU Info.
  374.     If WinFlags And WF_CPU486 Then
  375.     lblinfo(5).Caption = "CPU: 486"
  376.     ElseIf WinFlags And WF_CPU386 Then
  377.     lblinfo(5).Caption = "CPU: 386"
  378.     ElseIf WinFlags And WF_CPU286 Then
  379.     lblinfo(5).Caption = "CPU: 286"
  380.     End If
  381.     If WinFlags And WF_80x87 Then
  382.     lblinfo(5).Caption = lblinfo(5).Caption & " (with Math coprocessor)"
  383.     End If
  384. ' Video info.
  385.     lblinfo(8).Caption = "Video Driver: " & GetSysIni("boot.description", "display.drv")
  386.     lblinfo(9).Caption = "Resolution: " & Screen.Width \ Screen.TwipsPerPixelX & " x " & Screen.Height \ Screen.TwipsPerPixelY
  387.     lblinfo(10).Caption = "Colors: " & DeviceColors((hDC))
  388. ' General info.
  389.     If GetSystemMetrics(SM_MOUSEPRESENT) Then
  390.     lblinfo(11).Caption = "Mouse: " & GetSysIni("boot.description", "mouse.drv")
  391.     Else
  392.     lblinfo(11).Caption = "No mouse"
  393.     End If
  394.     lblinfo(12).Caption = "Network: " & GetSysIni("boot.description", "network.drv")
  395.     lblinfo(13).Caption = "Language: " & GetSysIni("boot.description", "language.dll")
  396.     lblinfo(14).Caption = "Keyboard: " & GetSysIni("boot.description", "keyboard.typ")
  397. End Sub
  398. Sub Form_Load ()
  399.     Show                ' Make sure this form has an hWnd, etc.
  400.     Load frmMenus
  401.     Icon = imgIcon(1).Picture
  402.     FillSysInfo
  403. End Sub
  404. Sub Form_QueryUnload (Cancel As Integer, UnloadMode As Integer)
  405.     End
  406. End Sub
  407. Sub Form_Resize ()
  408. Dim t As Integer, hDC As Integer
  409.     If WindowState = MINIMIZED Then
  410.     RightEdge = Screen.Width \ Screen.TwipsPerPixelX
  411.     BottomEdge = Screen.Height \ Screen.TwipsPerPixelY
  412.     If tmrBounce.Enabled Then
  413.         hDC = GetDC(GetDeskTopWindow())
  414.         t = BitBlt(picCopy.hDC, 0, 0, PicWidth, PicHeight, hDC, X, Y, SRCCOPY)
  415.         ReleaseDC GetDeskTopWindow(), hDC
  416.     End If
  417.     Else
  418.     ScaleMode = PIXELS
  419.     RightEdge = ScaleWidth
  420.     BottomEdge = ScaleHeight
  421.     If tmrBounce.Enabled Then
  422.         hDC = GetDC(GetDeskTopWindow())
  423.         t = BitBlt(hDC, X, Y, PicWidth, PicHeight, picCopy.hDC, 0, 0, SRCCOPY)
  424.         ReleaseDC GetDeskTopWindow(), hDC
  425.     End If
  426.     End If
  427. End Sub
  428. Sub ImgIcon_MouseDown (Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  429. Dim IX  As Integer, IY As Integer
  430. Dim hMenu As Integer, hSubMenu As Integer, R As Integer
  431. Dim menRect As Rect
  432.     If Button And 2 Then
  433.     ScaleMode = TWIPS
  434.     menRect.Left = 0
  435.     menRect.Top = 0
  436.     menRect.Right = Screen.Width / Screen.TwipsPerPixelX
  437.     menRect.Bottom = Screen.Height / Screen.TwipsPerPixelY
  438.     IX = (X + Left + imgIcon(Index).Left) \ Screen.TwipsPerPixelX
  439.     IY = (Y + Top + imgIcon(Index).Top + imgIcon(Index).Height) \ Screen.TwipsPerPixelY
  440.     hMenu = GetMenu(frmMenus.hWnd)
  441.     hSubMenu = GetSubMenu(hMenu, Index)
  442.     R = TrackPopupMenu(hSubMenu, 2, IX, IY, 0, frmMenus.hWnd, menRect)
  443.     End If
  444.     ' Refresh SysInfo
  445.     If Index = 2 Then
  446.     FillSysInfo
  447.     End If
  448. End Sub
  449. Sub tmrBounce_Timer ()
  450. 'Following are static only to improve speed
  451. Static NewX As Integer, NewY As Integer, temp As Integer
  452. Static hDC As Integer, releaseit As Integer
  453. 'Calculate new position
  454.     ScaleMode = PIXELS
  455.     temp = X + dx
  456.     If temp + PicWidth \ 2 > RightEdge Then
  457.     dx = -Abs(dx)
  458.     ElseIf temp < 0 Then
  459.     dx = Abs(dx)
  460.     End If
  461.     NewX = X + dx
  462.     temp = Y + dy
  463.     If temp + PicHeight \ 2 > BottomEdge Then
  464.     dy = -Abs(dy)
  465.     ElseIf temp < 0 Then
  466.     dy = Abs(dy)
  467.     End If
  468.     NewY = Y + dy
  469.     If WindowState = MINIMIZED Then
  470.     hDC = GetDC(GetDeskTopWindow())
  471.     releaseit = True
  472.     Else
  473.     hDC = Me.hDC
  474.     releaseit = False
  475.     End If
  476. 'Now perform "transparent" BitBlts:
  477. '1 Copy old background back over sprite's old position
  478. '2 Copy the background where the sprite will go
  479. '3 Draw the mask
  480. '4 Draw the sprite
  481.     temp = BitBlt(hDC, X, Y, PicWidth, PicHeight, picCopy.hDC, 0, 0, SRCCOPY)
  482.     temp = BitBlt(picCopy.hDC, 0, 0, PicWidth, PicHeight, hDC, NewX, NewY, SRCCOPY)
  483.     temp = BitBlt(hDC, NewX, NewY, PicWidth, PicHeight, picMask.hDC, 0, 0, SRCAND)
  484.     temp = BitBlt(hDC, NewX, NewY, PicWidth, PicHeight, picSprite.hDC, 0, 0, SRCINVERT)
  485.     X = NewX
  486.     Y = NewY
  487.     If releaseit Then ReleaseDC GetDeskTopWindow(), hDC
  488. End Sub
  489. Sub tmrSysInfo_Timer ()
  490. Static Res(1 To 2) As Integer, OldFreeSpace As Currency
  491. Dim i As Integer, newVal As Integer, temp, FreeSpace As Currency
  492.     ' Update resource info if visible.
  493.     If fraInfo(RES_INFO).Visible Then
  494.     For i = 1 To 2
  495.         newVal = GetFreeSystemResources(i)
  496.         ' Reduce flashing by updating bar graphs and percentage
  497.         ' display only if they've actually changed.
  498.         If newVal <> Res(i) Then
  499.         Res(i) = newVal
  500.         lblResInfo(i).Caption = Res(i) & "%"
  501.         shpBar(i).Width = shpFrame(i).Width * Res(i) \ 100
  502.         End If
  503.     Next
  504.     temp = GetFreeSpace(0)
  505.     If Sgn(temp) = -1 Then
  506.         ' Return of GetFreeSpace is an unsigned long
  507.         ' so handle case when high bit is set (two's complement).
  508.         FreeSpace = CLng(temp + 1&) Xor &HFFFFFFFF
  509.     Else
  510.         FreeSpace = temp
  511.     End If
  512.     If FreeSpace <> OldFreeSpace Then
  513.         lblinfo(6).Caption = "Free memory space: " & Format(FreeSpace, "#,# \b\y\t\e\s")
  514.         OldFreeSpace = FreeSpace
  515.     End If
  516.     End If
  517. End Sub
  518.