Home | Microsoft | Visual Basic 6.0 (361-00686) for PC | Getting permission den...
Microsoft Visual Basic 6.0  for PC
Problem for Microsoft Visual Basic 6.0 (361-00686) for PC

Getting permission denied error with Kill




By tejashree_lo on Jun 22, 2009

" "
Hi ,
I am writing a log file handling program. I am using the ''Kernal32'' function lopen and lclose for calculating the size of file .
I am zipping file and want to delete a old log file but when i am deleting the file with
Kill ''C:demo_logfilelog estlog.log'' I am getting permission denied error.

Please Help me !!!!
Comments:

Jun 22, 2009

- Yes I did..

Public Function GetLogFileSize(FilePath As String) As Double
Dim Pointer As Long
Dim sizeofFile As Long
Pointer = lOpen(FilePath, OF_READ) 'size of the file
sizeofFile = GetFileSize(Pointer, lpFSHigh)
GetLogFileSize = sizeofFile '& " bytes" 'lclose Pointer
End Function

this is the function which I am using to calaulate the size of file...

Jun 22, 2009

- Yes i did...

Jun 22, 2009

- it is read only..
but when I clear the check box of read only, next time its again becoming read only(without running program also)

its not allowing me to remove the read-only permission.
I have system administrator rights

Jun 22, 2009

- Its not allowing me to remove read-only permission

Jun 22, 2009

- "Use simple file sharing" was already unchecked ....

Jun 22, 2009

- I am using VB 6.0
I have to write script for deleting the file , I cant delete it manually ....

Is there any other way to delete a file except Kill..

Jun 23, 2009

- Thanks :)

Jun 23, 2009

- Hiiii,
I have another problem..
I want to create a folder in registry and read and write from the registry using VB 60
Please Help!!!!!!!!!

Jun 23, 2009

- Hiiii,
I have another problem..
I want to create a folder in registry and read and write from the registry using VB 60
Please Help!!!!!!!!!

Jun 23, 2009

- Thanx a lot :)
Actually i hav to pass source file path and destination file path to registry(In some folder) and want to read those paths from the registry...

Jun 24, 2009

- Hiii
What is mnuMRU?

I want to create a folder in registry and save source and destination file path..

I have tried below but its not working

SaveSetting App.Title, "HKEY_CURRENT_USER\MyTestKey", "Testlog", "C:\demo_logfile\Testlog"

GetSetting App.Title, "HKEY_CURRENT_USER\MyTestKey", "Testlog", "C:\demo_logfile\Testlog"

I have to write a script so I am not using Dialog box, i have to directly get the source and destination file path from registry..

PLs Pls Help me ..its being long time I am doing this ....
Pls provide solution ....

Jun 24, 2009

- Thanks a lot :):)
I will try this.

Jun 29, 2009

- Hiii Again ,
How can I have the VB 6.0 program wait until a shell command is finished????
I am writing a function to zip a file and just below that I have written KILL command to delete the originol file. but its not waiting for the zip to finish and it is deleting the log file which i have to zip .

Plzzzzz provide the solution

Jun 29, 2009

- Can i use some API to know wether Zip file is created or not ???
PLzzzzzz help me its very URGENT

Jun 30, 2009

- Hii..
My PM told me to find some WinZip API and want me to get something return when the file is zipped..I searched but i didnt find any API related to WinZip which perform the Zip..

Plz reply.

how can i directly mail u ??

Jun 30, 2009

- Thanks a lot :)
It was really helpful .

instead of replying to the same mail how can i ask something directly to u ?

Best Solution

posted on Jun 22, 2009
Helpful)

LASITHA-VEGA

Rank: Wiz  Microsoft Expert
Rating: 83%, 103 votes
did u close the opened handle? after calculation?
Comments:

Jun 22, 2009

- check whether the file is accessed by some part of ur program. if not go to the file and check properties to verify whether its read only or go to security tab and check whether u hv permission

Jun 22, 2009

- welll that's fine. Its an obvious thing :) have you tried to delete the file manually? Do it and see.
If you don't have security tab in properties, get my computer and then go to Tools->Folder Options->view->Remove the tick for "Use simple file sharing(the very last option)"
Then go to that tab and check whether your account is there with full permissions

Jun 22, 2009

- Open the file with full permission and then do your work. (if the handles are closed using Cose() on the stream objects...Don't open the file as read only.
Try to delete the log file manually. Where did u create the file? Read only attribute is sometimes set to protect files. Its a normal thing. Specially for log files. You can create the file without the attribute using FileAttributes.Normal. But its fine to make it as read only coz its a log file.
. I think you are using this namespace already
System.IO.FileAttributes
I still think that there is a process which still locks your file.

Jun 22, 2009

- u need a script
ok
Go to this link
Thanks
I m in a hurry that's y I got late to reply you
Please rate the answer
:)

Jun 23, 2009

- ah that's easy I ll post it

Jun 23, 2009

- Saving Values In The Windows Registry

SaveSetting appname, section, key, setting
Here are the arguments for SaveSetting:
• appname—String containing the name of the application to which the setting
applies.
• section—String containing the name of the section where the key setting
should be saved.
• key—String containing the name of the key setting being saved.
• setting—Expression containing the value to set the key to.

Getting Values From The Windows Registry

GetSetting( appname, section, key[, default])
Here are the arguments passed to this function:
• appname—String containing the name of the application or project whose key
setting is requested.
• section—String containing the name of the section where the key setting is
found.
• key—String containing the name of the key setting to return.
• default—Expression containing the value to return if no value is

Getting All Registry Settings
You can use the GetAllSettings to get a list of key settings and their values from a section
in the Windows Registry. Here’s how you use GetAllSettings:
GetAllSettings( appname, section)
Here are the arguments for GetAllSettings:
• appname—String containing the name of the application whose key settings you
want.
• section—String containing the name of the section whose key settings you want.

Deleting A Registry Setting
You can delete Registry settings with the DeleteSetting statement:
DeleteSetting appname, section[, key]

Sample

Private Sub mnuOpen_Click()
With dlgCommonDialog

.DialogTitle = "Open"
.CancelError = False
.Filter = "All Files (*.*)[vbar]*.*"
.ShowOpen
If Len(.FileName) = 0 Then
Exit Sub
End If
If GetSetting(App.Title, "Settings", "Doc1") = "" Then
Load mnuMRU(1)
End If
mnuMRU(1).Caption = .FileName
mnuMRU(1).Visible = True
SaveSetting App.Title, "Settings", "Doc1", .FileName
End With
End Sub

Jun 24, 2009

- Go here and see this will helpful to u
Good Luck
:)

Jun 24, 2009

- You are most welcome
:)
Its a pleasure to help you

Jun 29, 2009

- i see. ok I ll post

Jun 30, 2009

- I haven't used Winzip with VB projects but go here and have a look. There is working code at the bottom. I have used ZLIB once, go and check here also. Its easy to use. You can easily integrate those .dll s.
If you want to wait until the Compression ends, you have to use a different function implementation which returns a value, to check whether the is finished.
Hope this would help.
:)

Jun 30, 2009

- I have found some very important API functions. You can do anything from these. I mean you can't write to here and there in the registry as u wish in vb without calling APIs. So here we go.
Go here and check.
And from here.
Enjoy.

Jun 30, 2009

- :) I can't publicly give you the connection details, coz its prohibited na? For service providers its not allowed. Aap ko perm hain. Hum ko nahin :D . I know some hindi;)
Was this helpful?
Yes
No
2 people thought this was helpful

Popular Solutions for Microsoft Visual Basic 6.0


Questions and Unsolved Problems for Microsoft Visual Basic 6.0


Do you recommend Microsoft Visual Basic 6.0 (361-00686) for PC?
Answer

Answer
hiii,iam MeEncanta.. for the end of this year i should finish my project on information hiding using... (More)

Answer
what is the code in a java program that would ask the user to input a 5letter word then the program... (More)

Answer
step by step e mail address set up windows explorer

Answer
i have the emagic logic 5.3 platinum but i dont have manual to start recording what do i do i need... (More)

Answer
Preparing for BEA Certification Want to know what type of questions been asked for Eclipse IDE


Didn't find what you were looking for?

Describe your problem:

Select a Category:







Ask our Experts

 

Solve Your Problem Now!
Chat Live with an Expert
Chat Now
Browse popular Problems
More Common Problems
Most Common Problems for:
For Microsoft Visual Basic 6.0 ...:

Top Programming Tool Experts

Rank: Guru Guru  

Solutions: 554
Member Since: October 2009

Experience: Experienced a lot in computer troubleshooting. Knowledgeable about cellular phones.

Ask Me
Find more Programming Tool Experts

Top Computer & Laptop Repair

(877) 729-0812
We connect to your computer over the Internet to...
Remote Repair

(952) 890-7770
Zkarlo.com provides discount and used laptop parts...
Zkarlo.com


       
Solve Your Problem Now!
Chat Live with an Expert
Chat Now

X
Continue
When the original poster rates a solution that was given to his own problem, that rating is locked!
X

Are you sure the solution content is Inappropriate?
   
Tech buddies can communicate directly to answer questions. Become a Tech Buddy and have direct access to your favorite expert for FREE!
Insert Link
Insert Image
Insert You-Tube clip
Insert List
Insert List
Spell Check

What is this?



Select