Solved

Common Dialog does not release handle to folder

Posted on 2003-12-05
4
177 Views
Last Modified: 2013-12-25
Hi,

I use the common dialog to get a file and i open the file
for reading. Once these two things are done and my
application is still running, if i try to delete the
file, it is ok, but if i try to delete the folder in
which the file resides, then the OS says, "...It is being
used by another person or program."

Any thoughts?

Thanks,

Jimmy
0
Comment
Question by:swabeui
  • 2
  • 2
4 Comments
 
LVL 1

Expert Comment

by:kevin_verp
ID: 9885655
Do you close the file properly, before trying to delete it?
0
 
LVL 1

Expert Comment

by:kevin_verp
ID: 9885658
Can you post some of your code here so we can look @ it ?
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 9887307
Try to call
SetCurrentDirectory("some other directory");
before deleting of file.
0
 
LVL 48

Accepted Solution

by:
AlexFM earned 250 total points
ID: 9887309
Oops, this is VB area. I would write: SetCurrentDirectory API:

Public Declare Function SetCurrentDirectory Lib "kernel32" Alias "SetCurrentDirectoryA" (ByVal lpPathName As String) As Long
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
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…

744 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