(UPDATED 18-09-2010) Auto Lock (CSDEVCTRL)

Search This thread


Inactive Recognized Developer
Mar 4, 2005
Hi all,
as am now moving to a more open platform (android), i would like to return the favor of learning through this forum, how to program on win mobile by posting the code of this utility.

Its given as is, no warranties, no tricks, do not expect a well written code etc.
Based on C++, no .Net.

Hope will provide to someone, knowledge and info on this subject.

Have fun with it.

This is the link


--- Old introduction ---
Hi all,
this is mainly an auto locking program which utilizes the Windows Locking for partial locking (phone related keys are active)
or complete locking (no keys are active).

It can be considered as an add-on to other programs which provide the User Interface, an 'In Call Locker'
with some goodies as mentioned later on which may or not depend on whether the device is locked (with any program that uses
the Windows locking).

The locking can be activated at the following events:
1. After a specified period of idle time (no screen tapping or touching the keyboard).
2. After the device has waken up.
3. During a call ("In-Call Locking" Partial or Full).

Also for any of the first 2 events (idle or wake up) the program can run a specified executable/registered file together with any command line arguments that might be required.

Finally, some 'goodies':
(Stand-alone means it does not require any other option or the device to be locked)

A.(Stand-alone) it can provide some customization on the carrier name so that:
- It can fit on the screen (for example not to overwrite the Battery icon in SPB Shell).

B. (Stand-alone) Turn on Bluetooth if a call is being dialed or received. Then switch it off after
the call has ended and the headset is not connected.
Usefull if you have a bluetooth handsfree kit in your car and you do not want to keep on turning on/off
the bluetooth.

C. (Stand-alone) Flash the Backlight and or Vibrate while ringing.
At last, you can 'see' if your phone is ringing.

D. Reset the Exchange Server Policy.
Stops the frustrating setting of the password being required after connecting to the exchange server.

F. Turn off the display or/and the device itself.
It can be used as a power saver while playing music etc.

G. Set your favorite SIP (which is being reset back to the default with every soft reset).

H. HotKeys (NEW)
You can assign as sequence of keys to perform an action.
(see http://forum.xda-developers.com/showpost.php?p=3666785&postcount=702)

The parameters that are driving the behaviour of this utility are located at:


The parameters can also be updated using the setup program provided (csdevctrlsetup.exe).

A flow diagram of the parameters that relate to locking, is provided in the zip file for better understanding of their use.

The debugscr.exe program has been added to help identifying the keystroke codes and coordinates. Before this program is executed
the csdevctrl must be stopped as mentioned further down.

To install it:
- Use the cab file provided.

Simply run it and it will create:

- under the 'Program Files' a directory with name CSDevCtrl'
This directory will contain:
csdevctrl.exe is the main program
csdevctrlsetup.exe is the setup program
debugscr.exe is a utility to find the coordinates and keystrokes (optional).

- Shortcuts under the 'Programs'.

- They can be installed either in the internal memory or on a storage card.

To run it:
> Run the Setup program to set the parameters and the Start Up option.
> Run the program (csdevctrl) and it will spawn at the background as another process.
The device will vibrate once to show that the program has started.

To stop it:
> Running the program second time will cause the program to exit (It will show a confirmation window which will close in 3 seconds unless you close it sooner).

To uninstall it:
> Close the process as usual (run it again or kill the process).
> Remove it from the installed programs.
> Also delete the registry key HKEY_LOCAL_MACHINE\Software\CSDevCtrl

As a note, do not rename the csdevctrl.exe as the uninstall depends on this name.

It has been compiled only for WM6.

For more information see the next link:


If you wish to buy me a beer or a pitta of souvlaki for my effort, feel free to click on the link below:


Cheers :)

29/11 - v.6.5 - Added power off after disconnect, support for 6.5 win (beta)
17/09 - v.6.18 - General Policy handling, Dump variables for debugging purposes
04/08 - v.6.16 - Added option for startup delay, Keep the backlight on while on call, lock when dimmed.
27/06 - v.6.15 - Added option to lock only if specific programs are running
20/06 - v.6.14.1 - Fixes.


  • csdevctrldebug.zip
    33.1 KB · Views: 1,218
  • csdevctrl.6.5.CAB
    139.4 KB · Views: 6,045
Last edited:


Mar 15, 2007
this works great on the smartphone but there is a visible window which can be closed too easily with task managers and can't be navigated away from.
any poss you could hide it rather than minimise it?


Senior Member
Nov 18, 2005
i have updated the program to be windowless as you mentioned (attachment replaced)

Hope it works for you.


First of all, thanks for sharing!! This is a very nice app.
I've tested the 2 versions (window and windowless), and I have a suggestion if I may.
I like the idea of the program being windowless, since it becomes more appealing to the eye (I mean, it's great we don't have to see the small window minimize everytime we wake the device), but now, to be able to close the app, we must use a task manager to kill the process(e.g. sometimes we may want to test some other locking software and we need to disable it temporarily). So my suggestion would be that when we run the program once it starts, the next time we run it, it stops. Would that be possible? I think it would make your app perfect!!
Remember, it's only a suggestion.

Thanks in advance.


Senior Member
Nov 18, 2005
What's the purpose of this app, from the description above it looks as though it does what the original lock already does, so I ask again; what's the purpose of this app?

Automatic lock!!
Once your device light gets dimmed, or on device wake up, without having to press the lock button.
Is that clear enough for you?:rolleyes:


Senior Member
Feb 6, 2008
Las Cruces
Just set the time for 0 minutes, and it's locked on wake-up.

Guess the dim part is good, thanks for clearing that up. I guess my brain wasn't working, I couldn't figure out what deemed was.


Senior Member
Oct 15, 2007
now i love the app for what it does... my only suggestions or worries are... after setting that up, i no longer am able to input a password when the lock is activated... and when the program is activated, it wakes the device up from the dimmed, light, thus defeating the purposes of the backlight going off... and also draining the battery a little more... is there ayway that the program can run without waking the device?


Senior Member
Mar 16, 2007
and when the program is activated, it wakes the device up from the dimmed, light, thus defeating the purposes of the backlight going off...
I have had this happen to me sometimes as well, already in my short testing time span: when pressing the power button (once) the backlight switches off and back on!

I am also experiencing that it sometimes just does not seem to lock: when pressing the power button twice (with pause) my device only sometimes locks.

And in case you are open to another suggestion: perhaps you can minimize all windows when locking, so the lock ends up on the today screen; or make it an option somehow (command line parameter?)


Senior Member
Apr 1, 2006
And in case you are open to another suggestion: perhaps you can minimize all windows when locking, so the lock ends up on the today screen; or make it an option somehow (command line parameter?)
Another vote for that!

TBH the only reason I still use S2U is because I can see my missed calls, appointments etc. It's a great app, don't get me wrong, just not something I need.

Your locker would be perfect for me with an option to go back to Today on locking.

Or, perhaps you could implement a simple count of missed calls, SMS, MMS, emails and appointments directly on the lock screen? Just don't let it grow too much!
Last edited:


Senior Member
Apr 1, 2006
Why don't you add an option of command line parameter specifying a program/link to be launched before locking? That way it would be very flexible (there are plenty of small programs around doing loads of stuff - like minimizing everything or sending a text or calling your mama - possibilities are endless) :D


Inactive Recognized Developer
Mar 4, 2005
Program has changed as per your advices:
- Leaves the device in idle state for better power management
- Run an application while trying to lock by reading a file.

I have updated the first entry of the thread with some more info and the file.

Any comments are welcome.



Senior Member
Apr 1, 2006
I love it. It's simple and effective. Just the way I like things. I'll keep testing it for a while and report back.

I've got another idea actually.TODAY option works really well, the only 'problem' (its not a problem,just room for improvement :) ) that you need to reopen all the windows you had opened before.

How about an option TODAY&BACK when the minimised windows would be reopened when unlocked? In other words-minimised when locked, back to what it had been before locking when unlocked? It would make it perfect (until next idea strikes) :)
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone