Click here to Skip to main content
15,884,472 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Setting BGColor to a WebBrowser Control Pin
_Flaviu5-May-11 2:32
_Flaviu5-May-11 2:32 
GeneralRe: Setting BGColor to a WebBrowser Control Pin
pix_programmer5-May-11 2:34
pix_programmer5-May-11 2:34 
QuestionRe: Setting BGColor to a WebBrowser Control Pin
Maximilien5-May-11 7:19
Maximilien5-May-11 7:19 
AnswerRe: Setting BGColor to a WebBrowser Control Pin
pix_programmer5-May-11 18:08
pix_programmer5-May-11 18:08 
GeneralRe: Setting BGColor to a WebBrowser Control Pin
barneyman5-May-11 20:03
barneyman5-May-11 20:03 
GeneralRe: Setting BGColor to a WebBrowser Control Pin
Cool_Dev5-May-11 22:18
Cool_Dev5-May-11 22:18 
GeneralRe: Setting BGColor to a WebBrowser Control Pin
వేంకటనారాయణ(venkatmakam)5-May-11 22:50
వేంకటనారాయణ(venkatmakam)5-May-11 22:50 
QuestionA strange thing about using SHGetFileInfo to get icon [modified][solved] Pin
yu-jian4-May-11 22:55
yu-jian4-May-11 22:55 
Using the following code to get the file type icon in the dll, such as .exe .cpp .c .h file icon
 //  strTempTest  = _T(".cpp")  or  _T(".txt")
SHFILEINFO sInfo;
SHGetFileInfo(strTempTest,bIsDir ? FILE_ATTRIBUTE_DIRECTORY : FILE_ATTRIBUTE_NORMAL,&sInfo,sizeof(sInfo),
    SHGFI_USEFILEATTRIBUTES | SHGFI_SMALLICON | SHGFI_SYSICONINDEX);


using following code to set the image list to ListCtrl
SHFILEINFO    sfi;
HIMAGELIST imagelist;
imagelist=(HIMAGELIST)SHGetFileInfo(_T(""),
    0,
    &sfi,
    sizeof(SHFILEINFO),
    SHGFI_SYSICONINDEX | SHGFI_SMALLICON ) ;

if(imagelist!=NULL)
{
    SetItemImage(CImageList::FromHandle(imagelist),0);
}


But only the folder icon can be display. the file icon cannot show.
But I find a strange thing that if adding the following code in the main application, the icon of the .cpp file in DLL can display.

    CoInitialize(0);
CString strTempTest;
int nPos = strName.ReverseFind(_T('.'));
if(nPos != -1)
    strTempTest = strName.Right(strName.GetLength() - nPos);
else
{
    if(!bIsDir)
        strTempTest = strName;
    else
        strTempTest = _T("C:\\Windows");
}
SHFILEINFO sInfo;
SHGetFileInfo(_T(".cpp"), (bIsDir ? FILE_ATTRIBUTE_DIRECTORY : 0), &sInfo, sizeof(sInfo),
    SHGFI_USEFILEATTRIBUTES | SHGFI_SMALLICON | SHGFI_ICON);

//////////////////////////////////////////////////////////////////////////??
if (sInfo.hIcon)
    DestroyIcon(sInfo.hIcon);



I donot know why. I google serveral times, but cannot get reason.
modified on Tuesday, May 10, 2011 9:20 AM

AnswerRe: A strange thing about using SHGetFileInfo to get icon Pin
Michael Dunn5-May-11 13:46
sitebuilderMichael Dunn5-May-11 13:46 
AnswerRe: A strange thing about using SHGetFileInfo to get icon Pin
Iain Clarke, Warrior Programmer6-May-11 4:53
Iain Clarke, Warrior Programmer6-May-11 4:53 
GeneralRe: A strange thing about using SHGetFileInfo to get icon Pin
yu-jian9-May-11 23:44
yu-jian9-May-11 23:44 
QuestionMFC data structures Pin
_Flaviu4-May-11 20:50
_Flaviu4-May-11 20:50 
AnswerRe: MFC data structures Pin
Alexandre GRANVAUD4-May-11 21:44
Alexandre GRANVAUD4-May-11 21:44 
AnswerRe: MFC data structures Pin
Ozer Karaagac5-May-11 1:03
professionalOzer Karaagac5-May-11 1:03 
GeneralRe: MFC data structures Pin
_Flaviu5-May-11 2:30
_Flaviu5-May-11 2:30 
GeneralRe: MFC data structures Pin
Ozer Karaagac5-May-11 5:24
professionalOzer Karaagac5-May-11 5:24 
GeneralRe: MFC data structures Pin
_Flaviu5-May-11 6:25
_Flaviu5-May-11 6:25 
QuestionHow to parse xml (read/write xml file) in vc++ Pin
shiv@nand4-May-11 17:54
shiv@nand4-May-11 17:54 
AnswerRe: How to parse xml (read/write xml file) in vc++ Pin
Hans Dietrich4-May-11 18:00
mentorHans Dietrich4-May-11 18:00 
AnswerRe: How to parse xml (read/write xml file) in vc++ Pin
వేంకటనారాయణ(venkatmakam)4-May-11 19:52
వేంకటనారాయణ(venkatmakam)4-May-11 19:52 
AnswerRe: How to parse xml (read/write xml file) in vc++ Pin
ShilpiP4-May-11 23:11
ShilpiP4-May-11 23:11 
QuestionInvalid class string when using CreateDispatch Pin
Member 29729924-May-11 12:20
Member 29729924-May-11 12:20 
AnswerRe: Invalid class string when using CreateDispatch Pin
Hans Dietrich4-May-11 18:02
mentorHans Dietrich4-May-11 18:02 
GeneralRe: Invalid class string when using CreateDispatch Pin
barneyman4-May-11 18:26
barneyman4-May-11 18:26 
AnswerRe: Invalid class string when using CreateDispatch Pin
Richard MacCutchan4-May-11 21:16
mveRichard MacCutchan4-May-11 21:16 

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.