Reboot after close
Reboot after close
How can I reboot my application after I do a close of the application, without having to download or to power it off?
-
- Posts: 824
- Joined: Tue Mar 13, 2012 9:53 am
Re: Reboot after close
This topic has been already covered in this forum post. You just need to add the code to the event that you want. In the example script, it is associated with a button.
Best Regards,
Mark Monroe
Beijer Electronics, Inc. | Applications Engineer
Mark Monroe
Beijer Electronics, Inc. | Applications Engineer
Re: Reboot after close
I downloaded your zip file and tried it but each time I try it simulation as soon as I click one of the buttons an error closes the program. Here is the error;
Also when I copy the reboot part of the HMI in my application, I have all these errors.
Also when I copy the reboot part of the HMI in my application, I have all these errors.
- Attachments
-
- errorlist.PNG (58.65 KiB) Viewed 14700 times
-
- applicationscript.PNG (80.68 KiB) Viewed 14700 times
-
- ErrorSoftReboot.png (274.59 KiB) Viewed 14700 times
-
- Posts: 824
- Joined: Tue Mar 13, 2012 9:53 am
Re: Reboot after close
That file is used to reboot a HMI that runs Windows CE. Running the application in simulation mode on a PC will not work because there are different functions used to reboot a Windows 7 machine as opposed to a Windows CE machine.
What is the OS and/or name of the HMI panel that you are trying to reboot?
What is the OS and/or name of the HMI panel that you are trying to reboot?
Best Regards,
Mark Monroe
Beijer Electronics, Inc. | Applications Engineer
Mark Monroe
Beijer Electronics, Inc. | Applications Engineer
Re: Reboot after close
I am using a T10A and T7A HMI panel. Will it work with those?
-
- Posts: 824
- Joined: Tue Mar 13, 2012 9:53 am
Re: Reboot after close
Yes, those run Windows CE. Try downloading your application to one of those terminals and see it the button works.
Best Regards,
Mark Monroe
Beijer Electronics, Inc. | Applications Engineer
Mark Monroe
Beijer Electronics, Inc. | Applications Engineer
Re: Reboot after close
I've put this code in my application
but I can't download to my HMI cause he gives me this error while trying :S
Code: Select all
void Button36_Click(System.Object sender, System.EventArgs e)
{
string systemStateName = "reboot";
uint nError = CESetSystemPowerState(systemStateName.ToCharArray(), 0, 0x0);
}
- Attachments
-
- Windows error.PNG (19.54 KiB) Viewed 14673 times
-
- Posts: 824
- Joined: Tue Mar 13, 2012 9:53 am
Re: Reboot after close
You need to add the code that defines the CESetSystemPowerState function.
Best Regards,
Mark Monroe
Beijer Electronics, Inc. | Applications Engineer
Mark Monroe
Beijer Electronics, Inc. | Applications Engineer
Re: Reboot after close
which code is it? If it is this one
When I put those lines it gives me those errors
Code: Select all
[DllImport("coredll.dll", EntryPoint = "GetSystemPowerState")]
private static extern uint CEGetSystemPowerState(StringBuilder Buffer, uint Length, out uint Flags);
[DllImport("coredll.dll", EntryPoint = "SetSystemPowerState")]
private static extern uint CESetSystemPowerState(char[] sState, uint StateFlags, uint Options);
- Attachments
-
- Windows error.PNG (49.19 KiB) Viewed 14668 times
-
- Posts: 824
- Joined: Tue Mar 13, 2012 9:53 am
Re: Reboot after close
Copy all the "using" values as well.
Specifically:
using System.Text;
using System.Runtime.InteropServices;
Specifically:
using System.Text;
using System.Runtime.InteropServices;
Best Regards,
Mark Monroe
Beijer Electronics, Inc. | Applications Engineer
Mark Monroe
Beijer Electronics, Inc. | Applications Engineer