Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Must I use CreateProcessAsUser?

Status
Not open for further replies.

caudet

Programmer
Oct 2, 2003
15
CA
Hi,

I'm using CreateProcess to start a c# application from a c++ MFC dll. The c# application is a report tool functionning with crystal report and the mfc dll monitor keypress. When a certain sequence of key is pressed a report is supposed to be printed.

Everything is working fine except when I try to execute the c# app. from the dll. When the c# application try to connect to the SQL database it alway receive this error:

System.Data.SqlClient.SqlException: Invalid connection.
at System.Data.SqlClient.SqlConnection.Open()
at (...)

When I execute my c# app. manually(not from the dll) everything is working fine. So I was wondering if I must use CreateProcessAsUser() instead of CreateProcess() to give the c# app. specific right, and if yes, how do I do this, I have some problem giving the correct access right the hToken argument of CreateProcessAsUser().

Any help would be appreciated:) Thanks!

Charles
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top