Skip to content
Home > Programming > Programming and Requiring Admin Rights [VB2010]

Programming and Requiring Admin Rights [VB2010]

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #190247
    autopilot
    Member

    A lot of the API calls used to interact with the PalTalk client have been restricted on Windows Vista/7. In order to use the restricted API calls, you must run your application as Administrator. To debug code that includes these restricted APIs, you must start your VB with elevated rights. To do this, right click on your VB program and select the Run As Administrator.

    StartVB

    #190256
    autopilot
    Member

    Now that you can debug your code and know that it works, you do not want to make your users have to right click and run as admin every time they start your application, so we can set it to require Admin rights before we compile it. To do this, you go to the project properties window and select “View Windows Settings”.
    Properties

    #190255
    autopilot
    Member

    In the Windows Settings, you will follow the directions and change it to “requireAdministrator”.
    RequireAdmin

    Now when you compile your app, the resulting icon will have the shield on it to denote that it requires administrative rights to run.

    #190254
    Admin
    Administrator

    Thanks man, i just did this on the Paltalk Bot. One question thou. It seems that the permission is needed only for the text file saving if I install the text files in the user folder. Will the bot work properly or will it have issues connecting to paltalk and stuff since I will take the admin right needed thing off? So users don’t get the message every time the user opens the program.
    Thanks

    #190253
    autopilot
    Member

    There are a long list of things that require running with elevated permissions. One of those things is to write to any file in the Program Files directory (or sub folders). If you store your application data to the AppData location, you do not need elevated permissions.

    But, since the API to interact with the Nic list writes to another applications memory, I believe that you still need the elevated permissions to interact with the nic list.

    Play with it and see.

    #190252
    Admin
    Administrator

    k, so I tried installing it on C:ProgramDataPaltalk Bot and still got the damn access denied so i end it up installing it on C:imFilesPaltalk Bot without any admin privilege and its working great 🙂 and the redot and bounce is working fine, the bot still selecting the nicks 🙂

    #190251
    Admin
    Administrator

    I change it again, end up installing in LocalApplicationData 🙂 works great

    #190250
    autopilot
    Member

    Normally, you still install the Application into Program Files, but put the data files (that your app writes to) into the CommonAppData location.

    Dim sDataPath As String = IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), Application.CompanyName, Application.ProductName)
    Dim sAdminList As String = IO.Path.Combine(sDataPath, "Admin.txt")
    #190249
    Admin
    Administrator

    I did install everything besides the text files in Program Files the issue I was having is when I install the text files in

    Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)

    I still was getting acces denied, but when I install it on

    Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)

    it work 🙂 But only works on the user login, if you tried to use the bot in another user of the pc the files are not foud 🙄

    #190248
    AhFox
    Member

    Use the manifest file method … that should solve your issue.

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.