Solved

Problem with VB and non-working drive

Posted on 2001-06-18
13
150 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month7 days, 6 hours left to enroll

622 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