FORUMS
Remove All Ads from XDA

Stopping windows mobile from shutting my app down

6 posts
Thanks Meter: 0
 
By Davearia, Junior Member on 10th July 2010, 11:29 AM
Post Reply Email Thread
Hi,

I noticed that whenever I needed to use another part of my mobile phone (HTC HD2) and my application lost focus it would disappear. Looking at Task Manager the application was not there but often the process was still running. Click the application icon in the folder would cause the application to start up from scatch instead of just opening the instance created earlier.

I thought I had a fix that admittedly I Googled.

Code:
[DllImport("coredll.dll")]
static extern int ShowWindow(IntPtr hWnd, int nCmdShow);

const int SW_MINIMIZED = 6;

private void frmMain_Deactivate(object sender, EventArgs e)
{
    HideApp();
}

private void HideApp()
{
    ShowWindow(this.Handle, SW_MINIMIZED);
}
This seems to have made some difference. The application seems to disappear less than before; but the application is still disappearing as a process if it loses focus on occasions.

Can anyone please help?

Thanks, Dave.
 
 
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes