locked
backlight brightness in MIO devices RRS feed

  • Question

  • Hi, I'm working with MIO PDA Navigation Devices on Windows Mobile 6.1,

    I've developed small code changing system registry which should change backlight brightness,
    but it doesn't work.
    I'm sure the "registry part" is correct, I've read that I should raise a system event in order to make system read new values, but I don't know what's the event name...

    My code:
    RegistryKey key = Registry.CurrentUser.OpenSubKey("ControlPanel").OpenSubKey("BackLight", true);
    int value = (int)key.GetValue("Brightness");
    key.SetValue("Brightness", (value + 1) % 10, RegistryValueKind.DWord);
    key.Close();
    DoAutoResetEvent("BackLightChangeEvent");
    I've tried "BackLightChangeEvent" and "SKDBackLightChangeEvent" with no results...
    Saturday, April 18, 2009 10:29 PM

All replies

  • Hi Karpik,

    Since you don't provide the completed code, we can't say why you are getting the problem, there is a sample for how to create auto reset event:
    http://social.msdn.microsoft.com/forums/en-US/vssmartdevicesvbcs/thread/ba81a221-40a9-4739-a7ca-34bddca561e0/
    http://social.msdn.microsoft.com/forums/en-US/netfxcompact/thread/c434b5fd-9a47-40a5-81ef-1cde7a78f260/


    If you still can't solve it, please provide completed code.


    Best regards,
    Guang-Ming Bian - MSFT

    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    Wednesday, April 22, 2009 8:53 AM
  • sorry, I completely forgot about DoAutoResetEvent code
    thanks for the reply

    I checked my MIO registry and there's no "ReloadEventName"...
    http://img245.imageshack.us/my.php?image=registryeditor.png

    my code:
    //pinvokes
    
            [DllImport("CoreDLL.dll")]
            public static extern IntPtr CreateEvent(IntPtr alwaysZero, bool manualReset, bool initialState, string name);
    
            [DllImport("coredll.dll", SetLastError = true)]
            public static extern bool EventModify(IntPtr hEvent, EVENT ef);
    
            public enum EVENT
            {
                PULSE = 1,
                RESET = 2,
                SET = 3
            }
    [DllImport("CoreDLL.dll")] public static extern int CloseHandle(IntPtr handle);

    private static void DoAutoResetEvent(string eventString) { IntPtr newHandle = IntPtr.Zero; try {
    newHandle = CreateEvent(IntPtr.Zero, false, false, eventString); EventModify(newHandle, EVENT.SET);
    CloseHandle(newHandle); } catch (Exception ex) { Diagnostics.HandleException(ex, "DoAutoResetEvent"); } finally { newHandle = IntPtr.Zero; } }
    • Edited by Karpik Wednesday, April 22, 2009 9:49 AM code formating
    Wednesday, April 22, 2009 9:34 AM
  • Hi Karpik,

    Your code is right, since backlight is hardware specific, OEMs implement it in their own way. For some devices, you can control it like this way, others can't do like this.


    Please check the FAQ and a article:
    How to control a mobile device backlight?
    http://www.pcreview.co.uk/forums/thread-1298215.php


    Best regards,
    Guang-Ming Bian - MSFT
    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    Friday, April 24, 2009 3:40 AM
  • Ok.
    I know it's OEM's specific, but how does it work?
    In Windows Mobile 6.1 user can go to Start->settings->backlight brightness and there's a slider wich changes brightness every time you move it.
    This settings page is different on every device? MIO people made it?
    Or is there a common API that every hardware manufacturer has to implement, so that "settings->backlight brightness" works on every device?


    I know that I'm missing something, I wrote to "xda people",microsoft and MIO. No one knows the answer.
    I don't belive that it's imposible to do. I just need to know how "settings->backlight brightness" works so I can do the same.
    Friday, April 24, 2009 9:49 AM