|
-
February 13th, 2009, 07:13 AM
#1
Write file from VB6 at Vista OS
My program will write to file where the program is located. It's working fine with VB6 & Windows XP but with Vista the file can't write into the same location with the program. There is no error but I still can't find the file that it should write.
Is there any special coding to write to file with Vista?
Please help.
Thanks
-
February 13th, 2009, 07:35 AM
#2
Re: Write file from VB6 at Vista OS
 Originally Posted by the_magicien
My program will write to file where the program is located. It's working fine with VB6 & Windows XP but with Vista the file can't write into the same location with the program. There is no error but I still can't find the file that it should write.
Is there any special coding to write to file with Vista?
I assume that you are doing this in Program Files. That directory is write protected for user.
You could:
1) Run your program as administrator (either manually or by using manifest).
2) Manually set write rights for that directory.
3) Write a file where it should be written - e.g. Application Data.
-
February 13th, 2009, 08:53 AM
#3
Re: Write file from VB6 at Vista OS
Create a folder for your program in the User or Common Application Data folder. Vista does not allow writing to the Program Files. Files in that folder should be read only. Do all your read/writing in the Application Data folder you create.
-
February 13th, 2009, 08:17 PM
#4
Re: Write file from VB6 at Vista OS
tq jmedved.how I can use manifest?Can you give sample.
Thanks
-
February 13th, 2009, 08:46 PM
#5
Re: Write file from VB6 at Vista OS
You still won't be able to write to the PROGRAM FILES folder under Vista or later OS. For Vista, use the %ProgramData% folder to create a program file for your app. (You could do the same for XP if you wanted the same program to run)
Environmental Variables (Vista)
http://vistaonwindows.com/environment_variables.html
-
February 14th, 2009, 02:40 AM
#6
Re: Write file from VB6 at Vista OS
tq dglienna.Im not sure how to use this enviroment variables.it there any sample
coding that i can use as example?
Thanks
-
February 14th, 2009, 03:54 AM
#7
Re: Write file from VB6 at Vista OS
Another option is to disable that pesky UAC
-
February 15th, 2009, 02:37 PM
#8
Re: Write file from VB6 at Vista OS
 Originally Posted by the_magicien
how I can use manifest?Can you give sample.
Add file named yourfilename.exe.manifest with following content:
Code:
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
</asmv1:assembly>
Important part is requestedExecutionLevel (requireAdministrator). This will make your program ask for admin rights on startup and after that, you will get everything you have on XP (full admin credentials).
P.S. Proper way would be just to write where you are supposed to (Application Data).
-
February 15th, 2009, 09:27 PM
#9
Re: Write file from VB6 at Vista OS
That won't write to the program files folder...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|