Guest gaplayer26 Posted January 13, 2005 Report Posted January 13, 2005 (edited) I've managed to turn the backlight off / on - no problem, but I cannot turn the actual display itselft off. Has anyone managed to do this? The example in Peter Foots blog does not work for the smartphone, only the iPAQ :D <DllImport("coredll")> _ Private Shared Function DevicePowerNotify( _ ByVal pvDevice As String, _ ByVal deviceState As PowerState, _ ByVal DeviceFlags As Integer) End Function Private Enum PowerState PwrDeviceUnspecified = -1 'full on D0 = 0 'low power D1 = 1 'standby D2 = 2 'sleep D3 = 3 'off D4 = 4 PwrDeviceMaximum = 5 End Enum '---Force backlight off... DevicePowerNotify("BKL1:", PowerState.D3, 1) '---D4 powers off the display AND the keypad which is no good Any help appreciated! :D Edited January 16, 2005 by gaplayer26
Guest dieter98 Posted January 23, 2005 Report Posted January 23, 2005 (edited) I think u only can use registry changings. I used this example to set backlight to half power in an application. the problem is, that on keypresses gets full power. so I set the registry setting for backlicht time to 0. But this only works , after a reset. How I can tell driver for backlight that value changed programmatically ? I founf this in C: void SetBacklight(int value) { HKEY hKey = NULL; DWORD dwDisposition = 0; if (RegCreateKeyEx(HKEY_CURRENT_USER, _T("ControlPanel\\Backlight"),0, NULL, 0, KEY_ALL_ACCESS, NULL, &hKey, &dwDisposition) == ERROR_SUCCESS) { // Set backlight value for AC and Battery power if (RegSetValueEx(hKey, _T("ACBrightNess"), 0, REG_DWORD, (PBYTE) &value, sizeof(REG_DWORD)) == ERROR_SUCCESS) { if (RegSetValueEx(hKey, _T("BrightNess"), 0, REG_DWORD, (PBYTE)&value, sizeof(REG_DWORD)) == ERROR_SUCCESS) { // Signal display driver to update HANDLE hBackLightEvent = CreateEvent( NULL, FALSE, TRUE, TEXT("BackLightChangeEvent")); if (hBackLightEvent) { SetEvent(hBackLightEvent); CloseHandle(hBackLightEvent); } } } } } But I need to use the Backlightchangeevent in VB.Net. Changing registry values in VB.net is done.(with OpenNetCF) But never worked with events before . Tried a C to VB converter, but doesnt work. anyone so kind to give me the complete code to use the backlightchangevent in VB.net ? Edited January 24, 2005 by dieter98
Guest gaplayer26 Posted January 24, 2005 Report Posted January 24, 2005 anyone so kind to give me the complete code to use the backlightchangevent in VB.net ? <{POST_SNAPBACK}> The code in my first post should do just what you want - Power off the dislplay backlight (you can choose halfbright, off etc by setting D value). DevicePowerNotify("BKL1:", PowerState.D3, 1) This will power off the dislpay light and keep it off, even if the user presses a key... To restore normal functionality (backllight comes on during keypress): DevicePowerNotify("BKL1:", PowerState.PowerDeviceUnspecified, 1)
Guest dieter98 Posted January 25, 2005 Report Posted January 25, 2005 (edited) Ok, but I mean something other. The code works fine, I can set backlicht to half power an my SP3. Problem is , that keypresses overide it , on keypresses backlight goes to full power for the defined time in settings. So i changed the setting for backlight in registry to 0 programmatically. But this has only effect after a reset, cause driver backlight has not got the changes. Therefore is the backlightchangeevent. U see it at the end of the code i posted. But is C# , i tried to translate it to VB.Net, but failed. Never worked with events before. So I requested the full code in VB.net to raise theat event. After this , keypresses have no effect to the settings from ur code. // Signal display driver to update HANDLE hBackLightEvent = CreateEvent( NULL, FALSE, TRUE, TEXT("BackLightChangeEvent")); if (hBackLightEvent) { SetEvent(hBackLightEvent); CloseHandle(hBackLightEvent); } Edited January 25, 2005 by dieter98
Guest gaplayer26 Posted January 25, 2005 Report Posted January 25, 2005 (edited) Problem is , that keypresses overide it , on keypresses backlight goes to full power for the defined time in settings. hmm, strange. If I use: DevicePowerNotify("BKL1:", PowerState.D3, 1) The backlight stays off, even if the user presses a keypress... :cry: I think we (at least I do!) need Uncle Pete's (Peter Foot) help :D Edited January 25, 2005 by gaplayer26
Guest dieter98 Posted January 26, 2005 Report Posted January 26, 2005 I used value 2 , so display goes to half brightness (Imate SP3), but on keypresses to full power. i also tried the exampele form OpenNETCF with SetPowerRequirement("BKL1:", 2, 1, IntPtr.Zero, 0) but is the same. What SP do you use? I think for my the only way is the Backlightchangeevent to sent registry value to driver. But failed in translate code from C to VBNet. anyone can post the VB code to use this event ?
Guest gaplayer26 Posted January 26, 2005 Report Posted January 26, 2005 What SP do you use? <{POST_SNAPBACK}> I'm using the SPV C500...
Guest Alex_le_brit Posted January 26, 2005 Report Posted January 26, 2005 Sorry to possibly hijack this thread, but would this type of code be useful for dimming the backlight when watching something on Pocket TV? I notice if I'm watching in the dark that the standard backlight setting is too bright for dark scenes, and no amount of adjusting the picture brightness or contrast helps this. If I could set the backlight to lower power it would be much improved. I'm on an SPV Classic, which I notice already has two backlight settings, full power and then a dimmed setting which comes on about a second before the backlight auto powers off.
Guest gaplayer26 Posted January 26, 2005 Report Posted January 26, 2005 Sorry to possibly hijack this thread, but would this type of code be useful for dimming the backlight when watching something on Pocket TV? I notice if I'm watching in the dark that the standard backlight setting is too bright for dark scenes, and no amount of adjusting the picture brightness or contrast helps this. If I could set the backlight to lower power it would be much improved. I'm on an SPV Classic, which I notice already has two backlight settings, full power and then a dimmed setting which comes on about a second before the backlight auto powers off. <{POST_SNAPBACK}> Should do, worth a try...
Guest dieter98 Posted January 26, 2005 Report Posted January 26, 2005 Dim hevent As IntPtr = OpenNETCF.Win32.Core.CreateEvent(False, False, "BackLightChangeEvent") If (Not IsNothing(hevent)) Then OpenNETCF.Win32.Core.SetEvent(hevent) OpenNETCF.Win32.Core.ResetEvent(hevent) End If now I can set backlight on SP on half, keypresses dont override it, and ending my apps BacklightTimeout is reset to old behavior. But if another app ( camera etc,) request full backlight it is full so lang app is in foreground.
Guest gaplayer26 Posted January 26, 2005 Report Posted January 26, 2005 Dim hevent As IntPtr = OpenNETCF.Win32.Core.CreateEvent(False, False, "BackLightChangeEvent") If (Not IsNothing(hevent)) Then OpenNETCF.Win32.Core.SetEvent(hevent) OpenNETCF.Win32.Core.ResetEvent(hevent) End If now I can set backlight on SP on half, keypresses dont override it, and ending my apps BacklightTimeout is reset to old behavior. But if another app ( camera etc,) request full backlight it is full so lang app is in foreground. <{POST_SNAPBACK}> Is that the entire code?
Guest dieter98 Posted January 27, 2005 Report Posted January 27, 2005 No , that is to fire the backlightchangeevent. I do so: read registry vallue current user\controlpanel\backlight\batterietimeout write 0 in this place use ur posted code to set backlight to half my code above for backlight changeevent to stop all : write old backlightvalue back backlightchangeevent to normal settings from ur code must use OpenNetCF tried a lot of use event with normal VB.Net, but all failed, oenNet works so my code looks a little confused at moment, for that many tries I made
Guest Marko31 Posted January 28, 2005 Report Posted January 28, 2005 gaplayer26 if you succeed to do the trick with the SPV C500 can you write an How to do step by step ? Thx in advance sorry for my pidgin english.
Guest dieter98 Posted January 28, 2005 Report Posted January 28, 2005 Try this, OpenNetCF must be installed. ( It based on Torchlite.exe)Backlight.exe
Guest gaplayer26 Posted January 28, 2005 Report Posted January 28, 2005 gaplayer26 if you succeed to do the trick with the SPV C500 can you write an How to do step by step ? Thx in advance sorry for my pidgin english. <{POST_SNAPBACK}> Thanks, but dieter98 appears to be the one with the solution! :D If I do succeed I will post the source :D Try this, OpenNetCF must be installed. ( It based on Torchlite.exe) <{POST_SNAPBACK}> Can you post the source to this? Thanks :P
Guest gaplayer26 Posted January 29, 2005 Report Posted January 29, 2005 (edited) Yes please, if you could post some source code, that'd be great - I'm getting very close to inflicting bodily harm to myself... :| Edited January 29, 2005 by gaplayer26
Guest dieter98 Posted January 29, 2005 Report Posted January 29, 2005 (edited) deleted Edited January 29, 2005 by dieter98
Guest dieter98 Posted January 29, 2005 Report Posted January 29, 2005 Here is the code I played around with. Maybee it looks a little bit confused, but was only for testing and I took the relevant things from it in another app. Try to improve it or not.BackLite.zip
Guest Marko31 Posted January 29, 2005 Report Posted January 29, 2005 Thx for your reply ! :D well i can't get Backlight.exe to work with my SPV C500, you say that you have to install opencf.net, but how to ? I have download SmartDeviceFramework12 here at http://www.opennetcf.org/CategoryView.aspx?category=Home But i can get it to works with my windows sp2, it says Microsoft visual studio.net 2003 with the compact framework is required ... Anyway thx dieter98 and gaplayer26 for the aswers !
Guest dieter98 Posted January 30, 2005 Report Posted January 30, 2005 I tried to build a cab for this all, but got error: Cabwiz.exe could not be invoked Whats wrong ??
Guest gaplayer26 Posted January 30, 2005 Report Posted January 30, 2005 I tried to build a cab for this all, but got error: Cabwiz.exe could not be invoked Whats wrong ?? <{POST_SNAPBACK}> You need to use CabwizSP for smartphone builds. It's part of the WM2003 SDK. I use it like this from a batch file/command line: "C:\Program Files\Windows CE Tools\wce420\SMARTPHONE 2003\Tools\cabwizsp.exe" "D:\Data\My Documents\Visual Studio Projects\****PROGRAM HERE***\obj\Debug\***PROGRAM INF HERE***.inf" /dest "D:\Data\My Documents\Visual Studio Projects\****PROGRAM HERE***\obj\Debug" /err CabWiz.SMP.log /cpu ARMV4
Guest dieter98 Posted January 30, 2005 Report Posted January 30, 2005 (edited) Found this out also, but in batch file there isd a complete different path for cabwiz. How to tell VSNet the right path, didnt found out it. To lazy to type in batch. Hey, but now a can copy and past from ur post! But there is also the new pass to set in the inf file at several places. But how to set the right path in VS , so that i must not do all that changes in the bat and inf file ? Edited January 31, 2005 by dieter98
Guest dieter98 Posted February 1, 2005 Report Posted February 1, 2005 Thx for your reply ! :D well i can't get Backlight.exe to work with my SPV C500, you say that you have to install opencf.net, but how to ? I have download SmartDeviceFramework12 here at http://www.opennetcf.org/CategoryView.aspx?category=Home But i can get it to works with my windows sp2, it says Microsoft visual studio.net 2003 with the compact framework is required ... Anyway thx dieter98 and gaplayer26 for the aswers ! <{POST_SNAPBACK}> here is a simple verion without opnnet, plz try it.BackLite.exe
Guest robertperalta Posted February 6, 2005 Report Posted February 6, 2005 Hi All, Can someone please make a .cab file for this. I would like to try it on my Audiovox SMT5600? Thanks! 8)
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now