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 / samples5 / ch13 / qrydos.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-02-16  |  2.2 KB  |  78 lines

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