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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CreateWindow

Status
Not open for further replies.

Pyramus

Programmer
Dec 19, 2001
237
GB
I've got a program running in a particular user process. This user is not the same as the logged in user.

I am calling CreateWindow in this process and it's not being displayed, despite the call succeeding. My guess is that it is being displayed but on the desktop of the other process.

Can anyone confirm this? Is there a way to get it to display on the logged on users desktop?
 
It is so, if the window is OK.
There are some functions You can use to change process context:

ImpersonateSelf(SecurityImpersonation);
HWINSTA hwinstaUser = OpenWindowStation("WinSta0", FALSE, MAXIMUM_ALLOWED);
if (hwinstaUser == NULL)
{
RevertToSelf();
}
else
SetProcessWindowStation(hwinstaUser);
HDESK hdeskUser = OpenDesktop("Default", 0, FALSE, MAXIMUM_ALLOWED);
SetThreadDesktop(hdeskUser);

Default and WinSta0 used for currently logged user.
 
Thanks- I have managed to create the window and it shows on the desktop- but it just says "not Responding"- any ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top