Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

SHChangeDWORDAsIDList structure

[SHChangeDWORDAsIDList is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions.]

Stores two DWORD values in a form mimicking an ITEMIDLIST so that they can be used by SHChangeNotify.

Syntax


typedef struct _SHChangeDWORDAsIDList {
  USHORT cb;
  DWORD  dwItem1;
  DWORD  dwItem2;
  USHORT cbZero;
} SHChangeDWORDAsIDList, *LPSHChangeDWORDAsIDList;

Members

cb

Type: USHORT

The size of the structure, in bytes.

dwItem1

Type: DWORD

First DWORD value.

dwItem2

Type: DWORD

Second DWORD value.

cbZero

Type: USHORT

Remarks

This example demonstrates the use of SHChangeUpdateImageIDList and SHChangeDWORDAsIDList by SHChangeNotify to mimic the SHUpdateImage function.


void MyUpdateImage(LPCWSTR pszHashItem, int iIndex, UINT uFlags, int iImageIndex)
{
    SHChangeUpdateImageIDList rgPidl;
    SHChangeDWORDAsIDList rgDWord;
    int cchLen;
    USHORT *pcb;

    // Validate parameters: iImageIndex must be a valid system image list value.
    if (iImageIndex < 0)
    {
        return;
    }

    // Validate parameters: pszHashItem must not exceed MAX_PATH in length
    cchLen = lstrlenW(pszHashItem);
    if (cchLen >= MAX_PATH)
    {
        return;
    }

    // Load SHChangeUpdateImageIDList
    rgPidl.dwProcessID = GetCurrentProcessId();
    rgPidl.iIconIndex = iIndex;
    rgPidl.iCurIndex = iImageIndex;
    rgPidl.uFlags = uFlags;
    lstrcpynW(rgPidl.szName, pszHashItem, MAX_PATH);
    pcb = &amp;rgPidl.szName[cchLen+1];
    
    // Set the size of the first element
    rgPidl.cb = (USHORT)((BYTE*)pcb - (BYTE*)rgPidl); 
    
    // Terminate the "ITEMIDLIST"
    *pcb = 0; 

    // Load SHChangeDWORDAsIDList
    rgDWord.cb = (USHORT)FIELD_OFFSET(SHChangeDWORDAsIDList, cbZero);
    rgDWord.dwItem1 = iImageIndex;
    rgDWord.dwItem2 = 0;
    rgDWord.cbZero = 0;

    // Parameters are now in the form that SHCNE_UPDATEIMAGE can accept
    SHChangeNotify(SHCNE_UPDATEIMAGE, SHCNF_IDLIST, &rgDWord, &rgPidl);
}

Requirements

Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

End of client support

Windows XP with SP2

End of server support

Windows Server 2003

Header

Shlobj.h

See also

SHChangeUpdateImageIDList

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.