473,401 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

control panel items

how can i put each control panel item in a dropdown menu in context menu, WITH their icons
Aug 6 '09 #1
10 4203
ThatThatGuy
449 Expert 256MB
give us a little bit long description of your problem....
and what do you exactly mean by control panel item...
Aug 7 '09 #2
Start Menu> Control Panel> All Items, i want all those items with their icons in a drop-down context menu, am i clear now? i have no idea how to do it, no base for it.
Aug 7 '09 #3
GaryTexmo
1,501 Expert 1GB
On an XP system, those items are actually files in a directory...

The ones for all users are stored in...
C:\Documents and Settings\All Users\Start Menu

And any special ones for a specific user are located in...
C:\Documents and Settings\<user>\Start Menu

You could read this directory and load the items into your drop down that way. As for their icons, you might be able to get that from a File class, but I'm not sure as I've never looked into it.

Play around and let us know how you do :)
Aug 9 '09 #4
GaryTexmo
1,501 Expert 1GB
Correction, I was thinking of the FileInfo class, but that doesn't seem to have it anyways.

(I'd have edited this in, but it looks like the edit button goes away after a while, so sorry for the 2x post)
Aug 9 '09 #5
sry gary, i didnt find control panel items in that folder on XP systems, any other idea?, for icons i have a IconLib found on codeproject, give it a ico/exe/dll/lnk it will extract icons out of it, u can choose the icon u want, so if i find control panel items that way i can give file path as source and get icon out of it, the dll got a ToBitmap function to convert too.. heres the link to the code project article: http://www.codeproject.com/KB/cs/IconLib.aspx

also i find this: http://www.technipages.com/windows-v...-commands.html but this way i will have to fill the dropdown my own..
Aug 9 '09 #6
GaryTexmo
1,501 Expert 1GB
Oops, my mistake! I was thinking of StartMenu... duh! Yea I'm not sure how to get the items out of the control panel. Even with the link you gave, that just opens it up, doesn't it?

I found a couple of things... maybe they will help?
http://en.wikipedia.org/wiki/List_of..._%28Windows%29
http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx

Also, for loading the icon, I have a simpler approach that may help you. I found the core code for this from a google search, then used it to create an extended file info class. You're more than welcome to it.

Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.IO;
  5. using System.Drawing;
  6. using System.Runtime.InteropServices;
  7. ...
  8.     [StructLayout(LayoutKind.Sequential)]
  9.     public struct SHFILEINFO
  10.     {
  11.         public IntPtr hIcon;
  12.         public IntPtr iIcon;
  13.         public uint dwAttributes;
  14.         [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
  15.         public string szDisplayName;
  16.         [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]
  17.         public string szTypeName;
  18.     };
  19.  
  20.     class Win32
  21.     {
  22.         public const uint SHGFI_ICON = 0x100;
  23.         public const uint SHGFI_LARGEICON = 0x0;
  24.         public const uint SHGFI_SMALLICON = 0x1;
  25.  
  26.         [DllImport("shell32.dll")]
  27.         public static extern IntPtr SHGetFileInfo(string pszPath,
  28.                                     uint dwFileAttributes,
  29.                                     ref SHFILEINFO psfi,
  30.                                     uint cbSizeFileInfo,
  31.                                     uint uFlags);
  32.  
  33.         [DllImport("user32.dll")]
  34.         public static extern int DestroyIcon(IntPtr hIcon);
  35.     }
  36.  
  37.     class ExtendedFileInfo
  38.     {
  39.         private FileInfo m_fileInfo = null;
  40.         private Icon m_largeIcon = null;
  41.         private Icon m_smallIcon = null;
  42.  
  43.         public FileInfo FileInfo
  44.         {
  45.             get { return m_fileInfo; }
  46.         }
  47.  
  48.         public Icon SmallIcon
  49.         {
  50.             get { return m_smallIcon; }
  51.         }
  52.  
  53.         public Icon LargeIcon
  54.         {
  55.             get { return m_largeIcon; }
  56.         }
  57.  
  58.         public ExtendedFileInfo(string file)
  59.         {
  60.             LoadFileInfo(file);
  61.         }
  62.  
  63.         public void LoadFileInfo(string file)
  64.         {
  65.             m_fileInfo = null;
  66.             m_smallIcon = null;
  67.             m_largeIcon = null;
  68.  
  69.             m_fileInfo = new FileInfo(file);
  70.  
  71.             SHFILEINFO shinfo = new SHFILEINFO();
  72.  
  73.             Icon theIcon = null;
  74.  
  75.             IntPtr himgSmall = Win32.SHGetFileInfo(file, 0, ref shinfo, (uint)Marshal.SizeOf(shinfo), Win32.SHGFI_ICON | Win32.SHGFI_SMALLICON);
  76.             theIcon = Icon.FromHandle(shinfo.hIcon);
  77.             m_smallIcon = (Icon)theIcon.Clone();
  78.             Win32.DestroyIcon(shinfo.hIcon);
  79.  
  80.             IntPtr himgLarge = Win32.SHGetFileInfo(file, 0, ref shinfo, (uint)Marshal.SizeOf(shinfo), Win32.SHGFI_ICON | Win32.SHGFI_LARGEICON);
  81.             theIcon = Icon.FromHandle(shinfo.hIcon);
  82.             m_largeIcon = (Icon)theIcon.Clone();
  83.             Win32.DestroyIcon(shinfo.hIcon);
  84.         }
  85.     }
  86.  
Aug 10 '09 #7
let me see ur link, by the way your *simpler* way to get a icon is more complexed than what i got :P, that IconLib is just a Dll with already made methods, they work perfect i just have to write this thing:

Expand|Select|Wrap|Line Numbers
  1.  
  2. using System.Drawing.Imaging;
  3. using System.Drawing.IconLib;
  4. using System.Drawing.IconLib.ColorProcessing;
  5.  
  6. public static Bitmap RetreieveIcoInBitmap(string source, int index, int reso)
  7.         {
  8.             MultiIcon icon = new MultiIcon();
  9.             icon.Load(source);
  10.             IconImage returnval = icon[index][reso];
  11.             return returnval.Icon.ToBitmap();
  12.         }
by the way, there is one problem, this way we wont have 3rd party control panel items, like if someone installed nvidia drivers he gets nvidia control panel, but the way.. we doing it.. i dont think we will get that item
Aug 10 '09 #8
GaryTexmo
1,501 Expert 1GB
Well, "complexity" is a tricky term in your context... I'd be willing to bet that IconLib is a whole lot bigger than the code I linked ;) The usage would be about the same. Either way, just showing you an alternative.

I found a code project entry that looks like something you'd be interested in.
http://www.codeproject.com/KB/cs/appletengine.aspx
Aug 10 '09 #9
i dont understand anything of the link u gave.. i have seen it before but it goes over my head :\
i tried running the exe of the project but it gives some error and dont gets all the control panel items, and dont open some items when clicked, i m on windows 7 RC if u wanna know
Aug 11 '09 #10
The official way is with Win32 Shell apis (see Win32 ng for C, C++ code, MS internal)
Aug 26 '09 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: theComputer7 | last post by:
I cut down the code to make this half way understandable... I have read Data Grid girls caution about over use of dynamic controls. I truly believe what I am doing requires dynamically inserted...
1
by: Charlie | last post by:
Hi: I'm laying out a hieraracical report by nesting repeater controls. I'm using panels to expand/collapse detail sections. To access a panel in a nested repeater, I use the following code. ...
4
by: nate axtell | last post by:
I'm looking for a way to refernce a control by a string that represents the name of the control. I dynamically create some textboxes, labels, and comboboxes each name by a loop iteration index. ...
4
by: Dennis | last post by:
I am trying to set the default design proerties in a control I have derived from the Panel Class. I thought I'd found how to do it from the MSDN but the following line doesn't work: Inherits...
1
by: Glenn | last post by:
Hello Is there any documentation around which shows you ( if it is possible) how to create a new category for the windows xp control panel.( in category view) I would like to create a new...
2
by: ctk_at | last post by:
I placed a menustrip on a form; is there any way to read the individual menustripitems from the form? I usually would have done this by using the forms controlcollection. There I can find the...
7
by: Jay | last post by:
Hey There, I've been trying to see if there is a way to programmatically block, or hide, the Control Panel. Since it is a "Virtual Folder", just blocking an .exe from running doesn't work. Even...
9
by: timnels | last post by:
I have an issue where I have a user control that is launched into a floating form. At some point later, I allow the user to "unfloat" the user control by reparenting it on a split container in...
5
by: Kursat | last post by:
Hi, I want to add new collapsable panel items using java script at client side. Is this possible to create Ajax components like collapsable panel without server round trip? Thanks in advance.
3
by: ata | last post by:
Hi folks, Consider the following code: protected void gridView_RowDataBound(object sender, GridViewRowEventArgs e) { GridViewRow row = e.Row; if (row.RowType != DataControlRowType.DataRow)...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.