Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / .NET SDK / December 2003

Tip: Looking for answers? Try searching our database.

STILL_ACTIVE problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tony - 29 Dec 2003 03:46 GMT
I recently have my program suddenly got a problem. My program needs to
spawn a process of XCOPY and then waits for it to terminate. The code
like this:
---------
STARTUPINFO si = {0};
si.cb = sizeof(STARTUPINFO);
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;
PROCESS_INFORMATION pi = {0};

CString str = "cmd /c XCOPY .....";

if (::CreateProcess(NULL, (LPSTR)(LPCSTR)str, NULL, NULL, FALSE,
    NORMAL_PRIORITY_CLASS|CREATE_NO_WINDOW, NULL, lpszPath, &si, &pi))
{
    switch (::WaitForSingleObject(pi.hProcess, 3600000))
    {
    case WAIT_OBJECT_0:
        {
            DWORD dwRet;
            if (::GetExitCodeProcess(pi.hProcess, &dwRet))
            {
                ...
            }
        }
        break;
    case WAIT_TIMEOUT:
        ...
        break;
    default:
        break;
    }
    ::CloseHandle(pi.hProcess);
}
------
The problem is:

"SOMETIMES", the dwRet from GetExitCodeProcess will be
STILL_ACTIVE(259). However, I found that the XCOPY command had been
successfully copied the files and the cmd prompt had been closed. The
problem happened randomly.

The problem happened recently.

Thanks in advance.

- tony.
Mattias Sj?gren - 29 Dec 2003 19:47 GMT
Tony,

I don't see how this is .NET related. I suggest you repost to the
appropriate group in the microsoft.public.win32.programmer.* or
microsoft.public.platformsdk.* hierarchy.

Mattias

Signature

Mattias Sjögren [MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.