Hmm, vaguely remember doing this through the API more than 15+ years ago from a VFP app, but I did not take that code with me when I left as my work was ""owned" by my employer. I know it can be done, but I don't remember the details.
Fred On Wed, Oct 28, 2020 at 2:09 AM Alan Bourke <alanpbou...@fastmail.fm> wrote: > > There's no way to elevate an already running process, so you have to > encapsulate that in a separate EXE and run that with elevated permissions. > > This could be as simple as creating a batch file and in there use the > 'runas' command. > > runas /noprofile /user:mymachine\administrator myexe.exe > > Then run the batch file from your main VFP executable. > > The problem with this is that it's inelegant and prone to prompting for > credentials. > > You could try doing it in VFP code using the Windows API: > > Download the Win32API project from https://github.com/VFPX/Win32API > > Extract somewhere and run apiviewer.exe > > Search for 'how to start a process as another user' > > That should display a VFP program illustrating how to leverage the Windows > API to do it. And you're in a world where you now have to worry about the > password being stored in plaintext in your program :) > > > > > -- > Alan Bourke > alanpbourke (at) fastmail (dot) fm > > On Tue, 27 Oct 2020, at 10:44 PM, Fred Taylor wrote: > > Anybody have a way to change the user while an app is running so I can > > access a protected folder? Haven't done much Windows API in quite some > > time. > > > > > > Fred > > > > > > --- StripMime Report -- processed MIME parts --- > > multipart/alternative > > text/plain (text body -- kept) > > text/html > > --- > > [excessive quoting removed by server] _______________________________________________ Post Messages to: ProFox@leafe.com Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: https://leafe.com/archives This message: https://leafe.com/archives/byMID/cajcbksp0gm_skhqfr9w0ndydn5-argaa9xhvzbkmwbukcq_...@mail.gmail.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.