Click here to Skip to main content
15,919,567 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralEfficient use of memory and filtering Pin
Anton A. Loukine27-Feb-03 6:41
Anton A. Loukine27-Feb-03 6:41 
GeneralRe: Efficient use of memory and filtering Pin
John M. Drescher27-Feb-03 6:50
John M. Drescher27-Feb-03 6:50 
GeneralRe: Efficient use of memory and filtering Pin
Anton A. Loukine27-Feb-03 7:20
Anton A. Loukine27-Feb-03 7:20 
GeneralRe: Efficient use of memory and filtering Pin
Daniel Turini27-Feb-03 7:34
Daniel Turini27-Feb-03 7:34 
GeneralRe: Efficient use of memory and filtering Pin
John M. Drescher27-Feb-03 7:48
John M. Drescher27-Feb-03 7:48 
QuestionAutomatic generation of MS Visual C++ projects ? Pin
CHARMAN27-Feb-03 6:19
CHARMAN27-Feb-03 6:19 
AnswerRe: Automatic generation of MS Visual C++ projects ? Pin
AlexO27-Feb-03 8:21
AlexO27-Feb-03 8:21 
GeneralSHGetFileInfo: I can't get SHGFI_ICONLOCATION to work Pin
Mike Morearty27-Feb-03 6:15
Mike Morearty27-Feb-03 6:15 
I can't get SHGetFileInfo's SHGFI_ICONLOCATION to work. (I'm on WinXP.) That option requests the path to the file that contains the icon for a given file type.

Here's my code:

#include <windows.h>
#include <stdio.h>

void main()
{
SHFILEINFO fileInfo = {0};
if (SHGetFileInfo(".txt", FILE_ATTRIBUTE_NORMAL, &fileInfo, sizeof(fileInfo),
SHGFI_USEFILEATTRIBUTES|SHGFI_ICONLOCATION|SHGFI_TYPENAME))
{
printf("file type: '%s'\n", fileInfo.szTypeName);
printf("icon file: '%s'\n", fileInfo.szDisplayName);
printf("icon index within icon file: %d\n", fileInfo.iIcon);
}
else
printf("failed\n");
}

The output I get is:

file type: 'Text Document'
icon file: ''
icon index within icon file: 3

As you can see, it correctly determines the file type. Also '3' is correct -- I can see that in the registry (under "txtfile"). But the filename is missing, even though it is there in my registry.

I've tried a few variations -- e.g. different extensions, and different sets of SHGFI_* flags. Anyone know how to get this to work?

Thanks -mike
GeneralRe: SHGetFileInfo: I can't get SHGFI_ICONLOCATION to work Pin
AlexO27-Feb-03 8:38
AlexO27-Feb-03 8:38 
GeneralRe: SHGetFileInfo: I can't get SHGFI_ICONLOCATION to work Pin
Mike Morearty27-Feb-03 8:49
Mike Morearty27-Feb-03 8:49 
GeneralCSliderCtrl notifications Pin
Maximilien27-Feb-03 5:25
Maximilien27-Feb-03 5:25 
GeneralRe: CSliderCtrl notifications Pin
AlexO27-Feb-03 5:59
AlexO27-Feb-03 5:59 
Generalmultiple windowed apps Pin
SumGuy27-Feb-03 5:19
SumGuy27-Feb-03 5:19 
GeneralRe: multiple windowed apps Pin
Rage27-Feb-03 5:55
professionalRage27-Feb-03 5:55 
GeneralRe: multiple windowed apps Pin
SumGuy27-Feb-03 6:26
SumGuy27-Feb-03 6:26 
GeneralI figured it out thanks Pin
SumGuy27-Feb-03 7:19
SumGuy27-Feb-03 7:19 
GeneralRe: I figured it out thanks Pin
Alvaro Mendez27-Feb-03 9:54
Alvaro Mendez27-Feb-03 9:54 
GeneralRe: I figured it out thanks Pin
Jason Henderson27-Feb-03 11:22
Jason Henderson27-Feb-03 11:22 
GeneralRe: I figured it out thanks Pin
Alvaro Mendez27-Feb-03 17:23
Alvaro Mendez27-Feb-03 17:23 
GeneralA self-disappearing messagebox Pin
ns27-Feb-03 5:03
ns27-Feb-03 5:03 
GeneralRe: A self-disappearing messagebox Pin
will138327-Feb-03 5:08
will138327-Feb-03 5:08 
GeneralRe: A self-disappearing messagebox Pin
Alvaro Mendez27-Feb-03 5:42
Alvaro Mendez27-Feb-03 5:42 
Generalthanks!! Pin
ns27-Feb-03 5:47
ns27-Feb-03 5:47 
GeneralRe: A self-disappearing messagebox Pin
Nish Nishant27-Feb-03 6:38
sitebuilderNish Nishant27-Feb-03 6:38 
GeneralWow!!! Pin
ns27-Feb-03 7:33
ns27-Feb-03 7:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.