How to show "Run as" Dialog from MFC application

Hi,

I have a SDI MFC application. I need to do the following:

When I run the MFC application for a non-admin user in Windows XP by 
clicking on the executable, I need the application to pop - up the "Run as 
following user" dialog.

And, if the credentials are right the application thread should run under 
administrative privileges.

In short, I want the behaviour to be same as doing a right click on the .exe 
and selecting Run As option.

Please Help!!

Regards,
Susanna
0
susanna (39)
1/25/2008 8:49:01 AM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
323 Views

Similar Articles

[PageSpeed] 33

See if the following link helps you

            http://tinyurl.com/33l6lt

Cheers
Check Abdoul
---------------------

"Susanna" <Susanna@discussions.microsoft.com> wrote in message 
news:E6891FF1-9EF9-4229-BE73-6B4A05FFD322@microsoft.com...
> Hi,
>
> I have a SDI MFC application. I need to do the following:
>
> When I run the MFC application for a non-admin user in Windows XP by
> clicking on the executable, I need the application to pop - up the "Run as
> following user" dialog.
>
> And, if the credentials are right the application thread should run under
> administrative privileges.
>
> In short, I want the behaviour to be same as doing a right click on the 
> .exe
> and selecting Run As option.
>
> Please Help!!
>
> Regards,
> Susanna 


0
Check
1/25/2008 1:24:36 PM
Hi,

I am now able to show "Run as " dialog from my MFC application when the 
application starts in a non-admin environment.

But the problem now is :
If the "Current user" radio button is selected in "Run as " dialog and "ok" 
is clicked, then the application throws a file not found error.

My requirement is: 
If the "Current user" radio button is selected in "Run as " dialog and "ok" 
is clicked, then the application should show a user message and not an error.

"Check Abdoul" wrote:

> See if the following link helps you
> 
>             http://tinyurl.com/33l6lt
> 
> Cheers
> Check Abdoul
> ---------------------
> 
> "Susanna" <Susanna@discussions.microsoft.com> wrote in message 
> news:E6891FF1-9EF9-4229-BE73-6B4A05FFD322@microsoft.com...
> > Hi,
> >
> > I have a SDI MFC application. I need to do the following:
> >
> > When I run the MFC application for a non-admin user in Windows XP by
> > clicking on the executable, I need the application to pop - up the "Run as
> > following user" dialog.
> >
> > And, if the credentials are right the application thread should run under
> > administrative privileges.
> >
> > In short, I want the behaviour to be same as doing a right click on the 
> > .exe
> > and selecting Run As option.
> >
> > Please Help!!
> >
> > Regards,
> > Susanna 
> 
> 
> 
0
susanna (39)
1/29/2008 11:57:01 AM
Try setting

            sei.nShow = SW_SHOW;

  and also make sure the non-admin user has access to the path where your 
application is located.

Cheers
Check Abdoul
---------------------

"Susanna" <Susanna@discussions.microsoft.com> wrote in message 
news:23B045DD-78B8-4447-BEDF-8E6BA13254A4@microsoft.com...
> Hi,
>
> I am now able to show "Run as " dialog from my MFC application when the
> application starts in a non-admin environment.
>
> But the problem now is :
> If the "Current user" radio button is selected in "Run as " dialog and 
> "ok"
> is clicked, then the application throws a file not found error.
>
> My requirement is:
> If the "Current user" radio button is selected in "Run as " dialog and 
> "ok"
> is clicked, then the application should show a user message and not an 
> error.
>
> "Check Abdoul" wrote:
>
>> See if the following link helps you
>>
>>             http://tinyurl.com/33l6lt
>>
>> Cheers
>> Check Abdoul
>> ---------------------
>>
>> "Susanna" <Susanna@discussions.microsoft.com> wrote in message
>> news:E6891FF1-9EF9-4229-BE73-6B4A05FFD322@microsoft.com...
>> > Hi,
>> >
>> > I have a SDI MFC application. I need to do the following:
>> >
>> > When I run the MFC application for a non-admin user in Windows XP by
>> > clicking on the executable, I need the application to pop - up the "Run 
>> > as
>> > following user" dialog.
>> >
>> > And, if the credentials are right the application thread should run 
>> > under
>> > administrative privileges.
>> >
>> > In short, I want the behaviour to be same as doing a right click on the
>> > .exe
>> > and selecting Run As option.
>> >
>> > Please Help!!
>> >
>> > Regards,
>> > Susanna
>>
>>
>> 


0
Check
1/29/2008 1:35:57 PM
Reply:

Similar Artilces:

MDI application run as a Child window
Hi, I do have a MDI application working properly. I have to include this into a plugin that would be loaded by a second application. In the second application my MDI application should run properly. Does somebody have any ideea where is the beginning? Any link is welcome! I have tried to include the MDI app into a dll and ocx with no success. TIA, Valentin What you want to do is not what MFC doc/view apps were designed for. You are probably looking for some sort of ActiveX control. Its been a while since I did this, but you could have a MFC app inside another container (DocObjectCont...

run as aministrator
I have downloaded Office 2010 Beta successfully and am running on all profile accounts. I am trying to open a calendar from another computer. I can only open it when I am logged on as the administrator. It will not let me open the file from the generic profile. I have right clicked on the icon looking for the "run as" command and it is not there. There must be a Windows setting that needs to be changed. I tried to set the permission in the Windows XP "Secondary Logon Service" and the setup type is already set to "Automatic". I want to be a...

Make HQ Client and HQ Server run as a service
Currently these are just applications that run. Having them run as a service makes them more managable and stable. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/Businesssolutions/Community/NewsGroups/dgbrowser/en-us/default.mspx?mid=5a3651d9...

After Money Plus SP1 on Vista why must I "run as administrator?"
After the Money Plus update, I now will get a "money stopped working" whenever I select portfolio or any of the 1st 4 help items. This occurs when opening my money file or the sample file. If I right-click and select "run as administrator" when I start money, everything seems to work ok on both my money file and the sample file. How do I return to normal start without having to "run as adminstrator?" I am the only user of this Vista Ultimate PC. If this is hard to fix, I have the ability to easily reload my harddrive from a backup and return my compute...

CAsyncsocket derived class being run as a thread
Hi all, At present, I have a gui driven application; once the user has provided some input, an object derived from CAsyncsocket is created and run, listening for UDP datagrams. It works fine, but because of network traffic (and the fact it writes to a database), some UDP packets are being dropped, and we are trying to minimise this. One suggestion was to run the listener object as a thread, running independantly of anything the user does ... but isn't this what an AsyncSocket object does anyway? Whats the difference? And if there is one, do you think running an Asyncsocket object in such...

Make outlook run as if its the first time
Hello How do I make outlook run as if it is the first time? I messed with the settings... pleaseeeeeeee help! Guy >How do I make outlook run as if it is the first time? >I messed with the settings... pleaseeeeeeee help! Uninstall it and reinstall it. What settings did you change that no longer meet your requirements? Why not simply change them back? -- Brian Tillman Smiths Aerospace 3290 Patterson Ave. SE, MS 1B3 Grand Rapids, MI 49512-1991 Brian.Tillman is the name, smiths-aerospace.com is the domain. I don't speak for Smiths, and Smiths doesn't speak for me. "Br...

run as a service
I want to develop one MFC Application which will run as a service and should be displayed in a system tray icon....I dont know to do this....... If there any way to get the code...........Plz..........help me.................. Hello Sanju, 1) You want it to be a service or just to be visible in the tray icon area? 2) Where are you stuck, try to define your problem so that you can get help. 3) Try www.codeproject.com for libraries and articles about services and tray icons. -- Elias "Sanju" <mnair.lekshmi@gmail.com> wrote in message news:1166009681.923129.3860@16g2000cw...

How to show "Run as" Dialog from MFC application
Hi, I have a SDI MFC application. I need to do the following: When I run the MFC application for a non-admin user in Windows XP by clicking on the executable, I need the application to pop - up the "Run as following user" dialog. And, if the credentials are right the application thread should run under administrative privileges. In short, I want the behaviour to be same as doing a right click on the .exe and selecting Run As option. Please Help!! Regards, Susanna See if the following link helps you http://tinyurl.com/33l6lt Cheers Check Abdoul ---------------...

IE 8 will only work when I right click then click "run as administ
Any ideas? I've uninstalled/reinstalled IE 8; did not work. Maybe buy a mac next time? swgross wrote: > ... Maybe buy a mac next time? Why wait until next time? You can run numerous variants of Linux on your host now. Then you'll be visiting the Linux groups instead of here. Just another vaporous threat as if we users here in Usenet would care. Try this: http://support.microsoft.com/kb/555375 --- Leonard Grey Errare humanum est swgross wrote: > Any ideas? I've uninstalled/reinstalled IE 8; did not work. Maybe buy a mac > next time? Maybe...

error in report only when run as a subreport
I have two reports that are identical except for the underlying query. the reports show mvoement information but each report shows a different direction. I put each of these directional reports in a third report to display the directions side by side. When run individually the directional reports execute fine. When run as subreports I get divide by zero errors in a section footer of the subreports. The error does not occur when run as a stand-alone report. Any help would be appreciated. Thank you in advance for any help. -- Message posted via http://www.accessmonster.com ...

can only run as administrator
Installed Publisher 2000 to W2K client. Will run correctly if logged on as administrator but not as standard user. Is there a way to resolve this other than making users power users or administrators on client machine. My understanding is that Publisher doesn't really like to be run on a network. -- JoAnn Do not meddle in the affairs of cats, for they are subtle and will piss on your computer. --Bruce Graham "network41" <support@merchiston.co.uk> wrote in message news:dabb01c3efd1$92f2e0e0$a001280a@phx.gbl... > Installed Publisher 2000 to W2K client. Will run c...

How can I show a dialog box "Run As Other User" under Windows2000?
How can I show a dialog box "Run As Other User" under Windows2000? do this programmatically "Marco" <sorry@nomail.com> д���ʼ� news:eVZfAcFqDHA.688@TK2MSFTNGP10.phx.gbl... > How can I show a dialog box "Run As Other User" under Windows2000? > > ...

Is program being run as administrator
I have not been on here for a long time, but I would appreciate it if anyone could advise:- 1. Is it possible to check if a VB6 program is being 'Run as Administrator' alternatively 2. Is it possible to force the program to run with Administrator's rights? If so, how? -- Regards, Mike Simpson Penrith, NSW, Australia Manifest file. It was discussed recently...several times. Look it up, or Google it. -- 2025 If you do not believe in time travel, your beliefs are about to be tempered. http://www.facebook.com/group.php?gid=43606237254 "Mike ...

Run as...
We have multiple users on job and I start Outlook express from other users account with help of "Run as..." command.After that I lost all my mails from inbox. Can you help me? Ask in an Outlook Express forum. This is an Microsoft Office Outlook forum. Outlook Express is family of Internet Explorer and Outlook of the Office family. Here is the link for the right forum http://communities.microsoft.com/newsgroups/default.asp?icp=InternetExplorer Good Luck! -- Robert Sparnaaij [MVP-Outlook] www.howto-outlook.com Tips of the month: -What do the Outlook Icons Mean? -Create an Off...

Run as
In version 3.0 of CRM you could launch the browser as a different user i.e. Support. Does this still function in version 4.0? Reason we are currently running version 3.0 on the MS Action Pack and want to upgrade but MS have downgraded the number of CALs that we can use :-( We have 4 support people who can "run as" and use filter views for their cases which will get us around the license constraints. Thanks M Hi Mark, You can setup IE to prompt for enter user name and password everytime you access CRM. To set it up. go under Tools | Security | User Authentication | Check Promp...

Run as a transaction?
Hi Periodically I upload a table "tblLanguageValues" from my laptop to our hosted SQL 2005 server in Florida. It has 65,000 rows so takes about 30 minutes. During that time our website goes down because each page uses that table to fetch text items. Once the upload is complete all is well with it. I create a script locally using the "Database Publishing Wizard" to script that one table only and save it to a file "1.SQL". Then I open the remote database via SQL Server Management Studio Express and run the script. Can I do the whole thing as a ...

frxpdfsvr.exe run as service
For FRX web portal, the process frxpdfsvr.exe should run as a service. It should not require that server consoles are left logged in for it to run. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/Businesssolutions/Community/NewsGroups/dgbrowse...

Setting HQ Client to run as a service.
Hi, Does any body know how they might run HQ Client as a service in the background rather than having the application running? -- Regards, datapac_bs If you are a Microsoft Partner, search the knowledge base for the article id 921200. If you are not a Partner you will have to contact yours. If you are without a partner I'm sure most of the people on this forum, including ourselves, would be happy to help. -- Thank you, Ryan Sakry Program Manager Retail Information Technology Enterprises (RITE) rsakry@rite.us http://www.rite.us 320-230-2282 ext. 4002 (Office) 320-230-1796 (Fax)...

Can Access 2007 be Run as Admistrator
Using Vista: have launched an .adp project created at another site on another computer, using the SQL Server at that site. Now, from home, I want to change the data source to the local SQL Server database on my PC here at home. So, I entered the local SQL Server name in the Data Link Properties dialog box, and pressed the Test Connection button. Getting an error message: "Test connection failed because of an error in initializing provider. Login failed for user 'SLINDEED\(My name). If I cannot run as Administrator or change the server name, Catch 22? Thanks, Dean S &q...

How an MFC Application can run as an service displayed in system tray and even this icon can be displayed on different login
Hi, I want to develop one MFC Application which will run as a service and should be displayed in a system tray icon.Since this Application is a service it will keep running.so when i login through different user this icon should be displayed there in the system tray. I was partially successful in creating the MFC as a service and displaying an icon,but if i do a log-off and log-in through different account i can see the service is running in background but there is no icon in system tray.Could any one help me in resolving this issuse. Is there any API which i need to include in my code or j...

How do I close Outlook completely (continues to run as a process)?
I have Outlook 2003 and have set it up with 3 user profiles. When I close Outlook to go to another user profile, Outlook closes but continues to run (?) as noted by both the Outlook icon in the tray and the "Outlook" process listing which appears under the "Processes" tab in the Windows Task Manager (which I get with a CNTL + ALT + DEL. This is a standalone installation and does not use Windows Exchange Server or any other add ins. So you have nothing configured that hooks into or integrates with Outlook such as synch software for a handheld, antivirus, Skyp...

Right click Context Menu
2007 Home & Student Office. Vista Home Premium SP2 Just wonder why is it that right clicking on any Office program will not have Run As Admin in the Context Menu. IF I right click on the program > Properties > Shortcut tab > Advanced. The box in front of Run As Admin is grayed out. Any reasons why. It is not a problem. Just want to know. Thank you. t-4-2 ...

SBS 2008 "Run as Admin" Missing
Help!!!! I think I'm going bonkers here... I'm just trying to add a 32 bit printer to my SBS 2008 server... I'm sure when I set this server up I worked out this right click on the ADD PRINTER and select "Run as Administrator" to elevate the level of the install... I'm logged in as the Admin and run up Control Panel and right click on the ADD PRINTER and there are NO options to "Run as Administrator"..?, where have they all gone...?, I've tried everything, can any one help me...? Something must have got turned off here..., but I'...

MS Office 2008: Must run as an Admin User?
I am currently running the Microsoft Office 2004 Test Drive on my new 24in iMac. I have three users on my machine. One has Administrator privileges the other two do not. When I activated the Office 2004 Test Drive, and then tried to open Microsoft Word using one of the two non- Admin users I got an error that said that Office Test Drive must be run by an administrator. I plan to buy Microsoft Office 2008 Home and Student edition when it comes out Jan 15. What I would like to know is the requirement to run Office 2004 Test Drive as an admin user limited to that Test Drive version? In other wor...

windows server 2008 run as 2003 functional mode, how to use a 2003 server as AD
I use windows server 2008 and formatted it as 2003 functional server mode and run active directory domain and then I use another windows server 2003 join into the forest as another active directory domain but they cannot replicate would any one tell me why? how to make them syn? On Jun 7, 3:32=A0pm, "News" <n...@likl.com> wrote: > I use windows server 2008 and formatted it as 2003 functional server mode > and run > active directory domain > > and then I use another windows server 2003 join into the forest as anothe= r > active dir...