473,320 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Shell32 FileOperation and Open Resources

I am trying to use Shell32 objects to move files to the recycling bin upon user command. The problem is that I have the resource open prior to the user making the decision to delete the resource (image files). I close them and call Dispose on them, but I get an 0x402 response and the image is not recycled. I know it has something to do with using the resource because I can delete other resources that aren't in use.

I have also tried invoking garbage collection prior to executing the Shell32 command and I still get the same response.

Any ideas on how to detach from the resource? Also, what does 0x402 mean exactly?

Thanks,

Nov 16 '05 #1
2 1942
Brain,

Can you paste the code of opening the image? There is a chance that you are
not using proper methods to close the image file. Your code will help me to
investigate the problem.

--
Shak
(Houston)
"Brian Reed" <Br*******@discussions.microsoft.com> wrote in message
news:40**********************************@microsof t.com...
I am trying to use Shell32 objects to move files to the recycling bin upon user command. The problem is that I have the resource open prior to the
user making the decision to delete the resource (image files). I close them
and call Dispose on them, but I get an 0x402 response and the image is not
recycled. I know it has something to do with using the resource because I
can delete other resources that aren't in use.
I have also tried invoking garbage collection prior to executing the Shell32 command and I still get the same response.
Any ideas on how to detach from the resource? Also, what does 0x402 mean exactly?
Thanks,

Nov 16 '05 #2
Here is the way I load the image:

m_imgCurImage = DRW.Image.FromFile(m_strFilePath, true);
m_bImageLoaded = true;
The m_imgCurImage is a member variable and is held onto until I close it or move on to the next one.

Here is the way I close the image:

private void UnloadImage()
{
if(m_bImageLoaded)
{
m_imgCurImage.Dispose();
m_imgCurImage = null;
}

m_bImageLoaded = false;
}
Any help would be great.

Thanks,

"Shakir Hussain" wrote:
Brain,

Can you paste the code of opening the image? There is a chance that you are
not using proper methods to close the image file. Your code will help me to
investigate the problem.

--
Shak
(Houston)
"Brian Reed" <Br*******@discussions.microsoft.com> wrote in message
news:40**********************************@microsof t.com...
I am trying to use Shell32 objects to move files to the recycling bin upon

user command. The problem is that I have the resource open prior to the
user making the decision to delete the resource (image files). I close them
and call Dispose on them, but I get an 0x402 response and the image is not
recycled. I know it has something to do with using the resource because I
can delete other resources that aren't in use.

I have also tried invoking garbage collection prior to executing the

Shell32 command and I still get the same response.

Any ideas on how to detach from the resource? Also, what does 0x402 mean

exactly?

Thanks,


Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Craig | last post by:
I've seen many examples of how to call SHGetFileInfo in shell32.dll to get a files associated icon, but I can't find anywhere how to get the file information (size, last date modified, etc, etc)...
6
by: Brian Henry | last post by:
Hi, I have a custom made error form and wany to show the exclimation mark or red X icon form shell32.dll in my application. how would i read these resources? thanks
3
by: Just Me | last post by:
I've referenced the shell32.dll but can't seen to use it. Could someone give an example of using any function in it? Something like: Dim ShellQAs New Shell32.ShellClass Dim shellFolder...
0
by: Steve Mauldin | last post by:
I am trying to get from files the keywords saved as part of the properties under the summary tab. I am able to get the Title, and Comments using the following code but I need to get the keywords...
0
by: Steve Mauldin | last post by:
I am trying to get from files the keywords saved as part of the properties under the summary tab. I am able to get the Title, and Comments using the following code but I need to get the keywords...
1
by: Zairay | last post by:
Hi All, I'm having a problem with the Shell32.dll when I try to open a program from my Access db. When I try to open a program called FalconViewLite from my access database I get an error in...
5
by: Diego Ruiz | last post by:
Hi!! my english is not too good, but i'll try it I have a javascript code: function executeCommands(inputparms) { // Instantiate the Shell object and invoke its execute method. ...
0
by: Eran.Yasso | last post by:
Hi all, The following code sets/disables network adpter's status. Since I have no idea where to put this code and I wish to share the community with it. I did rverse engineering from VBS to C#....
5
by: progvar | last post by:
Hi, i want to know how to unzip a zip file and extract the files to a particular location please help me thanks in advance varinder
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.