You can try getting the desktop window and then sending it to the foreground, this effectively brings up the today screen: SetForegroundWindow( GetDesktopWindow()); Create a timer in your Activate method for initial activation. Then on timer event, kill the timer and call the above pInvoke methods. you can find the pInvoke definitions on pinvoke.net. I hope this helps. Regards, Rick D. Contractor [quoted text, click to view] "Star" wrote: > Hi all, > > I have been browsing the newsgroups trying to find the way > of doing that, but unfortunately everything that I tried didn't work. > > I tried placing Hide() or Visible = false in the Form_Load event. > > Basically I just need to hide the application as soon as your start it. > Once is running, if you click on the shortcut application it should show up. > > Is there an easy way of doing that? > > Thanks
Define "shortcut application" for us. I don't have a good idea of what the operation of the application looks like. You might want to indicate what platform you are targeting, too. Paul T. [quoted text, click to view] "Star" <star@nospam.com> wrote in message news:%23KoC3DlQIHA.5184@TK2MSFTNGP05.phx.gbl... > Hi all, > > I have been browsing the newsgroups trying to find the way > of doing that, but unfortunately everything that I tried didn't work. > > I tried placing Hide() or Visible = false in the Form_Load event. > > Basically I just need to hide the application as soon as your start it. > Once is running, if you click on the shortcut application it should show > up. > > Is there an easy way of doing that? > > Thanks
[quoted text, click to view] > > Define "shortcut application" for us. > > I mean when you click on the icon in the Program's Folder where the > shortcut of my application is located. In summary, if you call my > application again needs to be visible again.
But, it's not visible to begin with, no? You want it to come up initially invisible, but to behave differently if it's already running? If so, that seems strange, but sending the application to the background, per Rick's suggestion. I don't think that there's any way to have a form-based application where the form is initially invisible (that doesn't surprise me, as I can't figure out why you'd want it to work that way myself). It would be possible to do this from unmanaged code where you have more direct control over the window's state... [quoted text, click to view] > > You might want to indicate what > > platform you are targeting, too. > > I'm using VS2005, C#, Windows Mobile 5.0 pocket PC target device, > Compact Framework 2.0, desktop Windows XP... > > anything else that you need? > > Thanks >
Paul T.
It's a known limitation in amnaged code. Application.Run always calls SHow on the Form passed in. The upcoming new release of the Smart Device Framework (version 2.2, due out before the year is over) has a provision for running without showing, but we achieved it only through creating our own message pump and application startup routine to prevent it from using the one in the CF. There's no other way to do it (that we've found anyway). -- Chris Tacke, eMVP Join the Embedded Developer Community http://community.opennetcf.com [quoted text, click to view] "Star" <star@nospam.com> wrote in message news:%23qM9iJmQIHA.2000@TK2MSFTNGP05.phx.gbl... > > Sorry, I think my English is not too good. > > It's very simple. When you start the application it will start minimized. > If you ACTIVATE it again, it will show up. As simple as that. > > My program is a GPS tracker that reads data from a GPS. If you set an > option in the configuration, the program will start minimized and reading > values from the GPS, so you don't have to worry about minimizing > manually. > > > > > Paul G. Tobey [eMVP] wrote: >>>> Define "shortcut application" for us. >>> I mean when you click on the icon in the Program's Folder where the >>> shortcut of my application is located. In summary, if you call my >>> application again needs to be visible again. >> >> But, it's not visible to begin with, no? You want it to come up >> initially invisible, but to behave differently if it's already running? >> If so, that seems strange, but sending the application to the background, >> per Rick's suggestion. I don't think that there's any way to have a >> form-based application where the form is initially invisible (that >> doesn't surprise me, as I can't figure out why you'd want it to work that >> way myself). It would be possible to do this from unmanaged code where >> you have more direct control over the window's state... >> >>>> You might want to indicate what >>>> platform you are targeting, too. >>> I'm using VS2005, C#, Windows Mobile 5.0 pocket PC target device, >>> Compact Framework 2.0, desktop Windows XP... >>> >>> anything else that you need? >>> >>> Thanks >>> >> >> Paul T. >> >>
Hi all, I have been browsing the newsgroups trying to find the way of doing that, but unfortunately everything that I tried didn't work. I tried placing Hide() or Visible = false in the Form_Load event. Basically I just need to hide the application as soon as your start it. Once is running, if you click on the shortcut application it should show up. Is there an easy way of doing that?
thanks for your help. I tried what you suggested but the problem is I still see the form for one second before disappears. I cannot make the timer interval smaller because in that case doesn't work. I would need something that doesn't show the form at all. Here is my code: private void FormMain_Activated(object sender, EventArgs e) { if (!m_bInitialized) { preventSleepTimer = new System.Threading.Timer(new System.Threading.TimerCallback(PokeDeviceToKeepAwake), null, 5000, System.Threading.Timeout.Infinite); m_bInitialized = true; } } private void PokeDeviceToKeepAwake(object extra) { try { preventSleepTimer.Dispose(); preventSleepTimer = null; Utils.Generic.SetForegroundWindow(Utils.Generic.GetDesktopWindow()); } catch { } } Thanks [quoted text, click to view] dbgrick wrote: > You can try getting the desktop window and then sending it to the foreground, > this effectively brings up the today screen: > > SetForegroundWindow( GetDesktopWindow()); > > Create a timer in your Activate method for initial activation. Then on timer > event, kill the timer and call the above pInvoke methods. > > you can find the pInvoke definitions on pinvoke.net. I hope this helps. > > Regards, > Rick D. > Contractor > > "Star" wrote: > >> Hi all, >> >> I have been browsing the newsgroups trying to find the way >> of doing that, but unfortunately everything that I tried didn't work. >> >> I tried placing Hide() or Visible = false in the Form_Load event. >> >> Basically I just need to hide the application as soon as your start it. >> Once is running, if you click on the shortcut application it should show up. >> >> Is there an easy way of doing that? >> >> Thanks
[quoted text, click to view] > Define "shortcut application" for us.
I mean when you click on the icon in the Program's Folder where the shortcut of my application is located. In summary, if you call my application again needs to be visible again. [quoted text, click to view] > You might want to indicate what > platform you are targeting, too.
I'm using VS2005, C#, Windows Mobile 5.0 pocket PC target device, Compact Framework 2.0, desktop Windows XP... anything else that you need? Thanks [quoted text, click to view] Paul G. Tobey [eMVP] wrote: > Define "shortcut application" for us. I don't have a good idea of what the > operation of the application looks like. You might want to indicate what > platform you are targeting, too. > > Paul T. > > "Star" <star@nospam.com> wrote in message > news:%23KoC3DlQIHA.5184@TK2MSFTNGP05.phx.gbl... >> Hi all, >> >> I have been browsing the newsgroups trying to find the way >> of doing that, but unfortunately everything that I tried didn't work. >> >> I tried placing Hide() or Visible = false in the Form_Load event. >> >> Basically I just need to hide the application as soon as your start it. >> Once is running, if you click on the shortcut application it should show >> up. >> >> Is there an easy way of doing that? >> >> Thanks >
Sorry, I think my English is not too good. It's very simple. When you start the application it will start minimized. If you ACTIVATE it again, it will show up. As simple as that. My program is a GPS tracker that reads data from a GPS. If you set an option in the configuration, the program will start minimized and reading values from the GPS, so you don't have to worry about minimizing manually. [quoted text, click to view] Paul G. Tobey [eMVP] wrote: >>> Define "shortcut application" for us. >> I mean when you click on the icon in the Program's Folder where the >> shortcut of my application is located. In summary, if you call my >> application again needs to be visible again. > > But, it's not visible to begin with, no? You want it to come up initially > invisible, but to behave differently if it's already running? If so, that > seems strange, but sending the application to the background, per Rick's > suggestion. I don't think that there's any way to have a form-based > application where the form is initially invisible (that doesn't surprise me, > as I can't figure out why you'd want it to work that way myself). It would > be possible to do this from unmanaged code where you have more direct > control over the window's state... > >>> You might want to indicate what >>> platform you are targeting, too. >> I'm using VS2005, C#, Windows Mobile 5.0 pocket PC target device, >> Compact Framework 2.0, desktop Windows XP... >> >> anything else that you need? >> >> Thanks >> > > Paul T. > >
Thanks for the information. Regards [quoted text, click to view] <ctacke/> wrote: > It's a known limitation in amnaged code. Application.Run always calls SHow > on the Form passed in. > > The upcoming new release of the Smart Device Framework (version 2.2, due out > before the year is over) has a provision for running without showing, but we > achieved it only through creating our own message pump and application > startup routine to prevent it from using the one in the CF. There's no > other way to do it (that we've found anyway). >
[quoted text, click to view] On 19 Dec, 23:33, Star <s...@nospam.com> wrote: > Thanks for the information. > > Regards > > > > <ctacke/> wrote: > > It's a known limitation in amnaged code. Application.Run always calls SHow > > on the Form passed in. > > > The upcoming new release of the Smart Device Framework (version 2.2, due out > > before the year is over) has a provision for running without showing, but we > > achieved it only through creating our own message pump and application > > startup routine to prevent it from using the one in the CF. There's no > > other way to do it (that we've found anyway).- Hide quoted text - > > - Show quoted text -
Star, I too am writing my own GPS tracking application (probably like a LOT of other people) and am interested in this also. What I want to achieve is my application to run in the background, and take it's settings from a config file. I then have a different UI application that allows the user to set the configuration settings (which includes setting when to stop and start tracking, etc.). Any
And doing that would just change the position of your window in the z-order. It could still be shown later. Wait for OpenNETCF 2.2 or get the older ApplicationEx class from OpenNETCF and modify the code, this is what we done and it works great. Sometimes the framework is too helpful for its own good! ;) -- Simon Hart Visual Developer - Device Application Development MVP http://simonrhart.blogspot.com [quoted text, click to view] "Star" wrote: > thanks for your help. > > I tried what you suggested but the problem is I still see the form for > one second before disappears. I cannot make the timer interval smaller > because in that case doesn't work. I would need something that doesn't > show the form at all. > > Here is my code: > > > private void FormMain_Activated(object sender, EventArgs e) > { > if (!m_bInitialized) > { > preventSleepTimer = new System.Threading.Timer(new > System.Threading.TimerCallback(PokeDeviceToKeepAwake), > null, 5000, System.Threading.Timeout.Infinite); > m_bInitialized = true; > } > } > > private void PokeDeviceToKeepAwake(object extra) > { > try > { > preventSleepTimer.Dispose(); > preventSleepTimer = null; > > > Utils.Generic.SetForegroundWindow(Utils.Generic.GetDesktopWindow()); > } > catch > { > > } > } > > > Thanks > > > > dbgrick wrote: > > You can try getting the desktop window and then sending it to the foreground, > > this effectively brings up the today screen: > > > > SetForegroundWindow( GetDesktopWindow()); > > > > Create a timer in your Activate method for initial activation. Then on timer > > event, kill the timer and call the above pInvoke methods. > > > > you can find the pInvoke definitions on pinvoke.net. I hope this helps. > > > > Regards, > > Rick D. > > Contractor > > > > "Star" wrote: > > > >> Hi all, > >> > >> I have been browsing the newsgroups trying to find the way > >> of doing that, but unfortunately everything that I tried didn't work. > >> > >> I tried placing Hide() or Visible = false in the Form_Load event. > >> > >> Basically I just need to hide the application as soon as your start it. > >> Once is running, if you click on the shortcut application it should show up. > >> > >> Is there an easy way of doing that? > >> > >> Thanks > >>
You have to modify the source code for Application2.Run to launch the application without showing the Form passed into the Run command. It has nothing to do with creating a Filter or a Windows Procedure. SDF 2.2 will include an overload that does this and will be out soon. -- Chris Tacke, eMVP Join the Embedded Developer Community http://community.opennetcf.com [quoted text, click to view] "LEM" <anonymous@nospam.com> wrote in message news:e53SyF7VIHA.5164@TK2MSFTNGP03.phx.gbl... > Hi Simon, > > > I just saw your post and since I am still trying to do this, I'm trying > what you said. > > I have OpenNETCF installed but I haven't been able to find that class. > I also tried this example that I found: > http://blog.opennetcf.org/ayakhnin/PermaLink.aspx?guid=9a05b2dc-c79f-4cd8-af17-aa485fada5c7 > > but I get an error because 'Message' cannot be found. The rest is ok. > > Do you think you can share that modification that you did so I can try it > here? > > Thanks a lot. > > > Simon Hart [MVP] wrote: >> And doing that would just change the position of your window in the >> z-order. It could still be shown later. >> >> Wait for OpenNETCF 2.2 or get the older ApplicationEx class from >> OpenNETCF and modify the code, this is what we done and it works great. >> Sometimes the framework is too helpful for its own good! ;)
Hi Simon, I just saw your post and since I am still trying to do this, I'm trying what you said. I have OpenNETCF installed but I haven't been able to find that class. I also tried this example that I found: http://blog.opennetcf.org/ayakhnin/PermaLink.aspx?guid=9a05b2dc-c79f-4cd8-af17-aa485fada5c7 but I get an error because 'Message' cannot be found. The rest is ok. Do you think you can share that modification that you did so I can try it here? Thanks a lot. [quoted text, click to view] Simon Hart [MVP] wrote: > And doing that would just change the position of your window in the z-order. > It could still be shown later. > > Wait for OpenNETCF 2.2 or get the older ApplicationEx class from OpenNETCF > and modify the code, this is what we done and it works great. Sometimes the
Ok, I will wait then. Thanks [quoted text, click to view] <ctacke/> wrote: > You have to modify the source code for Application2.Run to launch the > application without showing the Form passed into the Run command. It has > nothing to do with creating a Filter or a Windows Procedure. > > SDF 2.2 will include an overload that does this and will be out soon. >
Don't see what you're looking for? Try a search.
|