 |
|
 |
What is the "#pragma warning (disable : 4089) "?
There are some size limit in CImageList?
I am having problems for some more than 400 itens.
Thanks & Regards,
Rui
|
|
|
|
 |
|
 |
Excellent, just what I was looking for.
|
|
|
|
 |
|
 |
how to get the icon name in the system list?
|
|
|
|
 |
|
 |
How to Find a larger icon than "large icon" on this program?
please help me. thanks.
|
|
|
|
 |
|
 |
How can I get application Icon(that we can see in Windows Explower) in C#?
|
|
|
|
 |
|
 |
Hello,
This is what I am looking for!
But how will I implement this in C#?
Can anybody help me?
The constant FILE_ATTRIBUTE_NORMAL does not exist.
Please help me here.
Thanks!
|
|
|
|
 |
|
 |
FILE_ATTRIBUTE_NORMAL is zero.
FILE_ATTRIBUTE_NORMAL
const win32file.FILE_ATTRIBUTE_NORMAL;
The file has no other attributes set. This attribute is valid only if used alone.
otherwise try googleing FILE_ATTRIBUTE_NORMAL , plenty of answers.
|
|
|
|
 |
|
 |
Thank you for your reply. =D
|
|
|
|
 |
|
 |
I googled "FILE_ATTRIBUTE_NORMAL" and came up with this page!
|
|
|
|
 |
|
 |
This was my first time with ShGetFileInfo and this article saved me a good deal of time. So dear .S.Rod., please KMFB*
----------------------
*KMFB - Kiss my furry butt
|
|
|
|
 |
|
 |
I have download the code and run it on Win XP the Larger icon is not shown clear it have black border. Do anybody notice it...can u plz help me out.
|
|
|
|
 |
|
 |
UseShGetFileInfo.h:...
#pragma warning( push )
#pragma warning (disable : 4089)
class CUseShGetFileInfo{
private:
CUseShGetFileInfo();
public:
virtual ~CUseShGetFileInfo(); // not needed
static HIMAGELIST GetSystemImageListHandle( BOOL bSmallIcon );
static int GetFileIconIndex( CString strFileName , BOOL bSmallIcon);
static int GetDirIconIndex(BOOL bSmallIcon);
static HICON GetFileIconHandle(CString strFileName,BOOL bSmallIcon);
static HICON GetFolderIconHandle(BOOL bSmallIcon );
static CString GetFileType(CString strFileName);
};
#pragma warning( pop )
UseShGetFileInfo.cpp:#include <shlwapi.h> // path manipulation functions
#pragma comment( lib, "shlwapi" ) #include <objbase.h>
#if defined( _MT )
CoInitializeEx( NULL, COINIT_MULTITHREADED );
#else
CoInitializeEx( NULL, COINIT_APARTMENTTHREADED );
#endif
HIMAGELIST CUseShGetFileInfo::GetSystemImageListHandle( BOOL bSmallIcon )
{
TCHAR tcSystemRoot[MAX_PATH + 1];
GetWindowsDirectory( tcSystemRoot, MAX_PATH );
PathStripToRoot( tcSystemRoot );
HIMAGELIST hSystemImageList;
SHFILEINFO ssfi;
if (bSmallIcon)
{
hSystemImageList = (HIMAGELIST)SHGetFileInfo(tcSystemRoot,
0,
&ssfi,
sizeof(SHFILEINFO),
SHGFI_SYSICONINDEX | SHGFI_SMALLICON | SHGFI_ICON); }
else
{
...
}
int CUseShGetFileInfo::GetDirIconIndex(BOOL bSmallIcon )
{
SHFILEINFO sfi;
if (bSmallIcon)
{
SHGetFileInfo(
_T( "" ), FILE_ATTRIBUTE_DIRECTORY,
&sfi,
sizeof(SHFILEINFO),
SHGFI_SYSICONINDEX | SHGFI_SMALLICON | SHGFI_USEFILEATTRIBUTES | SHGFI_ICON); }
else
{
...
}
Apply respective changes to all other locations. In particular, supply SHGFI_ICON whenever any SHGFI_XXXICON flag is used, supply UNICODE compatible strings, even if they aren't evaluated by content, don't use a hardcoded C:\ drive.
The class cannot be instantiated anymore, which is an intended effect. The methods are available through CUseShGetFileInfo::GetSystemImageListHandle( BOOL bSmallIcon ) calls, etc., without any instance available -- that's what static members are for.
I've probably overlooked some issues, but this is a start anyway. If you have any criticism concerning the changes let's hear them.
.f
p.s.: Is there a way to apply syntax highlighting in these comments?
|
|
|
|
 |
|
 |
Using the icon handle which we get using SHGetFileInfo, how to save as ico file? I tried using GlobalLock(hicon) to get handle to icon bits and then tried to write it to a file. But it was failing?
Is there is a way to save as a icon file using the handle HICON?
|
|
|
|
 |
|
 |
The answer to your question is CxImage class
This class can create an icon file (*.ico) from HICON.
You will find the "CxImage" class on this site only
Good Luck.
|
|
|
|
 |
|
 |
Is there any way to get the network adapter icon? The icons present in the device manager of windows.
thanks
Sri
|
|
|
|
 |
|
 |
and I don't bother what other here say. It was usefull to me even if I don't use the class but only some methods of it.
Either way - I learnt some things about shell icons.
|
|
|
|
 |
|
 |
Ditto. I found this useful too. Thanks for posting it!
|
|
|
|
 |
|
 |
Me too! I've been looking through books and websites with no luck trying to figure out how to lookup system icons. Doru's code was a great place to start.
I added a "bOpenIcon" parameter to GetFileIconIndex(), GetDirIconIndex(), GetFileIconHandle(), and GetFolderIconHandle(). If it is true, I add SHGFI_OPENICON to the flags used in the call to SHGetFileInfo(). Just a small improvement to make the tree act more like Windows Explorer.
jaramilr
|
|
|
|
 |
|
 |
I totally agree with .S.Rod. He may have used harsh words, but he is right. Don't you realize that number of such articles increase exponentially. This will make CP less useful in the future. Nobody (I guess) needs this article!
Mustafa Demirhan
http://www.macroangel.com
Sonork ID 100.9935:zoltrix
They say I'm lazy but it takes all my time
|
|
|
|
 |
|
 |
Whilst the article may not be up to much, the source may be of use to somebody.
Maybe it's time to look at the Code Snippets idea again
Michael
The avalanche has started, it's too late for the pebbles to vote.
|
|
|
|
 |
|
 |
I agree. I suspect many people are upset that there are so many smaller code submissions amongst the larger articles, so the idea of Code Snippets sounds very good indeed. This article would fit nicely in such a section, and would not be receiving all the nasty comments it's getting. It would benefit CodeProject, the submitters of articles large and small, and the readers.
Code Snippets -> Let those in favour send Chris a nice email in support of it (or whatever solution they prefer). I know many already have, but an equitable solution must be found, so let's not give up.
|
|
|
|
 |
|
|
 |
|
 |
Harsh words! The code isn't not formatting my hard drive and he's not claiming his code will revolutionize the world or anything. It's just a simple wrapper which he apparently wanted to share with others.
So what if his code is less useful, you still shouldn't post messages like that. Do you have any idea how much those words can hurt? He didn't deserve those words.
My 2 cents.
--
"It is amazing how f-ing crazy I really am."
|
|
|
|
 |
|
 |
Jörgen Sigvardsson wrote:
So what if his code is less useful
You haven't looked the code. Beyond the point of being tiny and strictly useless, it's badly written.
As a side note, please find below my registry wrapper,
struct CMyCoolRegistry
{
HKEY OpenRegistryKey(HKEY hKey,LPCTSTR lpSubKey,PHKEY phkResult)
{
return ::RegOpenKey(hKey,lpSubKey, phkresult);
}
long RegCloseKey(HKEY hKey)
{
return ::RegCloseKey(hKey);
}
};
Is that powerful enough, or do you want to add more cool features?
|
|
|
|
 |
|
 |
If I look at your code I would judge this bad (excuse me imho "crap")
Your code:
1. class instead of struct
2. there is No internal functionality
3. use of members
4. checking of results
5. what is wrapped? (Nothing)
The code of the article:
(see upside)
1. ok
2. ok
3. no
4. no
5. ok (little) 50%
That means that your code got 0 points out of 5, the articles code 2,5 of 5 point.
You got to learn a lot maybe not only programming...
(If you were here, I would at first ask you whether you can stand the truth)
Try this @ home. (B&B)
|
|
|
|
 |