当前位置: 代码迷 >> WinCE >> wince上怎么获取文件图标
  详细解决方案

wince上怎么获取文件图标

热度:83   发布时间:2016-04-28 12:32:30.0
wince下如何获取文件图标?
在wince下做了个类似windows资源管理器,在treeview和listview中显示的文件图标都是“windows图标”,如何显示系统正确的图标啊?
wince 图标

------解决方案--------------------
CE 系统是不支持的,只能自己来实现。

试着从文件中读取图标资料。
------解决方案--------------------

LRESULT CALLBACK TwoStateFileAnimProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{

    LPCTSTR szFileName                    = TEXT("myfile.xls");
    LRESULT lRet                          = 0;
    static SHFILEINFO s_sfiLarge          = {0};
    static SHFILEINFO s_sfiLargeSelected  = {0};
    static HIMAGELIST s_himlLarge         = NULL;
    static HIMAGELIST s_himlLargeSelected = NULL;

    switch (message)
    {
        case WM_CREATE:
            // Cache the file information and the imagelist.
            // Get the large default icon for the file.
            s_himlLarge = (HIMAGELIST)SHGetFileInfo(szFileName, 0, &s_sfiLarge, sizeof(s_sfiLarge), SHGFI_SYSICONINDEX
------解决方案--------------------
SHGFI_LARGEICON);

            // Get the large selected icon for the file.
            s_himlLargeSelected = (HIMAGELIST)SHGetFileInfo(szFileName, 0, &s_sfiLargeSelected, sizeof(s_sfiLargeSelected), SHGFI_SYSICONINDEX
------解决方案--------------------
SHGFI_LARGEICON
------解决方案--------------------
SHGFI_SELECTICON);
            break;

        case WM_PAINT:
            {
                PAINTSTRUCT ps;
                HDC hdc = BeginPaint(hwnd, &ps);

                // Draw the file icon in the selected state.
                ImageList_Draw(s_himlLargeSelected, s_sfiLargeSelected.iIcon, hdc, 0, 0, ILD_TRANSPARENT);

                // Draw the file icon in the default state.
  相关解决方案