Solved

Common Dialog does not release handle to folder

Posted on 2003-12-05
4
179 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

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

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…
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.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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