views:

227

answers:

2

Is there any way to get taskbar's battery and phonesignal indicators icons and then draw into a picturebox or something?


Why do I need this?

I need all screen space available, so all forms are maximized and they cover up the windowsmobile taskbar. But, I have to display information about battery e phone signal strength in just a couple of forms.

I know how to get their values (like systeminformation.phonesignalstrength), but what I want is the "current icon", so I don't need to worry about their values. It's just a visual information for the user.


In last case, if this is not possible, how to get those icons from windowsmobile shell, so I'll draw them by my self, treating each differente status/values that they assume. (This is what I don't want to do!)

Thanks in advance and sorry for my poor english.

A: 

There is already similar example available. Have a look.
I would have pasted the code for it, but it is in C++ and it would be huge to paste it all here :) You would need to covert that C++ code to C#.

You will need to -
1. Find the handle of system tray.
2. Get number of buttons (that's right) in the tray.
3. For each button...
  a) Read button data buffer.
  b) Get TRAYDATA from that buffer.
  c) Get Icon related to this TRAYDATA object instance.

ImageList Image16List = new ImageList();
...
ICONINFO  iinfo;
if(GetIconInfo(tray.hIcon,&iinfo) != 0) {
    int iconindex = Image16List.Add(tray.hIcon);
    //do stuff
}

Another very good article link here.

Nayan
A: 

Most of the taskbar images are stored as .BMP files in the \Windows directory. For example, in Windows Mobile 6, the battery image is located in \Windows\battery.bmp. You can use Windows Mobile Device Emulator and Remote File Viewer to copy the files to your PC. The images are sometimes different in different versions of Windows Mobile.

Trevor Balcom