Shellexecute a CAB File

  • Thread starter Thread starter Timo Meier
  • Start date Start date
Use the CreateProcess function (A P/Invoke for this is included in the
opennetcf WinAPI library:-
http://www.opennetcf.org/WinApi.asp
Call the wceload.exe application and pass in the cab as an argument e.g.
Core.CreateProcess("wceload.exe", "yourcab.cab");

Peter
 
Peter Foot said:
Use the CreateProcess function (A P/Invoke for this is included in the
opennetcf WinAPI library:-
http://www.opennetcf.org/WinApi.asp
Call the wceload.exe application and pass in the cab as an argument e.g.
Core.CreateProcess("wceload.exe", "yourcab.cab");

I ended up using shell instead of createprocess with the cab file
location/name as the parameter to wceload.exe because when I did the
create process with wceload.exe, I always got a message "Double-tap a
..cab file to install the application" instead of it actually
running/opening the cab file.

Of course, I was not using the opennetcf winapi library, so maybe I
had something else in my createprocess hosed up (except that other
items that I use create process work fine)
 
That sounds like you had either: a) no path or incorrect path to the target
cab file, or b) used \\ when \ was right or vice versa.

Paul T.
 
My thoughts as well, except that I've tried every combination of
slashes and used quotes and nothing worked. The same exact path
string works fine with a shell statement.

Funny enough though, if I move the file from the program files folder
to the windows folder, it worked fine. The only thing I can think of
is the space in "program files" is causing me problems, but putting
this in quotes should get around this problem shouldn't it?

No probs though, I've got a way around it (whether I'm crazy or not!).

Thanks a bunch!
 
Try

Core.CreateProcess("wceload.exe", "'\\My Documents\\mycab'");

or

Core.CreateProcess("wceload.exe '\\My Documents\\mycab'", "");


--
Chris Tacke, eMVP
Advisory Board Member
www.OpenNETCF.org
---
Windows CE Product Manager
Applied Data Systems
www.applieddata.net

Jon Davis said:
My thoughts as well, except that I've tried every combination of
slashes and used quotes and nothing worked. The same exact path
string works fine with a shell statement.

Funny enough though, if I move the file from the program files folder
to the windows folder, it worked fine. The only thing I can think of
is the space in "program files" is causing me problems, but putting
this in quotes should get around this problem shouldn't it?

No probs though, I've got a way around it (whether I'm crazy or not!).

Thanks a bunch!


"Paul G. Tobey [eMVP]" <[email protected]> wrote in message
That sounds like you had either: a) no path or incorrect path to the target
cab file, or b) used \\ when \ was right or vice versa.

Paul T.
 
You need to be very careful about spaces in folder and file names. I have

myRapi.CreateProcess(@"\Windows\wceload.exe", @"""" + fullName + @"""");

for executing a CAB. I'm not 100% certain this is required but I am certain
that something similar is required when creating shortcuts.

I wasted a long time on this yesterday. I eventually managed to see the
contents of a shortcut file (*.lnk) and found that without double quotes
around the name the path of the program to execute (in Program Files), the
lnk file would contain something like

"Program" Files\MyProg.exe"

John.

Jon Davis said:
My thoughts as well, except that I've tried every combination of
slashes and used quotes and nothing worked. The same exact path
string works fine with a shell statement.

Funny enough though, if I move the file from the program files folder
to the windows folder, it worked fine. The only thing I can think of
is the space in "program files" is causing me problems, but putting
this in quotes should get around this problem shouldn't it?

No probs though, I've got a way around it (whether I'm crazy or not!).

Thanks a bunch!


"Paul G. Tobey [eMVP]" <[email protected]> wrote in message
That sounds like you had either: a) no path or incorrect path to the target
cab file, or b) used \\ when \ was right or vice versa.

Paul T.
 
You nailed it! I put the """"'s around it and it worked. I guess
that makes some since, I just couldn't see it before you pointed it
out.

Thanks for pointing that out to me :)


John Atkins said:
You need to be very careful about spaces in folder and file names. I have

myRapi.CreateProcess(@"\Windows\wceload.exe", @"""" + fullName + @"""");

for executing a CAB. I'm not 100% certain this is required but I am certain
that something similar is required when creating shortcuts.

I wasted a long time on this yesterday. I eventually managed to see the
contents of a shortcut file (*.lnk) and found that without double quotes
around the name the path of the program to execute (in Program Files), the
lnk file would contain something like

"Program" Files\MyProg.exe"

John.

Jon Davis said:
My thoughts as well, except that I've tried every combination of
slashes and used quotes and nothing worked. The same exact path
string works fine with a shell statement.

Funny enough though, if I move the file from the program files folder
to the windows folder, it worked fine. The only thing I can think of
is the space in "program files" is causing me problems, but putting
this in quotes should get around this problem shouldn't it?

No probs though, I've got a way around it (whether I'm crazy or not!).

Thanks a bunch!


"Paul G. Tobey [eMVP]" <[email protected]> wrote in message
That sounds like you had either: a) no path or incorrect path to the target
cab file, or b) used \\ when \ was right or vice versa.

Paul T.

"Peter Foot [MVP]" <[email protected]> wrote in message
Use the CreateProcess function (A P/Invoke for this is included in the
opennetcf WinAPI library:-
http://www.opennetcf.org/WinApi.asp
Call the wceload.exe application and pass in the cab as an argument e.g.
Core.CreateProcess("wceload.exe", "yourcab.cab");


I ended up using shell instead of createprocess with the cab file
location/name as the parameter to wceload.exe because when I did the
create process with wceload.exe, I always got a message "Double-tap a
.cab file to install the application" instead of it actually
running/opening the cab file.

Of course, I was not using the opennetcf winapi library, so maybe I
had something else in my createprocess hosed up (except that other
items that I use create process work fine)
 
Hi,

I am a web developer that needs to do exactly what you are doing here.
Please can you explain to me where you call the createProcess from? I
have the openNetCf framework, but whereever I try to call it from, I
get an error.

Many thanks for your help

Richard




Jon said:
You nailed it! I put the """"'s around it and it worked. I guess
that makes some since, I just couldn't see it before you pointed it
out.

Thanks for pointing that out to me :)


"John Atkins" <[email protected]> wrote in message
You need to be very careful about spaces in folder and file names. I have

myRapi.CreateProcess(@"\Windows\wceload.exe", @"""" + fullName + @"""");

for executing a CAB. I'm not 100% certain this is required but I am certain
that something similar is required when creating shortcuts.

I wasted a long time on this yesterday. I eventually managed to see the
contents of a shortcut file (*.lnk) and found that without double quotes
around the name the path of the program to execute (in Program Files), the
lnk file would contain something like

"Program" Files\MyProg.exe"

John.

Jon Davis said:
My thoughts as well, except that I've tried every combination of
slashes and used quotes and nothing worked. The same exact path
string works fine with a shell statement.

Funny enough though, if I move the file from the program files folder
to the windows folder, it worked fine. The only thing I can think of
is the space in "program files" is causing me problems, but putting
this in quotes should get around this problem shouldn't it?

No probs though, I've got a way around it (whether I'm crazy or not!).

Thanks a bunch!


"Paul G. Tobey [eMVP]" <[email protected]> wrote in
message
That sounds like you had either: a) no path or incorrect path
to the
target
cab file, or b) used \\ when \ was right or vice versa.

Paul T.

"Peter Foot [MVP]" <[email protected]> wrote in
message
Use the CreateProcess function (A P/Invoke for this is
included in
the
opennetcf WinAPI library:-
http://www.opennetcf.org/WinApi.asp
Call the wceload.exe application and pass in the cab as an
argument
e.g.
Core.CreateProcess("wceload.exe", "yourcab.cab");


I ended up using shell instead of createprocess with the cab file
location/name as the parameter to wceload.exe because when I did the
create process with wceload.exe, I always got a message "Double-tap a
.cab file to install the application" instead of it actually
running/opening the cab file.
Of course, I was not using the opennetcf winapi library, so maybe I
had something else in my createprocess hosed up (except that other
items that I use create process work fine)
 
See the OpenNETCF.Diagnostics.Process class in OpenNETCF.dll,you can call it
like so:-

Process.Start("myapp.exe")

It's designed to work just like the System.Diagnostics.Process class on the
desktop.

Peter
 
Back
Top