Restart Windows Mobile Device Programatically

M

M. Meganathan

Hi,

I like to restart device programatically alert message popup to device. How
to do it.

Please give us better idea.

Thanks,
Megan
 
C

Christopher Fairbairn [MVP]

Hi,

M. Meganathan said:
I like to restart device programatically alert message popup to device.
How to do it.

What version of the Windows Mobile OS are you targeting?

You could try calling the ExitWindowsEx API (documented on MSDN at
http://msdn.microsoft.com/en-us/library/ms893047.aspx)

Passing the EWX_REBOOT flag should reset the device for you.

You would need to use Platform Invoke functionality to access this from a
..NET CF application. In C# something like the following should be
sufficient:

[DllImport("aygshell.dll")]
private static extern bool ExitWindowsEx(int uFlags, int dwReserved);

private const int EWX_REBOOT = 2;

Hope this helps,
Christopher Fairbairn
 
M

M. Meganathan

Thanks Chris

I am using window mobile 5.0

I Build cab file using VS2005, While build cab after intall cab file in
Device popup message "Do you want to restart it" ok Cancel button

User clicks "ok" button device restart method calls. Cancel means user in
half way process manually restart device.

I dont want Messagebox use it. Example First time .Netcf cab install in
device after installation popup message to restart device same way i am
expected.

How to do it . Please give better ways and idea.

Megan


Christopher Fairbairn said:
Hi,

M. Meganathan said:
I like to restart device programatically alert message popup to device.
How to do it.

What version of the Windows Mobile OS are you targeting?

You could try calling the ExitWindowsEx API (documented on MSDN at
http://msdn.microsoft.com/en-us/library/ms893047.aspx)

Passing the EWX_REBOOT flag should reset the device for you.

You would need to use Platform Invoke functionality to access this from a
.NET CF application. In C# something like the following should be
sufficient:

[DllImport("aygshell.dll")]
private static extern bool ExitWindowsEx(int uFlags, int dwReserved);

private const int EWX_REBOOT = 2;

Hope this helps,
Christopher Fairbairn
 
P

Peter Foot

You will only get an automatic prompt to restart the device if your
installation does something which will affect running applications e.g.
overwriting system files or when a previous version of your application is
still running. Perhaps you can explain what your cab file installs. Often
you can get around this by using a cesetup.dll which will allow you to
safely close down applications which may be using your files, or move system
files from your application folder to the \windows folder without alerting
the setup engine.

Peter

--
Peter Foot
Microsoft Device Application Development MVP
peterfoot.net | appamundi.com | inthehand.com
APPA Mundi Ltd - software solutions for a mobile world
In The Hand Ltd - .NET Components for Mobility

M. Meganathan said:
Thanks Chris

I am using window mobile 5.0

I Build cab file using VS2005, While build cab after intall cab file in
Device popup message "Do you want to restart it" ok Cancel button

User clicks "ok" button device restart method calls. Cancel means user in
half way process manually restart device.

I dont want Messagebox use it. Example First time .Netcf cab install in
device after installation popup message to restart device same way i am
expected.

How to do it . Please give better ways and idea.

Megan


Christopher Fairbairn said:
Hi,

M. Meganathan said:
I like to restart device programatically alert message popup to device.
How to do it.

What version of the Windows Mobile OS are you targeting?

You could try calling the ExitWindowsEx API (documented on MSDN at
http://msdn.microsoft.com/en-us/library/ms893047.aspx)

Passing the EWX_REBOOT flag should reset the device for you.

You would need to use Platform Invoke functionality to access this from a
.NET CF application. In C# something like the following should be
sufficient:

[DllImport("aygshell.dll")]
private static extern bool ExitWindowsEx(int uFlags, int dwReserved);

private const int EWX_REBOOT = 2;

Hope this helps,
Christopher Fairbairn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top