.NET Programming
 

     
Install directory of CAB files on a WindowsMobile Device using rapi CreateProcess and wceload.exe (with Wait functionality)

Keywords: rapi CreateProcess Blocking Call wceload.exe DeviceFileExists CAB files Windows Mobile Device

 

 
 

saroten 30 mg

saroten erfaringer saroten alkohol saroten lundbeck

//using OpenNETCF.Desktop.Communication;

 

try

{

    while (!rapi.Connected) rapi.Connect();

 

 

    foreach (string file in Directory.GetFiles(CabPath, "*.cab"))

    {

        fileName = Path.GetFileName(file);

 

rapi.CopyFileToDevice(file, Path.Combine(devicePath, fileName), true);

        rapi.CreateProcess(@"\Windows\wceload.exe", "/noui \"" +

            Path.Combine(devicePath, fileName)+ "\"");

        // the Rapi CreateProcess call returns immedialy,

        //this may cause some of the Cab Files to fail to install

        // when multiple installations are required

 

        System.Threading.Thread.Sleep(1000);

        do

        {

            System.Threading.Thread.Sleep(100);

            Application.DoEvents();

        } while (rapi.DeviceFileExists(devicePath + "\\" + fileName) ==

true);

// Use the DeviceFileExists function to simulate a Blocking //thread and ensure that all CAB files are installed. 

        // By default the

  // wceload function removes the CAB file from the Device after  

  // successful or failed installation, so it's disappearance  

        // signals the end of the installation

 

        currentFile += 1;

        FileInstallParametersChange(totalFiles, currentFile);

    }

}

catch (Exception ex)

{

    Console.WriteLine(ex.Message);

    throw;

}

finally

{

    if (rapi.Connected) rapi.Disconnect();

}


 


 PTerryWave LLC      Return to Programming Listing
About