Results 1 to 6 of 6

Thread: [RESOLVED] RunAsAdmin just Once?

  1. #1

    Thread Starter
    Registered User
    Join Date
    Dec 2016
    Location
    Australia
    Posts
    56

    Resolved [RESOLVED] RunAsAdmin just Once?

    Hi there,
    Steve MacMahon's reg code runs beautifully if the app is run as admin.
    If not, the reg keys cannot be opened (at least in W10 1607). Thing is, the app is set up to run as invoked, but it would be nice if it could be run as admin just once initially to set the keys.
    Don't think that is possible somehow but any ideas / suggestions / code welcome.
    Thanks!

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: RunAsAdmin just Once?

    Just create an installer and be done with it.

  3. #3
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,625

    Re: RunAsAdmin just Once?

    You could also create and execute a shortcut to run your app elevated, then execute that.

    A smooth implementation might be a little tricky... check access, no, write and execute shortcut with command indicating so, if thats the case write keys, exit this instance or kill other instance (if former must wait for execution).

    dilettante's suggest is of course better, but I share your antipathy towards installers, having never come across an install creator that allows a large variety of customizations but isn't ridiculously hard to use, leaving rolling my own or just doing without as the better options.

  4. #4
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,042

    Re: RunAsAdmin just Once?

    [...]
    Last edited by dz32; Apr 26th, 2019 at 11:34 AM.

  5. #5
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,625

    Re: RunAsAdmin just Once?

    Oh wow brain fart on that one. Do dz32's method instead unless you just have as much fun as I do playing with shell interfaces. You still need the kind of implementation I was talking about for your Sub Main, but can just use a shellexecuteex api call instead of a shortcut.

  6. #6

    Thread Starter
    Registered User
    Join Date
    Dec 2016
    Location
    Australia
    Posts
    56

    Re: RunAsAdmin just Once?

    Thanks, that's the kind of thing sought for.
    Although nothing beats a good installer. there's a few around- Wix, for one appeals- has anyone any experience of InstallForge, Smart Install, the Install Creator (no price on the commercial version), the Visual installer, for instance?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width