Windows Mobile Soft Keys
-
I am developing application in VS2005 C#, Windows Mobile 5. Please help, I have some doubts.. 1. How to code for softkeys in Windows Mobile? 2. How to add background image? 3.If I closed the application, its still running at the background,I stop running programs also its still running,I need to remove the battery to shutdown the application.How to avoid this? 4.How to install exe file with icon/logo to Windows Mobile programs collection? I am a newbie for WM development,So, please bear with my questions.:) Thanks in advance
-
I am developing application in VS2005 C#, Windows Mobile 5. Please help, I have some doubts.. 1. How to code for softkeys in Windows Mobile? 2. How to add background image? 3.If I closed the application, its still running at the background,I stop running programs also its still running,I need to remove the battery to shutdown the application.How to avoid this? 4.How to install exe file with icon/logo to Windows Mobile programs collection? I am a newbie for WM development,So, please bear with my questions.:) Thanks in advance
Please clarify what you mean on some of these. 1. What specifically do you want to do with the softkeys? Turn them off? Receive the events? 2. What do you want to add a background image to? Your form? According to the documentation, it doesn't look like the 'Control.BackgroundImage' (http://msdn2.microsoft.com/en-us/library/system.windows.forms.treeview.backcolor.aspx[^]) property is supported in the Compact Framework. There is probably another way to do it, but I doubt it's trivial. 3. PDAs keep the application running unless you explicitly tell it to terminate in your code, or you kill the running process from the Settings | System | Memory control panel. 4. In Visual Studio, Create a CAB setup program. Once the project has been created, there is a place in there to specify a shortcut to the Programs menu. This shortcut can have an icon associated with it. You edit this in the filesystem editor for the CAB setup program. Build the CAB project and then run it on the PDA. When your CAB gets installed on the PDA it will place the icon into the special Programs folder as you expect. -Matt
------------------------------------------ The 3 great virtues of a programmer: Laziness, Impatience, and Hubris. --Larry Wall
-
Please clarify what you mean on some of these. 1. What specifically do you want to do with the softkeys? Turn them off? Receive the events? 2. What do you want to add a background image to? Your form? According to the documentation, it doesn't look like the 'Control.BackgroundImage' (http://msdn2.microsoft.com/en-us/library/system.windows.forms.treeview.backcolor.aspx[^]) property is supported in the Compact Framework. There is probably another way to do it, but I doubt it's trivial. 3. PDAs keep the application running unless you explicitly tell it to terminate in your code, or you kill the running process from the Settings | System | Memory control panel. 4. In Visual Studio, Create a CAB setup program. Once the project has been created, there is a place in there to specify a shortcut to the Programs menu. This shortcut can have an icon associated with it. You edit this in the filesystem editor for the CAB setup program. Build the CAB project and then run it on the PDA. When your CAB gets installed on the PDA it will place the icon into the special Programs folder as you expect. -Matt
------------------------------------------ The 3 great virtues of a programmer: Laziness, Impatience, and Hubris. --Larry Wall
1.Wanted to receive the events,same like buttons.As my form is very small and needs to handle many events, I wants to use softkeys to reduce some buttons. 2.Wanted to make the form more colorful.Its Ok I managed to change the backcolor property. 3.Yes,I wanted to terminate the code by explicitly mentioning Applicatio.Exit but its just hanging,is there any other way to kill the process safely(programmatically)? 4.Yes,I have tried CAB program, but after successfully running in PDA,I just can't see my app in PDA? Sorry for bugging you with so many doubts,thanks a lot.
-
1.Wanted to receive the events,same like buttons.As my form is very small and needs to handle many events, I wants to use softkeys to reduce some buttons. 2.Wanted to make the form more colorful.Its Ok I managed to change the backcolor property. 3.Yes,I wanted to terminate the code by explicitly mentioning Applicatio.Exit but its just hanging,is there any other way to kill the process safely(programmatically)? 4.Yes,I have tried CAB program, but after successfully running in PDA,I just can't see my app in PDA? Sorry for bugging you with so many doubts,thanks a lot.
1. I haven't tried this, but here is some code I found on the web: http://forums.devbuzz.com/tm.asp?m=38708&p=1&tmode=1[^] 2. Cool. 3. If your app is hanging after Application.Exit() gets called, then there is probably something else in your code keeping it from exiting. Are you using any threads or timers that aren't being terminated before trying to close the application? I have found that when I explicitly call Application.Exit(), it does in fact unload the app as I expect (or at least I've just assumed that and never checked to make sure ;-) ). 4. You will need to specify a shortcut in the "Start Menu" special folder. Take a look at this screenshot: http://www.matthew-long.com/images/installer_properties.png[^] You will also need to specify an icon for you application in the Application Properties like this: http://www.matthew-long.com/images/app_properties.png[^] Finally, you may want to soft reset your PDA. Icons get cached, so they need to be refreshed through a rest in order to show up correctly. Let me know if you have further questions. -Matt
------------------------------------------ The 3 great virtues of a programmer: Laziness, Impatience, and Hubris. --Larry Wall
-
1. I haven't tried this, but here is some code I found on the web: http://forums.devbuzz.com/tm.asp?m=38708&p=1&tmode=1[^] 2. Cool. 3. If your app is hanging after Application.Exit() gets called, then there is probably something else in your code keeping it from exiting. Are you using any threads or timers that aren't being terminated before trying to close the application? I have found that when I explicitly call Application.Exit(), it does in fact unload the app as I expect (or at least I've just assumed that and never checked to make sure ;-) ). 4. You will need to specify a shortcut in the "Start Menu" special folder. Take a look at this screenshot: http://www.matthew-long.com/images/installer_properties.png[^] You will also need to specify an icon for you application in the Application Properties like this: http://www.matthew-long.com/images/app_properties.png[^] Finally, you may want to soft reset your PDA. Icons get cached, so they need to be refreshed through a rest in order to show up correctly. Let me know if you have further questions. -Matt
------------------------------------------ The 3 great virtues of a programmer: Laziness, Impatience, and Hubris. --Larry Wall
Let me try again on number 1. You said Soft Keys and I'm thinking the whole time you meant hardware keys. Anyhow, here is a little tidbit I found this morning on soft keys in Windows Mobile 5.0:
Adding smart keys to an application is as simple as designing a menu. When designing your application, simply create a menu with only two choices. When the application executes, Windows Mobile 5.0 will map each menu choice to a soft key. Windows Mobile 5.0 automatically provides this behavior to any application containing a menu with one or two choices. Menus containing more then two choices are rendered as a traditional menu.
I haven't tested this, but I got it from here: http://msdn2.microsoft.com/en-gb/library/ms839548.aspx[^]
------------------------------------------ The 3 great virtues of a programmer: Laziness, Impatience, and Hubris. --Larry Wall
-
I am developing application in VS2005 C#, Windows Mobile 5. Please help, I have some doubts.. 1. How to code for softkeys in Windows Mobile? 2. How to add background image? 3.If I closed the application, its still running at the background,I stop running programs also its still running,I need to remove the battery to shutdown the application.How to avoid this? 4.How to install exe file with icon/logo to Windows Mobile programs collection? I am a newbie for WM development,So, please bear with my questions.:) Thanks in advance
1. There is codeproject article on capturing hardware key events. 2. You can add a background image to a form by overriding the paint event and using GDI to draw a bitmap on the form. I do this. 3. me.close, then application.exit If you still have the problem use the debugger to see if the application is hanging during the form's dispose event and determine which object is causing the problem.
-
1. I haven't tried this, but here is some code I found on the web: http://forums.devbuzz.com/tm.asp?m=38708&p=1&tmode=1[^] 2. Cool. 3. If your app is hanging after Application.Exit() gets called, then there is probably something else in your code keeping it from exiting. Are you using any threads or timers that aren't being terminated before trying to close the application? I have found that when I explicitly call Application.Exit(), it does in fact unload the app as I expect (or at least I've just assumed that and never checked to make sure ;-) ). 4. You will need to specify a shortcut in the "Start Menu" special folder. Take a look at this screenshot: http://www.matthew-long.com/images/installer_properties.png[^] You will also need to specify an icon for you application in the Application Properties like this: http://www.matthew-long.com/images/app_properties.png[^] Finally, you may want to soft reset your PDA. Icons get cached, so they need to be refreshed through a rest in order to show up correctly. Let me know if you have further questions. -Matt
------------------------------------------ The 3 great virtues of a programmer: Laziness, Impatience, and Hubris. --Larry Wall
Thanks a lot for your replies. 3.Yes, I am using System.Threading.Timers which triggers CallBack function events every few secs(Certain time interval) which is communicating with the server.We are using Timer.Dispose when App is closing but it not seems to be working, the requests are still going to server,thatmeans timer is running at the background. I have used IDisposable interface to dispose the object possesing Timer, but its throwing StackOver flow Exception on disposing which cannot be handled even by Catch block. After trying all the ways, I finally decided to Kill the Process Programmitically,what do you say? In .NetFramework there is also a method called Environment.Exit but I cannot find it in .NetCompactFramework. Please advise me.. The link you have given in 1 (regarding softkeys),page cannot found is coming,please resend. Thanks again
-
Thanks a lot for your replies. 3.Yes, I am using System.Threading.Timers which triggers CallBack function events every few secs(Certain time interval) which is communicating with the server.We are using Timer.Dispose when App is closing but it not seems to be working, the requests are still going to server,thatmeans timer is running at the background. I have used IDisposable interface to dispose the object possesing Timer, but its throwing StackOver flow Exception on disposing which cannot be handled even by Catch block. After trying all the ways, I finally decided to Kill the Process Programmitically,what do you say? In .NetFramework there is also a method called Environment.Exit but I cannot find it in .NetCompactFramework. Please advise me.. The link you have given in 1 (regarding softkeys),page cannot found is coming,please resend. Thanks again
I know this is stating the obvious but are you stopping the timer first before trying to call dispose? (just want to make sure). Honestly, I think you really need to track down the real issue rather than trying to kill the process. Something is not right in the app and I promise it will not benefit you to just ignore the problem and try to kill the process. That being said, if you really want to kill it, take a look at Process.Kill() here: http://msdn2.microsoft.com/en-us/library/system.diagnostics.process.kill(VS.80).aspx[^] Here's a note from that page:
The Kill method executes asynchronously. After calling the Kill method, call the WaitForExit method to wait for the process to exit, or check the HasExited property to determine if the process has exited.
I am not familiar with Envrionment.Exit(). You'll probably have to use something else, though, since it is not available in the compact framework. And as far as the link in #1 goes, don't worry about it. If you see my previous post (where I respond to myself), you'll see that I was sending you to look at a link about hardware keys, not softkeys. -Matt
------------------------------------------ The 3 great virtues of a programmer: Laziness, Impatience, and Hubris. --Larry Wall
-
I know this is stating the obvious but are you stopping the timer first before trying to call dispose? (just want to make sure). Honestly, I think you really need to track down the real issue rather than trying to kill the process. Something is not right in the app and I promise it will not benefit you to just ignore the problem and try to kill the process. That being said, if you really want to kill it, take a look at Process.Kill() here: http://msdn2.microsoft.com/en-us/library/system.diagnostics.process.kill(VS.80).aspx[^] Here's a note from that page:
The Kill method executes asynchronously. After calling the Kill method, call the WaitForExit method to wait for the process to exit, or check the HasExited property to determine if the process has exited.
I am not familiar with Envrionment.Exit(). You'll probably have to use something else, though, since it is not available in the compact framework. And as far as the link in #1 goes, don't worry about it. If you see my previous post (where I respond to myself), you'll see that I was sending you to look at a link about hardware keys, not softkeys. -Matt
------------------------------------------ The 3 great virtues of a programmer: Laziness, Impatience, and Hubris. --Larry Wall
Hi perlmunger Thanks a lot for your advises,they are very useful for us , I will avoid using Kill method and try to trace out the wrong thing in my App. I will get back to you if any doubts. Thanks Aruna