Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multi-threaded app, SHFileOperation and exiting

Status
Not open for further replies.

burgdavid

Programmer
Jun 22, 2000
70
DE
Hello,

I have an application that proceed file operations in background with calls to SHFileOperation. Some operation can take long thus the user may close the application while still some copy windows are open in the background. In this situation, the application crash because the drag'n'drop process which copy the files through SHFileOperation looks some handle of the (closed) application and makes an acces violation.

I can set some mutex so the application won't exit before the file operations are done but that's not what I want.

Is it possible to attach the copy operation to another process completely indepedent ?
 
Have you tryed to use events between the threads. Then when you signal the other thread that the user has exited your application try something like ExitThread or TerminateThread from hte secondary thread.

BTW, I I think another process is a far too complicated solution for your problem.

Have you checked ICopyHook::CopyCallback?
What about the classic DeleteFile, CopyFile etc.

HTH, s-)

Blessed is he who in the name of justice and goodwill, sheperds the weak through the valley of darkness...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top