Common Dialog does not release handle to folder

Posted on 2003-12-05
Last Modified: 2013-12-25

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?


Question by:swabeui
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
  • 2
  • 2

Expert Comment

ID: 9885655
Do you close the file properly, before trying to delete it?

Expert Comment

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

Expert Comment

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

Accepted Solution

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

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

Question has a verified solution.

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

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…

719 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