CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2006
    Posts
    28

    How to execute 16 bit process via CreateProcess

    Hi Everyone,

    I am unable to execute a 16 bit process from 32 bit process via CreateProcess. I am getting this error

    'Error while setting up environment for the application. Choose Close to terminate the application.'

    Here is my code

    STARTUPINFO si;
    memset( &si, 0, sizeof(STARTUPINFO) );
    ::GetStartupInfo( &si );

    PROCESS_INFORMATION pi;


    BOOL bRet = ::CreateProcess( NULL,
    "C:\\ZTOOLS\\ZIMAGLIT.EXE Untitled.pcx Untitled.grf Untitled.GRF",
    NULL,
    NULL,
    TRUE,
    CREATE_NO_WINDOW|CREATE_SEPARATE_WOW_VDM,
    ::GetEnvironmentStrings(),
    "C:\\ZTOOLS",
    &si,
    &pi );

    Also here, I need to set the current directory to the one where the 16 bit process resides. In this case, I set it to "C:\Ztools".

    I need to run the process through this function only because the process generates some files which I had to read when the process terminates. And only this function returns the new process handle which can be used to wait for its termination.

    Thanks in advance.

    Regards.

  2. #2
    Join Date
    Sep 2004
    Posts
    1,361

    Re: How to execute 16 bit process via CreateProcess

    What OS are you using? If it is Vista or later, you can say goodbye to 16 bit applications. They removed the 16 bit sub-system.

  3. #3
    Join Date
    Jan 2006
    Posts
    28

    Re: How to execute 16 bit process via CreateProcess

    No. It is Windows XP

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: How to execute 16 bit process via CreateProcess

    Does the following run from the command line?

    Code:
    C:\>C:\ZTOOLS\ZIMAGLIT.EXE Untitled.pcx Untitled.grf Untitled.GRF
    If not, what are the errors?

  5. #5
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    894

    Re: How to execute 16 bit process via CreateProcess


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured