zoukankan      html  css  js  c++  java
  • 一些模块

    1.显示系统自带的图标

    SHFILEINFO sfi;
     HIMAGELIST smalPic;
     HIMAGELIST bigPic;
     CString strBuf;
     char sysDir[300];
     memset(sysDir,0,sizeof(sysDir));
     GetWindowsDirectory(sysDir,300);
     strBuf=sysDir;
     sprintf(sysDir,"%s",strBuf.Left(strBuf.Find("http://www.cnblogs.com/xianqingzh/admin/file://%22)+1/));
     smalPic=(HIMAGELIST)SHGetFileInfo((LPCTSTR)strBuf,0,&sfi,sizeof(SHFILEINFO),SHGFI_SYSICONINDEX|SHGFI_SMALLICON);
     bigPic=(HIMAGELIST)SHGetFileInfo((LPCTSTR)strBuf,0,&sfi,sizeof(SHFILEINFO),SHGFI_SYSICONINDEX|SHGFI_LARGEICON);
     if (smalPic||bigPic)
     {
      ::SendMessage(m_listControl.m_hWnd,LVM_SETIMAGELIST,(WPARAM)LVSIL_SMALL,(LPARAM)smalPic);
      ::SendMessage(m_listControl.m_hWnd,LVM_SETIMAGELIST,(WPARAM)LVSIL_NORMAL,(LPARAM)bigPic);

     }
     m_listControl.SetExtendedStyle(LVS_EX_GRIDLINES||LVS_EX_FULLROWSELECT);
     m_listControl.InsertColumn(0,"文件名",LVCFMT_LEFT,200);
     m_listControl.InsertItem(0,"folder",GetIndexIcon("",TRUE,FALSE));
     m_listControl.InsertItem(1,"text1",GetIndexIcon(".doc",FALSE,FALSE));
     m_listControl.InsertItem(2,"text2",GetIndexIcon(".txt",FALSE,FALSE));
     return TRUE;  // return TRUE  unless you set the focus to a control
    }
    int CShowSysIcoDlg::GetIndexIcon(LPCTSTR lpPath,BOOL isDir,BOOL isSelected)
    {
     SHFILEINFO sfi;
     memset(&sfi,0,sizeof(sfi));
     if (isDir)
     {
      SHGetFileInfo(lpPath,FILE_ATTRIBUTE_DIRECTORY,&sfi,sizeof(sfi),SHGFI_SMALLICON|SHGFI_SYSICONINDEX|SHGFI_USEFILEATTRIBUTES|(isSelected?SHGFI_OPENICON:0));
      return sfi.iIcon;
     }
     else
     {
      SHGetFileInfo(lpPath,FILE_ATTRIBUTE_NORMAL,&sfi,sizeof(sfi),SHGFI_SMALLICON|SHGFI_SYSICONINDEX|SHGFI_USEFILEATTRIBUTES|(isSelected?SHGFI_OPENICON:0));
      return sfi.iIcon;
     }
     return -1;
    }



    2.
  • 相关阅读:
    设计模式之观察者模式
    设计模式之备忘录模式
    设计模式之中介者模式
    设计模式之迭代器模式
    设计模式之解释器模式
    设计模式之命令模式
    设计模式之职责链模式
    设计模式之代理模式
    设计模式之享元模式
    设计模式之外观模式
  • 原文地址:https://www.cnblogs.com/xianqingzh/p/1578283.html
Copyright © 2011-2022 走看看