Solved

Problem with VB and non-working drive

Posted on 2001-06-18
13
148 Views
Last Modified: 2010-05-02
Given:
1. I have a system with a non-working Zip 100 drive attached.
2. I currently CANNOT remove this drive from the system.
3. My VBApp must check Volume label of every single drive attached to the system.

Details:
The Zip Drive is definitely not working as it chokes as I insert a media into it, and the media cannot be read. At the same time, the system recognizes the drive, and this drive appears in the list of all drives attached to the system. My VB app is looping through all drives in the system while checking for a particular volume label. As the app reaches the Drive that is not working, the entire system hangs without timeout or generating any error messages. The only thing I can do is reboot. Is there any way to (programmatically) avoid this situation.
0
Comment
Question by:tbbrhun
  • 4
  • 3
  • 2
  • +3
13 Comments
 

Expert Comment

by:nongravity
ID: 6203550
Could you explain more how you are doing it in code. Maybe show the code that is actually checking the for the label. Or another suggestion would be to disconnect the Zip drive from your system.
0
 
LVL 4

Expert Comment

by:vindevogel
ID: 6203573
Hmm, I'd put my code to check for drives into an ActiveX dll.

The first advantage is that the EXE will not hang your complete application.

Second one is that you can start it up multiple times (create instances of the exe).  You can "watch" them and if one does not react within let say one minute, you can kill it from your main app (that's on a different thread, so you can do that).

Starting multiple instances will be faster too, but not that easy to program though ....
0
 
LVL 4

Expert Comment

by:vindevogel
ID: 6203575
hmm, not an activex dll, but an activex exe of course ...
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:tbbrhun
ID: 6203902
This application works with removable media, and if it's not a zip drive, it could be any other drive on any other machine that cannot read the media, so now that I found this problem I have to have a way to detect it beforehand rather than disconnection the drive that is very often beyond my reach. I'm using the Drives collection off the Filesystem object where each Drive object in the Drives collection has a VolumeName property which I check. And since the information of VolumeName is actually stored on the media rather than the drive itself, and media cannot be read, this problem occurs.

About ActiveX EXE... I really have to think of the structural impact, but it might be interesting. I'll try it if not other solution comes up.

Thanks!!!

0
 

Expert Comment

by:nongravity
ID: 6203921
What I meant was there probably isn't anything wrong with your code.  Since you've established that the drive itself is bad. Its drivers might be hanging up the system while waiting for a response from the drive that your program is requesting.
0
 

Author Comment

by:tbbrhun
ID: 6203972
Well, that's propably true becuase same code works well on other machines with identical configuration. I wonder what I can do about it. I just left my bad machine for an hour, and there's not response -it's still hanging...
0
 
LVL 5

Expert Comment

by:rkot2000
ID: 6204087
try to use IsReady from Mircosoft scripting lib
0
 
LVL 5

Expert Comment

by:rkot2000
ID: 6204089
found a sample :  
Dim ljFileSys As Scripting.FileSystemObject
  Dim ljDrive As Scripting.Drive
  Dim ljNode As MSComctlLib.Node
 
  Set ljFileSys = New FileSystemObject
 
  TreeView1.Nodes.Add , , "root", "My Computer"
 
  For Each ljDrive In ljFileSys.Drives
    If ljDrive.IsReady = True Then
      Set ljNode = TreeView1.Nodes.Add("root", tvwChild, ljDrive.DriveLetter, ljDrive.DriveLetter, "drive")
    Else
      Set ljNode = TreeView1.Nodes.Add("root", tvwChild, ljDrive.DriveLetter, ljDrive.DriveLetter, "drive")
      ljNode.ForeColor = vbRed
    End If
    ljNode.Tag = "drive"
   
    ljNode.EnsureVisible
  Next
0
 

Author Comment

by:tbbrhun
ID: 6206955
I checked my code, and I do check the IsReady property before attempting to do anything else with the drive. I ran multiple tests, and this is exactly the statement where where the system freezes, alas...
0
 

Expert Comment

by:nongravity
ID: 6207396
tbbrhun,

Are you able to disconnect the Zip Drive?  If you can I would recommend it so you can finish testing your program.
Otherwise your computer is going to hang up everytime. OOOH
quick thought.  For testing purposes you could (in code) tell it that when it reaches the drive letter of you zip drive to skip over it and go to the next drive letter. That way it doesn't lock up.
0
 

Author Comment

by:tbbrhun
ID: 6207438
nongravity:
this particular development machine is not a problem, I can disconnect the Zip drive at any time, but with this program being a prototype of a commercial software that will use removable media drives, I want to avoid this problem to happen on other machines where removeing and replacing a drive is beyond my reach, besides I can never know the drive letter or drive type used. Now I unserstand it's a tough one.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7136265
Hi tbbrhun,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will suggest to:

    Refund points and save as a 0-pt PAQ.

EXPERTS: Post a comment if you are certain that an expert deserves credit.  Explain why.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 7173365
Question placed in PAQ

Computer101
E-E Moderator
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

830 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