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

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
  • 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: 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.

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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…

856 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