Solved

anyone? zip tape?

Posted on 2000-04-11
3
236 Views
Last Modified: 2010-05-02
dear anyone
please pardon my english. can u tell me how to eject zip tape?
0
Comment
Question by:vb6vb6
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
Ruchi earned 400 total points
ID: 2706415
From the web:

Put the following code in the module.

Option Explicit

Private Type Registers
  RegBX As Long
  RegDX As Long
  RegCX As Long
  RegAX As Long
  RegDI As Long
  RegSI As Long
  RegFlags As Long
End Type

Type SECURITY_ATTRIBUTES
        nLength As Long
        lpSecurityDescriptor As Long
        bInheritHandle As Boolean
End Type

Public Const FILE_FLAG_DELETE_ON_CLOSE = &H4000000
Private Const VWin32_DIOC_DOS_IOCTL = 1

Private Declare Function DeviceIoControl Lib "kernel32" (ByVal hDevice As Long, ByVal dwIoControlCode As Long, lpInBuffer As Any, ByVal nInBufferSize As Long, lpOutBuffer As Any, ByVal nOutBufferSize As Long, lpBytesReturned As Long, ByVal lpOverlapped As Long) As Long
Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, lpSecurityAttributes As SECURITY_ATTRIBUTES, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long

Public Sub EjectMedia(Drive As String)
Dim SecAttr As SECURITY_ATTRIBUTES
Dim ErrorResult
Dim hDevice As Long, Regs As Registers, RB As Long
   
  hDevice = CreateFile("\\.\vwin32", 0, 0, SecAttr, 0, FILE_FLAG_DELETE_ON_CLOSE, 0)
  If hDevice = -1 Then
    ErrorResult = -1
    Exit Sub
  End If
  With Regs
    .RegAX = &H220D
    .RegBX = Asc(Left(Drive, 1)) - 64
    .RegCX = &H849
  End With
  ErrorResult = DeviceIoControl(hDevice, VWin32_DIOC_DOS_IOCTL, Regs, Len(Regs), Regs, Len(Regs), RB, 0)
  ErrorResult = CloseHandle(hDevice)
End Sub


Place a command button. Put the code in the form.

Private Sub Command1_Click()
  EjectMedia "D:"  'the letter of your zip drive
End Sub


0
 

Author Comment

by:vb6vb6
ID: 2706423
ruchi
u answered fast. thank u a lot.
0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2706574
vb6vb6: You're most welcome! I'm glad that I could be of any help to you!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now