Installa a .cab

  • Thread starter Thread starter Javier Ros
  • Start date Start date
J

Javier Ros

Hi to all!!

I want to install a .cab in my terminal from smart device application, how
to do it without prompt the install dir?

Thanks in advance.

PD: Sorry, my english is poor.
 
If you call wceload.exe with the /noaskdest and /noui flags along with the
full path to the cab file you wont be prompted for an install location it
will use the default. Thats certainly true on Pocket PC, not sure whether
this works on Smartphone or other CE platforms though...
You can use the Process class in the SDF to launch the process
(www.opennetcf.org/sdf/) or P/Invoke CreateProcess or ShellExecuteEx
yourself.

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

Do have an opinion on the effectiveness of Microsoft Windows Mobile and
Embedded newsgroups? Let us know!
https://www.windowsembeddedeval.com/community/newsgroups
 
To follow on what Peter said, this is the code I used (based
originally on posts in this group).

private bool installCabFile ()
{
try
{
ProcessInfo pi = new ProcessInfo();
if (CreateProcess ("\\Windows\\wceload.exe","/noaskdest /noui " +
downloadFileName, pi))
return false;
}

catch (Exception e)
{
Cursor.Current = Cursors.Default;
MessageBox.Show ("Problem installing Cab file " + e.ToString());
return true;
}

return false;
}

// CreateProcess PInvoke API
[DllImport("CoreDll.DLL", SetLastError=true)]
private extern static int CreateProcess
(
String imageName,
String cmdLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
Int32 boolInheritHandles,
Int32 dwCreationFlags,
IntPtr lpEnvironment,
IntPtr lpszCurrentDir,
byte [] si,
ProcessInfo pi
);

// GetLastError PInvoke API
[DllImport("CoreDll.dll")]
private extern static Int32 GetLastError();

public Int32 GetPInvokeError()
{
return GetLastError();
}

[DllImport("CoreDll.dll")]
private extern static Int32 WaitForSingleObject( IntPtr Handle, Int32
Wait);

public bool CreateProcess (String ExeName, String CmdLine, ProcessInfo
pi)
{
Int32 INFINITE;
unchecked {INFINITE = (int)0xFFFFFFFF;}

bool result = false;

if (pi == null)
pi = new ProcessInfo ();

byte [] si = new byte [128];

result = CreateProcess (ExeName, CmdLine, IntPtr.Zero, IntPtr.Zero, 0,
0, IntPtr.Zero, IntPtr.Zero, si, pi) != 0;
WaitForSingleObject (pi.hProcess,INFINITE);

return result;
}

public sealed class ProcessInfo
{
public IntPtr hProcess = IntPtr.Zero;
public IntPtr hThread = IntPtr.Zero;
public int dwProcessID = 0;
public int dwThreadID = 0;
}
 
Back
Top