locked
Closing VB.NETCF 2008 exe in Windows Mobile 6 (device DS5) RRS feed

  • Question

  • Hi!

    Closing VB.NETCF 2008 exe in Windows Mobile 6 (device DS5):

    After running exe and working I wanted to close my app and tried do that by clicking on the right lower control  "X". Application disappeared visually, but I must close it by "Task Manager" by clicking "End Task".

    How can I close my app without going into "Task Manager"? How can I close it by clicking on the right lower control  "X"?

    Tuesday, September 22, 2015 11:59 AM

Answers

  • Hi Tomas,

    Windows Mobile 6 is designed to only close applications when it needs the memory back so you do not need to force it to close. The operating system will close your app eventually when it needs the resources.

    If you want to force the app to actually remove itself from memory, you could add a button or menu item that will actually tear down the app but as I stated above, this is not required.  Take a look at "WM_CLOSE" as your app could potentially use this window message to destroy itself. See

    https://msdn.microsoft.com/en-us/library/aa921571.aspx

    Sincerely,

    IoTGirl

    • Proposed as answer by Jamles Hez Wednesday, September 23, 2015 3:06 AM
    • Marked as answer by Jamles Hez Tuesday, September 29, 2015 3:15 AM
    Tuesday, September 22, 2015 4:11 PM

All replies

  • Hi Tomas,

    Windows Mobile 6 is designed to only close applications when it needs the memory back so you do not need to force it to close. The operating system will close your app eventually when it needs the resources.

    If you want to force the app to actually remove itself from memory, you could add a button or menu item that will actually tear down the app but as I stated above, this is not required.  Take a look at "WM_CLOSE" as your app could potentially use this window message to destroy itself. See

    https://msdn.microsoft.com/en-us/library/aa921571.aspx

    Sincerely,

    IoTGirl

    • Proposed as answer by Jamles Hez Wednesday, September 23, 2015 3:06 AM
    • Marked as answer by Jamles Hez Tuesday, September 29, 2015 3:15 AM
    Tuesday, September 22, 2015 4:11 PM
  • Thank you IoTGirl!

    How can I use in my visual basic net project "WM_CLOSE" to clear my app from task manager?

    Wednesday, September 23, 2015 8:23 AM
  • Hi Tomas,

    Your Application window procedure will get a window message of "WM_CLOSE" and you will need to trap that call and terminate your application when that window message is received.  However, that is not the only way an app is asked to close.

    First, try the following Sample as it shows a number of different ways a "Close" request can arrive to your application or form.  https://msdn.microsoft.com/en-us/library/aa445537(v=vs.60).aspx.  I think this should cover all of the options you might need.

    There are a number of ways to actually terminate the application, for example you could use the process itself as shown here: https://msdn.microsoft.com/en-us/library/system.diagnostics.process.closemainwindow.aspx?cs-save-lang=1&cs-lang=vb#code-snippet-2 Note that you need to do it for both the window and the resources.

    If you are actually looking for a second application to terminate the first, there is a sample here that might help. http://www.vb-helper.com/howto_net_terminate_process.html.

    Sincerely,

    IoTGirl

     

    Wednesday, September 23, 2015 5:00 PM