how can i put each control panel item in a dropdown menu in context menu, WITH their icons
10 4203
give us a little bit long description of your problem....
and what do you exactly mean by control panel item...
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.
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 :)
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)
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..
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. -
using System;
-
using System.Collections.Generic;
-
using System.Text;
-
using System.IO;
-
using System.Drawing;
-
using System.Runtime.InteropServices;
-
...
-
[StructLayout(LayoutKind.Sequential)]
-
public struct SHFILEINFO
-
{
-
public IntPtr hIcon;
-
public IntPtr iIcon;
-
public uint dwAttributes;
-
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
-
public string szDisplayName;
-
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]
-
public string szTypeName;
-
};
-
-
class Win32
-
{
-
public const uint SHGFI_ICON = 0x100;
-
public const uint SHGFI_LARGEICON = 0x0;
-
public const uint SHGFI_SMALLICON = 0x1;
-
-
[DllImport("shell32.dll")]
-
public static extern IntPtr SHGetFileInfo(string pszPath,
-
uint dwFileAttributes,
-
ref SHFILEINFO psfi,
-
uint cbSizeFileInfo,
-
uint uFlags);
-
-
[DllImport("user32.dll")]
-
public static extern int DestroyIcon(IntPtr hIcon);
-
}
-
-
class ExtendedFileInfo
-
{
-
private FileInfo m_fileInfo = null;
-
private Icon m_largeIcon = null;
-
private Icon m_smallIcon = null;
-
-
public FileInfo FileInfo
-
{
-
get { return m_fileInfo; }
-
}
-
-
public Icon SmallIcon
-
{
-
get { return m_smallIcon; }
-
}
-
-
public Icon LargeIcon
-
{
-
get { return m_largeIcon; }
-
}
-
-
public ExtendedFileInfo(string file)
-
{
-
LoadFileInfo(file);
-
}
-
-
public void LoadFileInfo(string file)
-
{
-
m_fileInfo = null;
-
m_smallIcon = null;
-
m_largeIcon = null;
-
-
m_fileInfo = new FileInfo(file);
-
-
SHFILEINFO shinfo = new SHFILEINFO();
-
-
Icon theIcon = null;
-
-
IntPtr himgSmall = Win32.SHGetFileInfo(file, 0, ref shinfo, (uint)Marshal.SizeOf(shinfo), Win32.SHGFI_ICON | Win32.SHGFI_SMALLICON);
-
theIcon = Icon.FromHandle(shinfo.hIcon);
-
m_smallIcon = (Icon)theIcon.Clone();
-
Win32.DestroyIcon(shinfo.hIcon);
-
-
IntPtr himgLarge = Win32.SHGetFileInfo(file, 0, ref shinfo, (uint)Marshal.SizeOf(shinfo), Win32.SHGFI_ICON | Win32.SHGFI_LARGEICON);
-
theIcon = Icon.FromHandle(shinfo.hIcon);
-
m_largeIcon = (Icon)theIcon.Clone();
-
Win32.DestroyIcon(shinfo.hIcon);
-
}
-
}
-
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: -
-
using System.Drawing.Imaging;
-
using System.Drawing.IconLib;
-
using System.Drawing.IconLib.ColorProcessing;
-
-
public static Bitmap RetreieveIcoInBitmap(string source, int index, int reso)
-
{
-
MultiIcon icon = new MultiIcon();
-
icon.Load(source);
-
IconImage returnval = icon[index][reso];
-
return returnval.Icon.ToBitmap();
-
}
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
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
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
The official way is with Win32 Shell apis (see Win32 ng for C, C++ code, MS internal)
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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. ...
|
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. ...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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.
|
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)...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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...
|
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...
|
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,...
|
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...
| |