i want to run some .exe in pocket pc using c++.
how do i do that?
thanks

Member Avatar for Mouche

Are you interested in writing programs for your pocket pc in c++, or are you trying to run compiled programs on the device?

Load it onto a SD card, shove it into the PPC, find the executable in explore, double click it with your pointing device.

You can execute another program on PPC the same way you do it on a PC. CreateProcess() win32 api is one way. Remember, PPC does NOT have a command prompt, so system() is not available (as I recall). There is also no such concept as current working directory or change directory. There are directories on PPC, but there is no way to change the current working directory of the program.

Also be careful where you put files. If you have to cold boot the ppc device the file system gets reinitialized to the manufacturer's default. Files stored on extra memory device are unaffected by cold boot.

i think i was looking something like the following, i got it to run in pc, now it is time to try it on ppc, i will let you know when i get it done.

#include <windows.h>
#include <stdio.h>
#include <tchar.h>

void _tmain( int argc, TCHAR *argv[] )
{
    STARTUPINFO si;
    PROCESS_INFORMATION pi;

    ZeroMemory( &si, sizeof(si) );
    si.cb = sizeof(si);
    ZeroMemory( &pi, sizeof(pi) );

    if( argc != 2 )
    {
        printf("Usage: %s [cmdline]\n", argv[0]);
        return;
    }

    // Start the child process. 
    if( !CreateProcess( NULL,   // No module name (use command line)
        argv[1],        // Command line
        NULL,           // Process handle not inheritable
        NULL,           // Thread handle not inheritable
        FALSE,          // Set handle inheritance to FALSE
        0,              // No creation flags
        NULL,           // Use parent's environment block
        NULL,           // Use parent's starting directory 
        &si,            // Pointer to STARTUPINFO structure
        &pi )           // Pointer to PROCESS_INFORMATION structure
    ) 
    {
        printf( "CreateProcess failed (%d).\n", GetLastError() );
        return;
    }

    // Wait until child process exits.
    WaitForSingleObject( pi.hProcess, INFINITE );

    // Close process and thread handles. 
    CloseHandle( pi.hProcess );
    CloseHandle( pi.hThread );
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.