Mitsubishi Eclipse 3G Club banner
1 - 1 of 1 Posts

·
(b)org banugee
Joined
·
4,549 Posts
Discussion Starter · #1 ·
Question for Windoze developers:

CreateProcess windows not being drawn on default desktop



I have written a service that runs in XP SP2 that needs to spawn processes which will draw GUIs on the default desktop. I do NOT want to make the service interactive, as doing so will break a lot of things that require domain credentials.



ShellExecute spawned the processes just fine, but NOT to the default desktop. They were running, but invisible. I replaced the call to ShellExecute with one to CreateProcess. In so doing, I provided a STARTUPINFO struct whose lpDesktop member I set to "winsta0\\desktop"



The code looks like this:


Code:
STARTUPINFO startupInfo;

PROCESS_INFORMATION procInfo;

ZeroMemory( (void*)&startupInfo, sizeof( startupInfo ) );

ZeroMemory( (void*)&procInfo, sizeof( procInfo ) );


startupInfo.lpDesktop = "winsta0\\default";

startupInfo.cb = sizeof( startupInfo );

 


BOOL result = CreateProcess(

   sFullyQualifiedPath.c_str(),

   NULL,

   NULL,

   NULL,

   FALSE,

   DETACHED_PROCESS,

   NULL,

   m_ConfigPtr->clientRoot().c_str(),

   &startupInfo,

   &procInfo

);

where sFullyQualifiedPath and clientRoot provide the path and working directory for the binary that I am spawning.



The result is that the windows only get partially drawn. They cover whatever else is displayed on the screen at that location with empty space and never draw the contents of the GUI.



Is there something I need to do with STARTUPINFO.dwFlags or STARTUPINFO.wShowWindow that will make them display properly? Incidentally, the GUI components appear to be there, just not drawn. I can click on a button by guessing where it is, and get the desired effect (at least for the button that closes the app).
 
1 - 1 of 1 Posts
Top