home *** CD-ROM | disk | FTP | other *** search
/ Dan Appleman's Visual Bas…s Guide to the Win32 API / Dan.Applmans.Visual.Basic.5.0.Programmers.Guide.To.The.Win32.API.1997.Ziff-Davis.Press.CD / VB5PG32.mdf / vbpg32 / samples4 / ch13 / qrydos.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-02-16  |  2.2 KB  |  79 lines

  1. VERSION 4.00
  2. Begin VB.Form frmQueryDos 
  3.    Caption         =   "QueryDos"
  4.    ClientHeight    =   3525
  5.    ClientLeft      =   1095
  6.    ClientTop       =   1515
  7.    ClientWidth     =   4185
  8.    Height          =   3930
  9.    Left            =   1035
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   3525
  12.    ScaleWidth      =   4185
  13.    Top             =   1170
  14.    Width           =   4305
  15.    Begin VB.ListBox lstMappings 
  16.       Height          =   1005
  17.       Left            =   180
  18.       TabIndex        =   2
  19.       Top             =   2400
  20.       Width           =   3795
  21.    End
  22.    Begin VB.ListBox List1 
  23.       Height          =   1785
  24.       Left            =   180
  25.       TabIndex        =   0
  26.       Top             =   300
  27.       Width           =   3795
  28.    End
  29.    Begin VB.Label lblMap 
  30.       Height          =   195
  31.       Left            =   180
  32.       TabIndex        =   3
  33.       Top             =   2160
  34.       Width           =   3795
  35.    End
  36.    Begin VB.Label Label1 
  37.       Caption         =   "Dos Mappings"
  38.       Height          =   195
  39.       Left            =   180
  40.       TabIndex        =   1
  41.       Top             =   60
  42.       Width           =   2955
  43.    End
  44. Attribute VB_Name = "frmQueryDos"
  45. Attribute VB_Creatable = False
  46. Attribute VB_Exposed = False
  47. Option Explicit
  48. ' Copyright 
  49.  1997 by Desaware Inc. All Rights Reserved
  50. Private Declare Function QueryDosDevice Lib "kernel32" Alias "QueryDosDeviceA" (ByVal lpDeviceName As String, ByVal lpTargetPath As String, ByVal ucchMax As Long) As Long
  51. Private Sub Form_Load()
  52.     Dim s$
  53.     Dim r&
  54.     Dim n&
  55.     s$ = String$(1024, 0)
  56.     r& = QueryDosDevice(vbNullString, s, 1024)
  57.     Do
  58.         n = InStr(s$, Chr$(0))
  59.         If n > 1 Then
  60.             List1.AddItem Left$(s$, n - 1)
  61.             s$ = Mid$(s$, n + 1)
  62.         End If
  63.     Loop Until n <= 1
  64. End Sub
  65. Private Sub List1_Click()
  66.     Dim s$, r&, n&
  67.     lblMap.Caption = "Mappings for " & List1.Text
  68.     lstMappings.Clear
  69.     s$ = String$(1024, 0)
  70.     r& = QueryDosDevice(List1.Text, s, 1024)
  71.     Do
  72.         n = InStr(s$, Chr$(0))
  73.         If n > 1 Then
  74.             lstMappings.AddItem Left$(s$, n - 1)
  75.             s$ = Mid$(s$, n + 1)
  76.         End If
  77.     Loop Until n <= 1
  78. End Sub
  79.