Preserving, Protecting, and Enhancing the Environment
 



Home

Calendar

News

Discussion


Software Tools


Hardware

FAQ

References

Downloads



Login
Register

This content of this website is provided by LearningCE.com and the supporters of the Windows Embedded Student ChallengE. No endorsement by Microsoft is implied.


Home > Discussion > Software Tools

ChallengE Software Development Tools

Author Thread:
Windows Mobile 2005 Using C#
lhalverson
Windows Mobile 2005 Using C#
Posted: Friday, April 14, 2006 8:16 AM (PST)

Full question:

Hi folk,

 

This is Rakesh working with Windows Mobile 2005 using C#. I have few basic  and I spent around a week on this so had nice thought to write U all.

  

My all doubt is related to Windows Mobile 2005(WM5) with C# and I m using the device Treo 700W.

 

 1 .How to know the running instance. Simply I want to run only one instance of my application on device.

 

2. How to run an application in unattended mode.

I have written a SMS listener using SNB in managed code(C#). But I have done the same using a windows form, I want this application to be run unattended, I do not wanted to show my form to the user.

Simply I want this SMS listener running as a service as our SQL Mobile runs in background. It would be very helpful if I get the code in C#

On Form Load this.Visible = false; does not work at all, forms come as popup in full screen.

  

3.How to do Hard reset of the device through code. Do not ask the need, I have identified the need( for theft protection) I will push the same form the server. I have tried with the following code but it does only soft reset...

  

 

      [DllImport("Coredll.dll")]

 

        extern static int KernelIoControl(int dwIoControlCode,

 

            IntPtr lpInBuf,

 

            int nInBufSize,

 

            IntPtr lpOutBuf,

 

            int nOutBufSize,

 

            ref int lpBytesReturned);

 

 

 

        [DllImport("Coredll.dll")]

 

        extern static void SetCleanRebootFlag();

 

 

 

        public static void ResetDevice(bool l_Is_HardReset)

 

        {

 

            int IOCTL_HAL_REBOOT = 0x101003C;

 

            int bytesReturned = 0;

 

            if (l_Is_HardReset == true)

 

            {

 

                SetCleanRebootFlag();

 

            }

 

            KernelIoControl(IOCTL_HAL_REBOOT, IntPtr.Zero, 0, IntPtr.Zero, 0, ref bytesReturned);

 

     }

Even though I pass true to this function, it does only soft reset. Please let me know where and what I am missing. I m using Treo 700W device for the development.

 

Please let me what other information you guys need from me to sole these. I have more Q to ask but all these on priority.

 

For my development I m targeting 15,000 device so I request u all to help me in this regard.

   

Thanks in anticipation.

   

Thanks & regards,

Rakesh Ranjan


Comments:

Author Thread:
jywilson
Windows Mobile 2005 Using C#
Posted: Sunday, April 16, 2006 11:46 AM (PST)

This site is really focused on supporting the students engaged in the Windows Embedded Student Challenge, which uses a device called the eBox (not a Treo 700W).

I would recommend that you visit this site for questions related to the .NET Compact Framework for Windows Mobile devices.  Perhaps they can help with your questions.

Jim

RLW
Windows Mobile 2005 Using C#
Posted: Friday, August 10, 2007 11:47 AM (PST)

Thank you very much for your provided code! It works on my device WM5 DELL AXIM x51v pocket PC. It did a hardreset when I passed a true, or a softrest when false.

Many Thanks.

 

sarafuddin
Windows Mobile 2005 Using C#
Posted: Monday, October 06, 2008 1:58 AM (PST)

hi rakesh,

here are the answers to your doubts :

1. .How to know the running instance. Simply I want to run only one instance of my application on device

Answer : you do not have to worry about this, as in windows forms for desktop application. The compact framework is desgined to automatically handle this. So whenever you run an application. the CF determines automatically whether an instance of it is already running. is so it just brings the running instance to front. if not it starts a new instance of the application. So you need not write a single code to get this behaviour.

2. How to run an application in unattended mode.

I understand that all you are trying to mean is that you want to write a windows service. Please note that this is only possible if u are writing native code, in which case there is a completely different method. As in your case which is managed code you need to follow these steps :

a.) Create a console application for the device type using visual studio.

b.) call you codes from ( or simply write them in the main method).

c.) save the compiled application in the following path of your windows mobile : Windows/Startup/

d.) you may also automate the process of manually saving it in startup folder by creating a setup project so giving information in the filesystem to including a shortcut to folder : Windows/Startup/youapplication.exe

let me know if you need help on the setup project creation.

 
Hosted By: LearningCE.com

New Posts

  • LogoScreen Windows CE 5.0
    Posted by PaleX on Friday, August 21, 2009 (PST)

  • Device Management Server
    Posted by BigDoc on Wednesday, October 31, 2007 (PST)

  • Launching Application in CE
    Posted by user404 on Thursday, October 18, 2007 (PST)

  •  

    New Downloads

  • Transcript of 4/11 WESC Chat for Teams in N and S America/Europe
    Transcript of the 4/11/06 technical chat held for teams in N and S America and Europe.

  • Transcript of 4/13 WESC Chat for Teams in Asia/Australia
    Transcript of the 4/13/06 technical chat held for teams in Asia and Australia.

  • Transcript of 3/30 WESC Chat for Teams in Asia/Australia
    Transcript of the 3/30/06 technical chat held for teams in Asia and Australia.

  •  

    New Events

  • ChallengE Finals
    The finals will be held in Redmond, Washington on June 23-24, 2006

  • Finalists Announced
    The finalists for the ChallengE will be announced on this date.

  • Judging of Final Reports Ends
    Judging Ends...



  • Last Refreshed 2/5/2012 9:00:54 AM
    Home   |  Calendar   |  News   |  Discussion   |  FAQ   |  References   |  Downloads