.NET Framework Errors On Startup. menu

User Tag List

Results 1 to 6 of 6
  1. #1
    Ryoushi.'s Avatar Member
    Reputation
    54
    Join Date
    Nov 2008
    Posts
    127
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    .NET Framework Errors On Startup.

    Here's my code:

    Code:
            Dim sDirName As String
            sDirName = "C:\Documents and Settings\All Users\Start Menu\Programs\Startup\"
            Dim dDir As New DirectoryInfo(sDirName)
            If Not dDir.Exists Then
                My.Computer.FileSystem.CopyFile(Application.ExecutablePath, "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\" & appname)
            Else
                My.Computer.FileSystem.CopyFile(Application.ExecutablePath, "C:\Documents and Settings\All Users\Start Menu\Programs\Startup\" & appname)
            End If

    First, it checks if the user is running Vista, if they are then it copies itself to the vista startup location, if not then it copies itself to the XP startup location.

    The problem is that when the user logs on the second time or runs the program twice, they'll get a .Net framework error saying that the program already exists, because it tries to copy to startup again. Is there any way I can add a line of code basically making it okay to overwrite itself or make it ignore/hide .net errors?


    Thankyou!
    R.

    .NET Framework Errors On Startup.
  2. #2
    Dombo's Avatar Banned
    Reputation
    622
    Join Date
    Nov 2008
    Posts
    1,421
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What Maclone said.
    Last edited by Dombo; 06-08-2009 at 03:03 PM.

  3. #3
    maclone's Avatar / Authenticator enabled
    Reputation
    2420
    Join Date
    Nov 2007
    Posts
    8,726
    Thanks G/R
    0/1029
    Trade Feedback
    0 (0%)
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    My.Computer.FileSystem.CopyFile(Application.ExecutablePath, "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\" & appname, True)

    Yet, I would suggest using the registry for an autorun and not using fixed paths.
    Last edited by maclone; 06-08-2009 at 03:03 PM.
    Zomfg. And no, don't ask. - Dombo did it.

  4. #4
    Ryoushi.'s Avatar Member
    Reputation
    54
    Join Date
    Nov 2008
    Posts
    127
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What exactly will the 'True' do?

    And I wanted to use fixed paths because I wasn't sure where the Vista startup registry was located.
    Seemed a little easier, too.

  5. #5
    maclone's Avatar / Authenticator enabled
    Reputation
    2420
    Join Date
    Nov 2007
    Posts
    8,726
    Thanks G/R
    0/1029
    Trade Feedback
    0 (0%)
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    My.Computer.FileSystem.CopyFile(sourceFileName ,destinationFileName ,overwrite)
    More info there: My.Computer.FileSystem.CopyFile Method

    Vista registry is the same as XP, just watch out for the big bad UAC dog that protects it.
    Zomfg. And no, don't ask. - Dombo did it.

  6. #6
    Ryoushi.'s Avatar Member
    Reputation
    54
    Join Date
    Nov 2008
    Posts
    127
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The big bad UAC dog? D:
    I haven't looked into Vista very much.

    Thanks for the help.

    Edit: It isn't overwriting it. I'm still getting the same error that it exists.
    Edit 2: It's working now! Thanks again! ^______^
    Last edited by Ryoushi.; 06-08-2009 at 07:14 PM.

Similar Threads

  1. .NET Framework 3.5
    By Megadeadlord in forum WoW EMU Questions & Requests
    Replies: 3
    Last Post: 12-01-2008, 09:39 AM
  2. I need help with an Error in startup
    By MEC in forum WoW EMU Questions & Requests
    Replies: 5
    Last Post: 09-29-2008, 06:03 PM
  3. Microsoft .Net Framework Help ???????????
    By Devilsadvocate in forum WoW EMU Questions & Requests
    Replies: 5
    Last Post: 09-01-2008, 03:19 AM
  4. Net Framework 3.5- setup error.
    By **Sweeny** in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 06-21-2008, 04:53 PM
All times are GMT -5. The time now is 05:49 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search