Groups | Blog | Home
all groups > dotnet compact framework > april 2008 >

dotnet compact framework : Restart Application



Simon Hart [MVP]
4/10/2008 12:46:00 PM
Without writting a separate program to do this, you could use the
CeRunAppAtTime function (part of coredll.dll):

DllImport("coredll.dll", EntryPoint="CeRunAppAtTime", SetLastError=true)]
private static extern bool CeRunAppAtTime(string pwszAppName, byte[] lpTime);


--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


[quoted text, click to view]
Armando Rocha
4/10/2008 6:59:12 PM
Hi, 2 questions.

1.
I m working in a mobile application and i need restart my application after
i change language settings. How i do that?

2.
I have a Main form and i call another form (frmLanguages), when i change the
language display a msgbox asking if the user want restart application, if
the user choose yes i want call a function in Main form to restart
application.


Armando Rocha
http://www.ifthensoftware.com
Simon Hart [MVP]
4/11/2008 4:45:02 AM
I don't see how that will work from within the same executable.
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


[quoted text, click to view]
Simon Hart [MVP]
4/11/2008 6:52:01 AM
I wouldn't do it that way. I take it you are running on Win CE?
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


[quoted text, click to view]
Simon Hart [MVP]
4/11/2008 8:15:05 AM
Seems you have to use CABWIZ.exe on Windows CE, I code on Windows Mobile
which uses makecab. Also ensure you are using the correct Windows CE SDK.

See if this article helps: http://support.microsoft.com/kb/181007
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


[quoted text, click to view]
Christian Resma Helle
4/11/2008 9:42:43 AM
Wrappers for this is included in OpenNETCF's Smart Device Framework. Its
also available in source code from the old SDF 1.4

--
Regards,
Christian Helle
http://christian-helle.blogspot.com


[quoted text, click to view]

Armando Rocha
4/11/2008 11:53:19 AM
Hi, Thanks for the help.

I solved this problem with ProcessStartInfo(). Its work perfect.

Code below:
ProcessStartInfo s = new ProcessStartInfo();
s.FileName = Assembly.GetExecutingAssembly().GetName().CodeBase;
s.UseShellExecute = false;
Process.Start(s);

Armando Rocha
http://www.ifthensoftware.com



"Christian Resma Helle" <xtianism@gmail.com> escreveu na mensagem
news:%23N6mCc6mIHA.4744@TK2MSFTNGP06.phx.gbl...
[quoted text, click to view]
Armando Rocha
4/11/2008 2:44:48 PM
Hi Simon,

When i said "change language settings", I did mean languages settings of my
own application and not languages settings of the OS (in my case WM6).

complete code:
public void RestartApp() {
Dispose(true);
Application.Exit();
//Restart new Process
ProcessStartInfo s = new ProcessStartInfo();
s.FileName = Assembly.GetExecutingAssembly().GetName().CodeBase;
s.UseShellExecute = false;
Process.Start(s);
}

So far its work fine, but i dont know if is the right way to do it. is?

--
Armando Rocha
Mobile Developer

http://www.ifthensoftware.com
"Simon Hart [MVP]" <srhartone@yahoo.com> escreveu na mensagem
news:4D7C227C-9E48-4227-B227-6D637540DBA3@microsoft.com...
[quoted text, click to view]
Armando Rocha
4/11/2008 3:01:05 PM
Hi,

I m run application on Windows Mobile 6.0, Compact Framework 3.5 on Pocket
PC HTC TyTN.

--
Armando Rocha
Mobile Developer

http://www.ifthensoftware.com
"Simon Hart [MVP]" <srhartone@yahoo.com> escreveu na mensagem
news:927BFD95-278B-407D-898F-3A6128A511E4@microsoft.com...
[quoted text, click to view]
AddThis Social Bookmark Button