Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Run another program within a PocketPC 2002 program

RHARHA Member Posts: 1
I want to run a program (an ftp application .exe) within a PocketPC 2002 program running on an iPAQ. A simple .bat would be great if PPC2002 allowed it. I've had a look at using the CreateProcess function within EmbeddedVisualC++ and think that this might do, but need serious help to write a program using it. Any help would be appreciated.

Comments

  • stoberstober Member Posts: 9,765 ✭✭✭
    : I want to run a program (an ftp application .exe) within a PocketPC 2002 program running on an iPAQ. A simple .bat would be great if PPC2002 allowed it. I've had a look at using the CreateProcess function within EmbeddedVisualC++ and think that this might do, but need serious help to write a program using it. Any help would be appreciated.
    :

    CreateProcess() works ok -- I use it often to launch one application from another. MSDN makes it look awful but,in WinCE, most of the parameters are 0 because they aren't used.

    Here is a function I wrote a long time ago for eVC++ 3.0 compiler in ProcketPC 2002 device
    [code]

    int CAitProcess::CreateProcess(CString& Executable, CString& AppTitle, CString strArgList)
    {
    int rval = 0;
    PROCESS_INFORMATION pi;
    CString Environment;

    if ((rval = ::CreateProcess(Executable,strArgList,NULL,NULL,
    FALSE,CREATE_NEW_CONSOLE,NULL,NULL,NULL,&pi)) == 0)
    {
    CString msg;
    CString str;
    str.LoadString(IDS_CONFAILED);
    msg.Format(str,m_Executable);
    MessageBox(NULL,msg,AppTitle, MB_OK | MB_ICONSTOP | MB_TOPMOST);
    }
    else
    {
    MSG msg;
    // process all messages sent to this thread's message queue
    // while the other proces has input focus
    HANDLE handles[1];
    handles[0] = pi.hProcess;
    while(TRUE)
    {
    DWORD dwReturn = MsgWaitForMultipleObjects(1, handles, FALSE, INFINITE, QS_POSTMESSAGE);
    if(dwReturn == WAIT_OBJECT_0)
    break; // spawned process has returned
    while(::PeekMessage(&msg,NULL,NULL,NULL,PM_REMOVE))
    {
    ::TranslateMessage(&msg);
    ::DispatchMessage(&msg);
    }
    }
    CloseHandle(pi.hProcess);
    CloseHandle(pi.hThread);
    }
    return rval;
    }
    [/code]
Sign In or Register to comment.