running app in background smartphone?

M

Mustafa Rabie

hi all,

i want to have my application main window hide, and keeps running, and when
the user runs it again the windows open up again. ie i start my application
the user enters some settings, and clicks ok, the application UI closes but
keeps running, then when he clicks on the shortcut again to run it the
window UI show up.

I tried the following, when he clicks "ok" this.Hide(), and added
this.Show() in Form1_Load method. But when the app starts again and
this.Show() is called only the title and the menu shows but not the form
itself and it's controls.

is there a better way to do it or what am i missing here?
thanks
mustafa
 
M

Mustafa Rabie

thanks peter,
i added the function in the link below and called it from form1_load. i
then open the file manager and clicked myapp.exe but still my app didn't
show up.
 
A

Alex Feinman [MVP]

That's because you have called Hide(). Instead of hiding the window, try
sending it to the background -
Form.SendToBack()
 
M

Mustafa Rabie

i tried this.SendToBack()
but nothing happened the form is still showing...
 
M

Mustafa Rabie

plus i wanted to Hide it so that it doesn't show on the TaskManager so the
user can't close it
 
A

Alex Feinman [MVP]

Ok, here's what seems to work for me:

To hide the form call Form.Hide() (that's what you do already)
To restore, add Form.Activate handler and in it call Form.Show() and
Form.BringToFront() (in this order)
 
M

Mustafa Rabie

Hi Alex,

I tried that and still the app doesn't show up when i click myApp.exe:

The App is for Smartphone 2003 SPV C_500

the code:
this.Activated += new System.EventHandler(this.Form1_Activate);

private void menuItem2_Click(object sender, System.EventArgs e)

{

this.Hide();

}

private void Form1_Activate(object sender, System.EventArgs e)

{

this.Show();

this.BringToFront();

}

and this doesn't work also.

Thanks

Mustafa
 

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