Toolbar Internet Explorer

Add-in Express™ Support Service
That's what is more important than anything else

Toolbar Internet Explorer
Toolbar Internet Explorer 
Dmitry Kostochko


Add-in Express team


Posts: 2865
Joined: 2004-04-05
Hello Marvin and Santisan,

Sorry, I was not clear enough in my previous post. Please see the whole code below:


    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        ' file name
        Dim fileName As String = System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
        fileName = System.IO.Path.Combine(fileName, "my_text_file.txt")
        ' write to file
        Dim stream As System.IO.StreamWriter = System.IO.File.CreateText(fileName)
        stream.WriteLine("test")
        stream.Flush()
        stream.Close()
        stream.Dispose()
        ' read from file
        Dim stream2 As System.IO.StreamReader = System.IO.File.OpenText(fileName)
        MessageBox.Show(stream2.ReadToEnd())
        stream2.Dispose()
    End Sub


For additional information about the IE7 Protected Mode feature please see this MSDN article.


Posted 17 Dec, 2008 09:54:09 Top
santisan james




Posts: 15
Joined: 2008-12-02
Hi Dmitry,

Thank you for your Quick reply :-)

Doing it now


Thank you,
Santisan
Posted 18 Dec, 2008 01:43:21 Top
Marvin Biason




Posts: 37
Joined: 2008-12-17
I already used the code and it is good. But nothing happens, it only appeared a msgbox displaying "test". I also try to track down wat path it is. And it is on C:\Users\swordfish\AppData\Local. When I check it out I see nothing. It doesn't write any text but the previous error that I encountered. I guess it is on UAC again.

I really appreciated for the msg that u posted.

Thank u.
Posted 18 Dec, 2008 02:03:29 Top
santisan james




Posts: 15
Joined: 2008-12-02
Hi Dmitry,

I tried it already your sample code works when UAC is turn off, when UAC is turn on your sample code cant write. same problem as marvin.

Please give us other sample code..

I already read this http://msdn.microsoft.com/en-us/library/ms537319.aspx
but cant find solution to our problem.

I really appreciate your help.

Thank you,
Santisan


Posted 18 Dec, 2008 02:38:31 Top
Dmitry Kostochko


Add-in Express team


Posts: 2865
Joined: 2004-04-05
Hi Marvin and Santisan,

Marvin Biason wrote:
I already used the code and it is good. But nothing happens, it only appeared a msgbox displaying "test".


Please see the code. The code I posted creates my_text_file.txt file, writes the "test" string into the file, opens this file, reads and shows its content.

Marvin Biason wrote:
And it is on C:\Users\swordfish\AppData\Local. When I check it out I see nothing.


Please read the following MSDN article. Please pay attention to the "Saving Files in Protected Mode" paragraph.
http://msdn.microsoft.com/en-us/library/ms537319.aspx

Quotation:
---
"File operations that attempt to write to other locations are intercepted and redirected to a "virtualized" location in a low integrity area."
---

The "virtualized" location n my PC is the following:
C:\Users\USER_NAME\AppData\Local\Microsoft\Windows\Temporary Internet Files\Virtualized\C\Users\USER_NAME\AppData\Local\


Santisan James wrote:
I tried it already your sample code works when UAC is turn off, when UAC is turn on your sample code cant write. same problem as marvin.


Could you please specify what you mean by "cant write"? Do you see an exception?


Posted 18 Dec, 2008 07:59:11 Top
Marvin Biason




Posts: 37
Joined: 2008-12-17
The "virtualized" location n my PC is the following:
C:\Users\USER_NAME\AppData\Local\Microsoft\Windows\Temporary Internet Files\Virtualized\C\Users\USER_NAME\AppData\Local\ [/QUOTE]

I see this code. When I used

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
' file name
Dim fileName As String = System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
fileName = System.IO.Path.Combine(fileName, "my_text_file.txt")
' write to file
Dim stream As System.IO.StreamWriter = System.IO.File.CreateText(fileName)
stream.WriteLine("test")
stream.Flush()
stream.Close()
stream.Dispose()
' read from file
Dim stream2 As System.IO.StreamReader = System.IO.File.OpenText(fileName)
MessageBox.Show(stream2.ReadToEnd())
stream2.Dispose()
End Sub

the error was gone and it does not write anything. I try to locate wat path
it will be and i see that it was on C:\ which it has no error at all. But my question is how can it probably no error but it does not appear any text in that path. I can't see where the code put the text file.Or just the text file was declared hidden?

But for now I'll try to read the article(s) that u gave to me. I am really thankful for the information that u gave to me. Thank u.

Posted 18 Dec, 2008 08:58:22 Top
santisan james




Posts: 15
Joined: 2008-12-02
Hi Dmitry,

Thank you very much for your help our program works properly.

It is a great work.


Thank you,
Santisan
Posted 18 Dec, 2008 09:22:19 Top
Sergey Grischenko


Add-in Express team


Posts: 7228
Joined: 2004-07-05
Hi Marvin and Santisan.

There is another approach to determine the writable location in IE7-8 when the Protected Mode is on. The following example uses the Protected Mode API to get the writable folder.
http://www.add-in-express.com/projects/ieprotectedmodeexample.zip
Posted 18 Dec, 2008 12:15:43 Top
Marvin Biason




Posts: 37
Joined: 2008-12-17
I am using vb.net not C++. By the way thank u for the Information Sergey Grischenko. I'll try to convert it to vb.net code.

Posted 19 Dec, 2008 01:08:52 Top
Sergey Grischenko


Add-in Express team


Posts: 7228
Joined: 2004-07-05
Hi Marvin.

Ok, please let me know if you face any difficulties converting C# code to VB.NET.
Posted 19 Dec, 2008 07:37:54 Top