我制作一个进程管理器 可以用process类提取出进程 但是怎么才能把每个进程的图标提取出来啊
api的方法也行 只要具体能用c# form里实现就行了

解决方案 »

  1.   

    遍历进程,获取每个进程的文件路径,然后取图标.Private   Declare   Function   DrawIcon   Lib   "user32"   (ByVal   hdc   As   Long,   ByVal   x   As   Long,   ByVal   y   As   Long,   ByVal   hIcon   As   Long)   As   Long   
      Private   Declare   Function   ExtractIcon   Lib   "shell32.dll"   Alias   "ExtractIconA"   (ByVal   hInst   As   Long,   ByVal   lpszExeFileName   As   String,   ByVal   nIconIndex   As   Long)   As   Long   
      Private   Declare   Function   GetWindowsDirectory   Lib   "kernel32"   Alias   "GetWindowsDirectoryA"   (ByVal   lpBuffer   As   String,   ByVal   nSize   As   Long)   As   Long   
        
        
      Private   Sub   Form_Load()   
        Dim   Path   As   String,   strSave   As   String   
        strSave   =   String(200,   Chr$(0))   '缓冲区   
        Path   =   Left$(strSave,   GetWindowsDirectory(strSave,   Len(strSave)))   +   "\REGEdit.exe"   
        Picture1.Picture   =   LoadPicture()   
        Picture1.AutoRedraw   =   True   
        return1&   =   ExtractIcon(Me.hWnd,   Path,   2)   '从可执行文件中提取ICO   
        return2&   =   DrawIcon(Picture1.hdc,   0,   0,   return1&)   '在picture中重画ICO   
      End   Sub