| | |
"Active" files and moving/changing paths
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Jul 2005
Posts: 244
Reputation:
Solved Threads: 5
This is an offshoot of a specific problem I've posted in the C# forum.
However, it applies to C++ as well.
If you have opened a file, specifically, an image file, but would like to rename (or, as MSDN says, 'move) the directory the file resides in, what are the requirements for being able to move the directory without the system complaining about access violations?
The imagefile I'm using is opened in a picturebox control, but making the picturebox show another image does not help. Only the complete commenting out of code that loads information about the picture seems to help, but it's necessary for me to be able to view the picture both before and after the move/renaming.
Is there a way to unload, detach, or close a file from an application such that the parent directory can be moved without problems?
How does the application/OS recognize that it cannot move the active file?
Thanks in advance.
However, it applies to C++ as well.
If you have opened a file, specifically, an image file, but would like to rename (or, as MSDN says, 'move) the directory the file resides in, what are the requirements for being able to move the directory without the system complaining about access violations?
The imagefile I'm using is opened in a picturebox control, but making the picturebox show another image does not help. Only the complete commenting out of code that loads information about the picture seems to help, but it's necessary for me to be able to view the picture both before and after the move/renaming.
Is there a way to unload, detach, or close a file from an application such that the parent directory can be moved without problems?
How does the application/OS recognize that it cannot move the active file?
Thanks in advance.
Explainer of control logic and some basics.
"If you seek to drink from a fountain of knowledge, make sure your cup is big enough."
"If you seek to drink from a fountain of knowledge, make sure your cup is big enough."
•
•
•
•
Originally Posted by Drowzee
Is there a way to unload, detach, or close a file from an application such that the parent directory can be moved without problems?
•
•
•
•
Originally Posted by Drowzee
How does the application/OS recognize that it cannot move the active file?
バルサミコ酢やっぱいらへんで
•
•
Join Date: Jul 2005
Posts: 244
Reputation:
Solved Threads: 5
That looks to be just about what I'm interested in; however, with regards to the PictureBox control specifically, how would you force it to release the file that has been set to its image attribute?
Would CloseHandle do this?
Or should I focus on the Image, and call its dispose function before eliminating the reference in the picturebox control?
The latter seems more likely. I'll try that on monday.
Would CloseHandle do this?
Or should I focus on the Image, and call its dispose function before eliminating the reference in the picturebox control?
The latter seems more likely. I'll try that on monday.
Explainer of control logic and some basics.
"If you seek to drink from a fountain of knowledge, make sure your cup is big enough."
"If you seek to drink from a fountain of knowledge, make sure your cup is big enough."
•
•
Join Date: Jul 2005
Posts: 244
Reputation:
Solved Threads: 5
As I (eventually) figured out, with inspiration from Wolfpack's reply, making sure to explicitly mark the image for closing and garbage collection solved the problem nicely.
Thanks for the inspiration, and I'll keep the file functions you linked in mind.
Thanks for the inspiration, and I'll keep the file functions you linked in mind.
Explainer of control logic and some basics.
"If you seek to drink from a fountain of knowledge, make sure your cup is big enough."
"If you seek to drink from a fountain of knowledge, make sure your cup is big enough."
![]() |
Similar Threads
- 2nd SATA HDD - won't let me access "My Documents" (Storage)
- google "keyword" question (Search Engine Optimization)
- Can't remove "about:blank" homepage. Please help. (Viruses, Spyware and other Nasties)
- "WINDOWS\ SYSTEM\ BRIDGE.DLL" (Viruses, Spyware and other Nasties)
- "Upload active" searchbar Malware (Viruses, Spyware and other Nasties)
Other Threads in the C++ Forum
- Previous Thread: Lol Im reallly new at this
- Next Thread: C++ CGI Scripts
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays assignment beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete developer display dll email encryption error file forms fstream function functions game generator getline givemetehcodez graph homeworkhelper iamthwee ifstream image input int java lazy lib loop looping loops map math matrix memory multidimensional multiple newbie news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return sorting string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






