Solved

anyone? zip tape?

Posted on 2000-04-11
3
240 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Concatenate 2 userform comboboxes to a userform text box 4 61
How to create a duplicate finder Application 9 121
Help me. 3 54
Formula problem with Excel attachment 6 27
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…

776 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