Click here to Skip to main content
15,897,518 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionCStaic SetWindowText() blinking problem [Solved] Pin
econy14-Apr-14 6:55
econy14-Apr-14 6:55 
QuestionRe: CStaic SetWindowText() blinking problem Pin
David Crow14-Apr-14 9:04
David Crow14-Apr-14 9:04 
AnswerRe: CStaic SetWindowText() blinking problem Pin
econy14-Apr-14 9:21
econy14-Apr-14 9:21 
GeneralRe: CStaic SetWindowText() blinking problem Pin
CPallini14-Apr-14 9:44
mveCPallini14-Apr-14 9:44 
GeneralRe: CStaic SetWindowText() blinking problem Pin
econy15-Apr-14 4:54
econy15-Apr-14 4:54 
GeneralRe: CStaic SetWindowText() blinking problem Pin
CPallini15-Apr-14 6:10
mveCPallini15-Apr-14 6:10 
QuestionWaitForMultipleObjects keeps catching timeout event (RESOLVED) Pin
bkelly1313-Apr-14 11:36
bkelly1313-Apr-14 11:36 
AnswerRe: WaitForMultipleObjects keeps catching timeout event Pin
SoMad13-Apr-14 12:28
professionalSoMad13-Apr-14 12:28 
GeneralRe: WaitForMultipleObjects keeps catching timeout event Pin
bkelly1313-Apr-14 14:03
bkelly1313-Apr-14 14:03 
GeneralRe: WaitForMultipleObjects keeps catching timeout event Pin
SoMad13-Apr-14 14:13
professionalSoMad13-Apr-14 14:13 
QuestionLinking errors Pin
tre412-Apr-14 11:51
tre412-Apr-14 11:51 
AnswerRe: Linking errors Pin
Richard Andrew x6412-Apr-14 15:07
professionalRichard Andrew x6412-Apr-14 15:07 
GeneralRe: Linking errors Pin
tre412-Apr-14 22:18
tre412-Apr-14 22:18 
QuestionProgram keeps looping [Solved] Pin
CounterClockWise11-Apr-14 14:13
CounterClockWise11-Apr-14 14:13 
AnswerRe: Program keeps looping Pin
Richard Andrew x6411-Apr-14 16:26
professionalRichard Andrew x6411-Apr-14 16:26 
GeneralRe: Program keeps looping Pin
CounterClockWise11-Apr-14 16:41
CounterClockWise11-Apr-14 16:41 
QuestionDraw two monitors syncron Pin
_Flaviu10-Apr-14 22:11
_Flaviu10-Apr-14 22:11 
AnswerRe: Draw two monitors syncron Pin
Richard MacCutchan10-Apr-14 22:41
mveRichard MacCutchan10-Apr-14 22:41 
AnswerRe: Draw two monitors syncron Pin
pasztorpisti11-Apr-14 6:17
pasztorpisti11-Apr-14 6:17 
GeneralRe: Draw two monitors syncron Pin
_Flaviu13-Apr-14 22:23
_Flaviu13-Apr-14 22:23 
Question[MFC Desktop Application for enumerating Virtual customized folder and files] Windows 8 Address Bar icon problem Pin
Nirmal K P10-Apr-14 19:39
Nirmal K P10-Apr-14 19:39 
Hi,
I am developing a MFC application on Windows 8.1 using VS-2005.

Requirement is to customize Folder Explorer for a specific purpose. I want to create own pidl for folder and its contents.

When I will open a particular folder, application's should inherit Win-8 Windows explorer.

I want to set customized icon for folder on top left corner(On Win-8) and at the root of address bar.


I am using GetBindToObject, GetUIObjectOf, CreateViewObject, GetIconLocation and Extract method in ShellFolderImpl class. Please give me some sample source code or idea to do that. I have already studied URL - [http://msdn.microsoft.com/en-us/library/windows/desktop/cc144093%28v=vs.85%29.aspx ] but it is not working.


This method is in ShellFolderImpl class

BindToObject, CreateViewObject, etc functions are working correctly.......
Icon index and Icon is loaded correctly. bcz I saved created icon from Extract method.
But emplty icon is placed at specified place on folder as given in above image.

1. IExtractIcon interface is called from GetUIObjectOf method correctly.
2. GetIconLocation method gives correct output Index for Icon.
3. Extract function gives correct output for hIcon.

But problem is that Icon assigned to displayed was not correctly displayed at AddressBar and Caption Bar(Top-left corner).

Currently, Icon is displayed on AddressBar and Caption Bar(Top-left corner) was empty file icon.

when I set :

C++
HRESULT ExtIcon::ExtractImpl(UINT nIconIndex, HICON* phiconLarge, HICON* phiconSmall)
{
   phiconLarge = NULL;
   phiconSmall= NULL;
}


I got folder icon on the AddressBar and Caption Bar.
--------------------------------------------------------------------------------------
C++
STDMETHODIMP ShellFolderImpl::GetUIObjectOf ( HWND , UINT uCount,
                                               LPCITEMIDLIST* pPidl, REFIID riid,
                                               LPUINT, void** ppvReturn )
{

    try
    {

    *ppvReturn = NULL;

    if( uCount != 1 )
       return E_FAIL;

    // IExtractIcon
    if( IsEqualIID(riid, IID_IExtractIconA)|| IsEqualIID(riid, IID_IExtractIconW))
    {
        CComObject<ExtIcon>* pExtractIcon;
        HRESULT hr = CComObject<ExtIcon>::CreateInstance ( &pExtractIcon );
        if (FAILED(hr))
            return hr;
        
    
        // Tight its lifetime with this object (the IShellFolder object)
        pExtractIcon->Init(GetUnknown());
        
        pExtractIcon->AddRef();
        pExtractIcon->SetMyPIDL((LPITEMIDLIST)*pPidl);
        
        // Return the requested interface to the caller
        hr = pExtractIcon->QueryInterface(riid, ppvReturn);
        
        // We do no more need our ref)
        pExtractIcon->Release();
        return hr;
    }
    catch(...){}

    return E_NOINTERFACE;
}


Extract Icon handler is as :

C++
// ExtIcon.h : Declaration of the ExtIcon

#pragma once
#include "resource.h"  
#include "PluginRes.h"// main symbols
#include "pidlmgr.h"
#include "ExplorerPlugIn.h"


// ExtIcon

// IExtractIconA
// Windows XP, Vista: IExtractIconW
// Windows 7: IExtractIconA
// Windows 8: IExtractIconA ?
class ATL_NO_VTABLE ExtIcon :
    public CComObjectRootEx<CComSingleThreadModel>,
    public CComCoClass<ExtIcon, &CLSID_ExtIcon>,
    public IDispatchImpl<IExtIcon, &IID_IExtIcon, &LIBID_ExplorerPlugInLib, /*wMajor =*/ 1, /*wMinor =*/ 0>,
    public IExtractIconA,
    public IExtractIconW
{
public:
    ExtIcon()
    {
    }
    ExtIcon(LPCITEMIDLIST pidl);



DECLARE_REGISTRY_RESOURCEID(IDR_EXTICON)


BEGIN_COM_MAP(ExtIcon)
    COM_INTERFACE_ENTRY_IID(IID_IExtractIconA, IExtractIconA)
    COM_INTERFACE_ENTRY_IID(IID_IExtractIconW, IExtractIconW)
    COM_INTERFACE_ENTRY(IExtIcon)
    COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()


    DECLARE_PROTECT_FINAL_CONSTRUCT()

    HRESULT FinalConstruct()
    {
        return S_OK;
    }
    
    void FinalRelease()
    {
    }

public:
    // IExtractIconA
    STDMETHOD(GetIconLocation)(THIS_ UINT, LPSTR, UINT, int* piIndex, UINT* pwFlags)
    {
        return GetIconLocationImpl(piIndex, pwFlags);
    }
    STDMETHOD(Extract)(THIS_ LPCSTR, UINT nIconIndex, HICON* phiconLarge, HICON* phiconSmall, UINT)
    {
        return ExtractImpl(nIconIndex, phiconLarge, phiconSmall);
    }
    // IExtractIconW
    STDMETHOD(GetIconLocation)(THIS_ UINT, LPWSTR, UINT, int* piIndex, UINT* pwFlags)
    {
        return GetIconLocationImpl(piIndex, pwFlags);
    }
    STDMETHOD(Extract)(THIS_ LPCWSTR, UINT nIconIndex, HICON* phiconLarge, HICON* phiconSmall, UINT)
    {
        return ExtractImpl(nIconIndex, phiconLarge, phiconSmall);
    }

    // Ensure the owner object is not freed before this one
    void Init(IUnknown *pUnkOwner);

    void SetMyPIDL(LPITEMIDLIST pidl)
    {
        m_pidl = pidl;
    }
    //CExtIcon( LPCITEMIDLIST /*pidl*/ );
    enum BoxType
    {
        PUBLIC,
        PRIVATE
    };

private:
    HRESULT GetIconLocationImpl(int*, UINT*);
    HRESULT ExtractImpl(UINT, HICON*, HICON*);

    CPidlMgr* m_pPidlMgr;
    LPITEMIDLIST m_pidl;
    BOOL m_bIsOpenIcon;
    protected:
         CComPtr<IUnknown> m_UnkOwnerPtr;
   DWORD m_ObjRefCount;

};

OBJECT_ENTRY_AUTO(__uuidof(ExtIcon), ExtIcon)


modified 11-Apr-14 8:01am.

QuestionUse PlaySound api caused memory loading? Pin
cedricvictor10-Apr-14 16:02
cedricvictor10-Apr-14 16:02 
AnswerRe: Use PlaySound api caused memory loading? Pin
Richard Andrew x6410-Apr-14 17:19
professionalRichard Andrew x6410-Apr-14 17:19 
QuestionMS Word Automation - I get so far - now what? Pin
Bryan Anslow10-Apr-14 9:43
Bryan Anslow10-Apr-14 9:43 
AnswerRe: MS Word Automation - I get so far - now what? Pin
Richard MacCutchan10-Apr-14 22:39
mveRichard MacCutchan10-Apr-14 22:39 

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.