Capture VK_OFF Button - Windows Mobile Development and Hacking General

Hi,
another question (seems I'm diving deeper and deeper into Windows Mobile...): Is it possible to capture the VK_OFF button event for, e.g., disabling powering off the device?
I've already managed to set a hook (SetWindowsHookEx(WH_KEYBOARD_LL,...) and to define a callback function that is called whenever a low-level keyboard event occurs. Thus, I can manage to capture various hardware buttons of the device, but the power off button does not cause the callback function to be called at all.
I'm programming a HTC ARTEMIS, using MS visual Studio 2005 (native c++)
Regards,
Günther

You can also get a notification about power(RequestPowerNotifications) and you can prevent power off I think.
You need disable power toggle or use power button?

o.k., I'm now able to receive power notifications. What I want is the following: There is a running thread from my application that reads out GPS data and sends them over GPRS to a remote serve.
When the device goes to suspend state, these tasks also stop - and this I'd like to avoid. Do you think I can work with SetPowerRequirement()? But for which devices would I have to manually set the power requirement, and how are they named?
Or what to do when the Message Queue receives a notification from RequestPowerNotification? (Moreover, it seems that when the Suspend-notification arrives, the watching thread has already been suspended and does not do any more action...)

http://htc-devs.com/forum/index.php?topic=158.0

Thanks, that was a great site - so I understand that it is not possible to intercept power button pressed before the OS gets notified and takes an action
But I think, I could implement a workaround as follows:
1. Requesting power notifications
2. When a notification arrives, immediately SetSystemPowerState() to POWER_ON (without checking the type of notification as this obviously could not be done before the system goes into suspend mode)
3. Process all messages in message queue (in order to prevent from getting into an infinite loop)
4. Wait for next power notification (goto 2.)

Related

xda2 hints and tips

these are just a few hints and tips please feel free to add more
xda2 gprs switch off
this is a little known feature, but one which is very very useful. if your xda2 for some reason connects to a gprs connection you can easily turn it off again by pressing the red button (phone down key) for 2~3 seconds. avoiding the problem of having to switch off and switch on the wireless connection.
###############################################
xda2 speaker phone
when in a call, you can activate the xda2 speaker phone by pressing the green button (pick up phone) for 2~3 seconds.
###############################################
xda2 camera
when using the camera you can press the top left button on the handset (contacts button) to change the orientation of the icons on the screen.
###############################################
screen brightness
the screen is a very bright one, squeeze more life out of the battery by turning it down. go to start - settings - system - power : click on the word back light at the bottom and adjust to about half way for when running off the battery. half way is a very usable brightness, you can go lower if you don't mind it being slightly dim.
###############################################
accidental pressing of buttons
by default pressing any button on the xda2 will switch the machine on. you can stop all buttons activating the xda2 (bar the power switch) by going to start - settings - button lock : select lock all buttons except power button.
###############################################
sending a video clip via mms
to send a video clip via mms you have to change the format to which it is saved. go to start - programs - camera (or just start the camera). click on the screwdriver and wrench icon. click tools - options : click the video tab. in the capture format drop down box highlight H.263 - this is the standard 3gp mobile video phone format.
###############################################
adding your own sound to a xda2 action
you can add your own sounds to xda2 notifications, like receiving an sms, by simply creating the sound you want as a wav file. you can do this on your main computer (sound recorder in "start - programs - accessories - entertainment - sound recorder" is a simple piece of software to do this). then pass the file onto the xda2 using activesync / email / etc... you must copy the file into the "my device - windows" folder using file explorer. next go to settings, choose "sounds & notifications". click on the notifications tab, choose the event you want to assign the sound to e.g. "inbox: new sms message". make sure play sound is selected with a tick - now choose the sound that you have just copied into the "my device - windows" folder from the drop down box.
Nice one..
One or two i didnt know...
Thanx...
ignoring incoming calls
A helpful one:
When u receive a call that u don't wanna answer, instead of rejecting it by pressing "ignore or the red phone button, u can push the volume button up or down putting the ringer off. The caller won't get the busy signal and won't know u deliberately rejected his call. :wink:
When Phone application is active, pressing the 5-way navigation key
Up: goto call history
Down: goto speed dials
When sound is turned off (ie X) then pushing volume slider up once will take it to vibrate mode, and pushing again takes u back to normal sound levels.
Doesn't seem to be a way of doing the reverse though?
battery saving
install software that you use often on your XDA storage and NOT on an extra SD storage card. This saves much battery (less card-IO).
Abroad meeting/appointment alerts
If you travel a lot for meetings in different time zones, don't creat the calendar entry in your current time zone, instead, change the time zone to the destination, creat the calendar item then get back to your time zone. Otherwise the reminder will not set off properly.
1. pressing and holding the power button for 2-3 sec toggles the backlight on/off
2. Hold the Action Button and tap on the clock at the right hand corner of the screen; It will pop up a menu with the Run Option. Then you can use the run as your command prompt.
3. how to:
http://www.pc-counselor.8m.com/How_to/index.htm
Hi, I could not find how to decrease or stop the volume of reminders' notification. I find it so irritating when it rings increasingly, and so difficult to stop as I must first open the screen before being able to press the screen and stop it.
Cool... Nice one dude!

Toggling touch-screen on/off

Does anyone know a software that can toggle touch-screen feature on/off on Magitians?
I don't mean blanking the screenduring a call, but rather a program that blocks screen tapping. I want to operate my S110 with buttons without worrying about accidental screen touches.
Hi
You can always use TPenable.exe and TPdisable.exe from any Extended ROM.
Good luck
Thanks but... TPDisable.exe disables all buttons also. So, it doesn't work for me.
Hi, do a search for "mortsaver".
I know MortSaver. This program turns screen off entirely, not only touch-screen feature. So, doesn't work for me either.
amed said:
I know MortSaver. This program turns screen off entirely, not only touch-screen feature. So, doesn't work for me either.
Click to expand...
Click to collapse
As far i understud, you can configurate it to do what ever you need:
"What is it good for?
MortSaver is a combination of screensaver, keylock, and a "stay off!" function.
Screensaver:
The display's turned off, but the PPC keeps running (e.g. for audio players). In spite to other tools, MortSaver turns off the dispay again if it's been switched on by e.g. an alert or the on/off button.
Keylock: All buttons (except the one necessary for deactivation, of course) are locked, as far as it's possible to me. A few programs sadly use some undocumented tricks, which allows them to get the button presses even if they're assigned to MortSaver in the system, or set themselfes as topmost window, by which the direction pad keys will be sent to this window. Disabling MortSaver can be done either with one button or a sequence of two buttons.
"Stay off!": PocketPCs are often switched on by themselves or accidentally - by alerts (appointments, SMS, ...) or accidental button presses in your pocket. In those cases, MortSaver can turn off the device again after a selectable timespan (so you recognize MortSaver's active and the device alive).
After power on or system-caused disabling of the screensaver, MortSaver shows a countdown until the screen or device (depending on settings, also see instructions), the button(s) to deactivate it, the time, battery level, a user definable text (e.g. owner infos), and on Phone Edition devices also signal strength and hints about missed calls and SMS."
Source Official mortsaver web page:
http://www.sto-helit.de/modules/edito/content.php?id=36
I am not saying that Mortsaver does not deliver what promises. Simply I am looking for something different.
To rephrase what I need in other words:
1/ having screen on (to see what is on the screen)
2/ having device making no reaction on screen taps
3/ having all button working (slider, power, application)
I've configured my S110 to operate and run everything I need on the run by one hand using just buttins. But quite often accidental touch by finger or cloth (when I pulling it of the pocket or putting it back) stops what I run or making a second call to the person I've just talked.
Ok, now i get your meaning. Perhaps yo can ask directly to mort developer as i did many times at his own email witch you can find at his web page.
Look for Pocketmax ScreenGuard works perfectly. Costs some money though.
ScreenGuard ( http://www.pocketmax.net/screenGuard.htm ) still locks the buttons, though? Except for the green call button - and then only when you also use their PhoneAlarm app.
ScreenGuard falls close to what I am looking to. But it locks buttons and couple of times it locked "too good" - I couldn't unlock my device and needed to HR.
maybe u want to try this...
assign it to any button to lock....
to unlock, hold record button and calendar button...
i assigned it to record button for easy usage...
cheers...
nonentity said:
maybe u want to try this...
assign it to any button to lock....
to unlock, hold record button and calendar button...
i assigned it to record button for easy usage...
cheers...
Click to expand...
Click to collapse
But this one also turns screen off :-(

DeviceLock + Volume Control

I've found a wonderful opensource device lock application (deltaLock). It can lock the device using hardware buttons and can keep device locked even if device was waked up by sms or gprs connect attempt. BUT. As far as I use my phone for playing music I conclude it is not very handy to have volume buttons nonfunctional. I have just added ability to control volume while device is locked.
The applications consists of two exe files. First, deltaConfig is used to set key codes for unlocking / controling volume. Second, deltaLock, locks device. You can set two keys for unlocking (they have to be pressed simultaneously) and one for each "Volume Up", "Volume Down", "Mute". By pressing volume buttons system sound volume changes, so it is useful not only when music is playing but also when the phone ringing or you are in the middle of conversation. By now, there are 10 sound levels available (common 5 is not enough for me but 10 is ok), it could be increased later (sound volume variable type in windows systems is word, so it can be any integer in range [0..2^16-1].
The best way to lock your device is to bind deviceLock to one of hardware keys. It can be done by Settings->Button, but it is better to configure unlock buttons first
Original deltaLock can by downloaded by the link above, deltaLock with volume control - here. Hope somebody will find this little app useful
assigning lock
hi, my wizard doesn't give me the option to assign delta lock with volume control to a hardware key. i did install the original lock first, and after uninstalling it the button assignment screen still has the original deltalock but givs the error message: ...cannot be opened...
any help would be great,
thanks in advance
The easiest way to fix it is to install original deltaLock again and then simply overwrite files in /program files/deltaLock with those unpacked from archive i provided (just copy deltaLock.exe and deltaLockConfig.exe from archive to /program files/deltaLock folder on your pda).
Sorry, i was too lazy to make an installer, but i'll fix it soon
I made a cab installer
working
many thanks, it's working perfectly now
You're welcome. Glad it's working now.
Hello there,
Thanks very much for that great program, in fact I have another issue, my Volume Control Scroller is not woring at all in my PDA2k (WM5), so it is impossible for me to mute the ring if i don't want to answer the phone, so what i am really searching for is a program like yours but without Device Lock, is there any program that I can change some buttons on my device(while PDA2k has many) to control volume?? I hope i can find like this program with you...
Thanks again,
Ghaith
umm
check AE Button Plus but it isn't free
hey, thanks alot, I tried the program, and it is working for volume control, but while Phone is ringing, these volume controls are not working, so I got nothing
anyway thanks again
Any additional Functions for a Great Program?!?!
Your program seems to be exactly what i am looking for. I carry a veriation of the HTC Wizard branded the Cingular 8125. I hate accidently picking up calls or dismissing messages or alerts when the device is in my pocket, briefcase or while pulling it out of the holester. Your program seems to be right up the alley of what I am looking for. Are any of the programs perameters user definable?
What I mean is, I just don't want to accidently answer a call or ignore a call. Nor do I want to accidently start a program, dismiss an sms, email, reminder or alert. But I would like all of the functionality of the volume slider to mute ringers on incoming calls until they go to vm and use my Windows Media Player and all of its functionality at the same time. I know this seems like having my cake and eating it too, but I have to think these devices are smart enough to handle it.
My idea would be a Device Key Lock user interface where eu had the ability to define through check boxes what programs to allow or not allow while the device or keys where locked. And that all of the functionality of the programs allowed where available.
Is it out there?
Thanks
CG
Part 2
Also a way to define how much time would go by before the device would lock on its own.
CG

[REQ]Auto device lock/unlock based on power button

Hey!
Is somewhere out there an application or some sort of WM modification that would make the default WM device lock power-button-sensitive? The current one (if you enable it in Advanced Config) turn itself automatically on when you put the device into standby (by power button, for example) but when you press the button again, you have to unlock the device. That wouldn't be a problem if the TouchFLO 3D clock updated, but when the device is locked, the TouchFLO 3D clock doesn't update itself.
So I would like to have a keylock that would automatically lock the device if the power button is pressed (or the device is in standby) and automatically unlock when the power button is pressed again (or there's incomming call). But the important thing is that it would keep the device locked when some appointment showed up or something like that.
I've been searching the net and all possible forums and sites but ran out empty - no such application od modification found. Can anyone help? Maybe the csdevctrl (v.4.01) may help but I don't know how to set it properly.
wizaard said:
Hey!
Is somewhere out there an application or some sort of WM modification that would make the default WM device lock power-button-sensitive? The current one (if you enable it in Advanced Config) turn itself automatically on when you put the device into standby (by power button, for example) but when you press the button again, you have to unlock the device. That wouldn't be a problem if the TouchFLO 3D clock updated, but when the device is locked, the TouchFLO 3D clock doesn't update itself.
So I would like to have a keylock that would automatically lock the device if the power button is pressed (or the device is in standby) and automatically unlock when the power button is pressed again (or there's incomming call). But the important thing is that it would keep the device locked when some appointment showed up or something like that.
I've been searching the net and all possible forums and sites but ran out empty - no such application od modification found. Can anyone help? Maybe the csdevctrl (v.4.01) may help but I don't know how to set it properly.
Click to expand...
Click to collapse
Wrong thread, you might go to here http://forum.xda-developers.com/showthread.php?t=398571 for general Q&A. Cheers.
wizaard said:
Hey!
Is somewhere out there an application or some sort of WM modification that would make the default WM device lock power-button-sensitive? The current one (if you enable it in Advanced Config) turn itself automatically on when you put the device into standby (by power button, for example) but when you press the button again, you have to unlock the device. That wouldn't be a problem if the TouchFLO 3D clock updated, but when the device is locked, the TouchFLO 3D clock doesn't update itself.
So I would like to have a keylock that would automatically lock the device if the power button is pressed (or the device is in standby) and automatically unlock when the power button is pressed again (or there's incomming call). But the important thing is that it would keep the device locked when some appointment showed up or something like that.
I've been searching the net and all possible forums and sites but ran out empty - no such application od modification found. Can anyone help? Maybe the csdevctrl (v.4.01) may help but I don't know how to set it properly.
Click to expand...
Click to collapse
StylusLock is locking the device and keeps running programs updating the screen (so is not interfering with them). But probably this is not what you requested, because it is not controlled via the power button, but the stylus.
Thanks for reply, but that's not what I'm looking for.
wizaard said:
....one (if you enable it in Advanced Config) turn itself automatically on when you put the device into standby (by power button, for example) but when you press the button again, you have to unlock the device.
Click to expand...
Click to collapse
How do you do this in Advanced Config? I can't see it anywhere!!!
mayb he meant diamond tweak. there is a option called autolock. when ur backlight goes off or u turn off the screen it will lock the device.
Advanced Config 3.3: Screen -> Auto device lock & timeout.
I dont have that option on my HD with advance config
my solution
I had same problem and auto device lock did not solve it. because I don't want the device is auto locked when the screen is on. It should only be locked when the screen is off and device is waken up by power button or any call/sms/alarm event.
- Battery Status plugin was able to do this great but it does not work stable with TouchFlo 3D.
- To lock the device automatically on wakeup ThrottleLock is a great application but while it locks the screen clock and today screen is not updated.
- I also tried VJDeviceLock but it did not work automatically on wakeup. But when you execute VJDeviceLock.exe it locks the screen manually using the device lock of Windows Mobile.
To solve these first I installed VJDeviceLock and then ThrottleLock. Then I copied VJDeviceLock.exe into ThrottleLock folder in the name of ThrottleLock.exe. Now every time I wake up the device screen is locked by Windows Mobile's devicelock instead of ThrottleLock's pattern based custom lock screen.

Volume rocker activated call?

I was looking at fake call apps for my GS4 to get me out of awkward situations.
But a lot of the good ones are missing one critical feature...being able to use it AT ANY GIVEN MOMENT!
A lot of them just have a timer (15 secs, 30 secs etc) but its a bit obvious to pull out a phone, set the schedule and BOOM 15 secs later i get a 'phone call'.
I want to be able to casually reach into my pocket, hold down the volume rockers for a few seconds and activate my pre-configured 'call'.
Then i found a couple of phones that had an excellent implementation of this: the Samsung S5511T & Samsung Intensity III.
Short story long, anyone know of an app (free or paid) that has this?
I don't know any app to do that but I think you can achieve this by using an app like Tasker to do that. Tasker is an app which allows you to perform something in a specifical context.
Configure Tasker in order to open the app which simulate a call when : screen is turned off and long press volume down button.
Hope it will help you
Thanks for the suggestion i installed tasker and have Fake Call & SMS installed
I can get the app to open using the headphone jack (best hardware option i could find) but what commands would i need in the IF statement section to make a call?
For the context I think it is possible to find a more apropriate context, ask google about tasker (Or maybe an app similar to tasker exist and has this feature)
For the fake call I think there are two options :
- you can try to create a task (in tasker) which unlock your phone and launch the app. Next, maybe tasker can emulate a press on the touchscreen. But I'm sure Tasker can emulate the press of a button, so see in your app if the press of a button can launch the fake call.
-or (I think it's an easier way) you can create a task which will : make your phone ring and vibrate and open a screenshot of a lockscreen wiwh an incoming call). Then, you only have to configure your task to stop the ringtone when you touch the screen or press a button.
1)Root your android device (most important!)
2)Get Pressy
3)Get Tasker
4)Create a Tasker profile to simulate a fake call
5)Create a Pressy button action to activate the fake call Tasker profile
6)Enjoy! :good:

Categories

Resources