Click here to Skip to main content
14,768,076 members
Home » Discussions » C#
   

C#

 
GeneralRe: WMI Pin
Luc Pattyn16-Jun-09 5:31
sitebuilderLuc Pattyn16-Jun-09 5:31 
QuestionMicrosoft.Office.Interop.Excel problem Pin
michaelgr116-Jun-09 4:07
Membermichaelgr116-Jun-09 4:07 
AnswerRe: Microsoft.Office.Interop.Excel problem Pin
stancrm16-Jun-09 4:28
Memberstancrm16-Jun-09 4:28 
GeneralRe: Microsoft.Office.Interop.Excel problem Pin
michaelgr116-Jun-09 5:36
Membermichaelgr116-Jun-09 5:36 
GeneralRe: Microsoft.Office.Interop.Excel problem Pin
michaelgr116-Jun-09 7:58
Membermichaelgr116-Jun-09 7:58 
GeneralRe: Microsoft.Office.Interop.Excel problem Pin
MumbleB16-Jun-09 8:55
MemberMumbleB16-Jun-09 8:55 
GeneralRe: Microsoft.Office.Interop.Excel problem Pin
michaelgr117-Jun-09 7:45
Membermichaelgr117-Jun-09 7:45 
QuestionInstalling fonts on a Vista Pc Pin
Okultist16-Jun-09 2:55
MemberOkultist16-Jun-09 2:55 
I want to copy a font file to the fonts directory on windows vista, but currently i fail to get the right permissions.
Everytime I try to copy the font from its current folder to the font-directory (c:\windows\fonts) I get an "UnauthorisedAccessException"

My code looks like this at the moment:

            if (System.IO.File.Exists(fontPath))
            {
                FileIOPermission f2 = new FileIOPermission(FileIOPermissionAccess.Read | FileIOPermissionAccess.Write, "C:\\Windows\\Fonts\\");
                f2.AddPathList(FileIOPermissionAccess.Read | FileIOPermissionAccess.Write, fontPath);

                if (SecurityManager.IsGranted(f2) == true)
                    MessageBox.Show("Its fine!!");
                else
                    MessageBox.Show("No Permissions");

                try
                {
                    f2.Demand();
                    MessageBox.Show(fontPath);
                    System.IO.File.Copy(fontPath, destination);
                    //AddFontResource(fontPath);
                    //SendMessage(HWND_BROADCAST, WM_FONTCHANGE, (IntPtr)0, (IntPtr)0);

                }
                catch (SecurityException se)
                {
                    MessageBox.Show(se.ToString());
                }
                catch (UnauthorizedAccessException ex)
                {
                    MessageBox.Show(ex.ToString());
                }

            }
<pre>

Thanks for your help

AnswerRe: Installing fonts on a Vista Pc Pin
lw@zi 16-Jun-09 3:24
professional lw@zi 16-Jun-09 3:24 
GeneralRe: Installing fonts on a Vista Pc Pin
Luc Pattyn16-Jun-09 3:54
sitebuilderLuc Pattyn16-Jun-09 3:54 
GeneralRe: Installing fonts on a Vista Pc Pin
lw@zi 16-Jun-09 4:35
professional lw@zi 16-Jun-09 4:35 
GeneralRe: Installing fonts on a Vista Pc Pin
Okultist16-Jun-09 4:43
MemberOkultist16-Jun-09 4:43 
GeneralRe: Installing fonts on a Vista Pc Pin
lw@zi 16-Jun-09 6:25
professional lw@zi 16-Jun-09 6:25 
GeneralRe: Installing fonts on a Vista Pc Pin
Okultist16-Jun-09 4:40
MemberOkultist16-Jun-09 4:40 
AnswerRe: Installing fonts on a Vista Pc Pin
Okultist17-Jun-09 3:46
MemberOkultist17-Jun-09 3:46 
QuestionState Maintenance Pin
ashajahanmca16-Jun-09 2:44
Memberashajahanmca16-Jun-09 2:44 
AnswerRe: State Maintenance Pin
Michael Bookatz16-Jun-09 2:50
MemberMichael Bookatz16-Jun-09 2:50 
AnswerRe: State Maintenance Pin
Henry Minute16-Jun-09 2:54
MemberHenry Minute16-Jun-09 2:54 
AnswerRe: State Maintenance Pin
himanshu256116-Jun-09 3:01
Memberhimanshu256116-Jun-09 3:01 
GeneralRe: State Maintenance Pin
Henry Minute16-Jun-09 5:39
MemberHenry Minute16-Jun-09 5:39 
Questionhow to access javascript using c# Pin
svt gdwl16-Jun-09 2:19
Membersvt gdwl16-Jun-09 2:19 
Questionweb services Pin
harispa16-Jun-09 2:05
Memberharispa16-Jun-09 2:05 
AnswerRe: web services Pin
Baran M16-Jun-09 2:23
MemberBaran M16-Jun-09 2:23 
AnswerRe: web services Pin
Tom Deketelaere16-Jun-09 2:24
professionalTom Deketelaere16-Jun-09 2:24 
QuestionProblem with while loop and text file Pin
kallileo16-Jun-09 1:56
Memberkallileo16-Jun-09 1:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.