التنبيهات التالية ظهرت :
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 864 - File: showthread.php PHP 7.4.33 (Linux)
File Line Function
/showthread.php 864 errorHandler->error



تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
تعديل هذا الكود
#1
كود :
Imports System.Drawing
Imports System.Windows.Forms
Imports System.Management

Public Class icoExtractor

    Private Declare Auto Function SHGetFileInfo Lib "shell32" (ByVal pszPath As String, ByVal dwFileAttributes As Integer, ByRef newHandle As IntPtr, ByVal cbFileInfo As Integer, ByVal uFlagsn As Integer) As Integer

    Private Structure icoInfo
        Public iconPath As String 'self explanatory, path of the process (where to get the icon)
        Public processName As String 'again, obvious, process name. herp derp.
        Public Sub New(ByVal i As String, ByVal p As String)
            Me.iconPath = i
            Me.processName = p
        End Sub
    End Structure

    Private Function getIcon(ByVal processPath As String) As Image
        Dim icoHandle As IntPtr = IntPtr.Zero 'create the variable to hold the handle, will be passed ByRef to the API and the actual handle will result.
        Dim flags As Integer = &H100 Or &H10 Or &H1 'set the flags, basically says it's an icon, it's a small icon and some file shit
        SHGetFileInfo(processPath, 256, icoHandle, 0, flags) 'API call, will point to our icon.
        Dim ico As Icon = Icon.FromHandle(icoHandle) 'extract the icon from the handle.
        Return ico.ToBitmap 'return the icon.
    End Function

    Public Shared Function getProcessIcons(ByVal processList As Process()) As ImageList
        Dim procNames As String() = processList.Select(Function(p As Process) p.ProcessName).ToArray 'get the names of the processes in the list
        Dim output As New ImageList 'create the imagelist we'll return.
        Dim tempExtractor As New icoExtractor 'create an instance of the icoExtractor class to access the private methods.
        Dim pList As List(Of icoInfo) = tempExtractor.getPaths(procNames) 'get the icon paths of all the processes.
        For Each p As icoInfo In pList 'loop through the iconInfo of each entry.
            If Not output.Images.ContainsKey(p.processName) Then output.Images.Add(p.processName, tempExtractor.getIcon(p.iconPath)) 'check if the imagelist contains the key, if not add the icon to the list.
        Next
        Return output 'return the imagelist.
    End Function
    Private Function getPaths(ByVal procNames As String()) As List(Of icoInfo)
        Dim pList As New List(Of icoInfo) 'the output variable.
        Using searcher As New ManagementObjectSearcher("root\CIMV2", "select * from Win32_Process") 'query the root\CIMV2 path, with the select * from Win32_Process query, will return info on every process.
            Using iterator As ManagementObjectCollection.ManagementObjectEnumerator = searcher.Get.GetEnumerator 'get the Enumerator to step through each object that the query returned
                While iterator.MoveNext 'while there is still more processes...
                    Dim name As String = IO.Path.GetFileNameWithoutExtension(iterator.Current("name").ToString) 'use the IO.Path class to remove and extensions from the process name (.exe etc)
                    If procNames.Contains(Name) AndAlso iterator.Current("ExecutablePath") IsNot Nothing Then 'if the original process list contains this process, and it has an executable path...
                        pList.Add(New icoInfo(iterator.Current("ExecutablePath").ToString, name)) 'add it to the icoInfo list
                    End If
                End While
            End Using 'dispose the Enumerator
        End Using 'dispose the ObjectSearcher
        Return pList 'return the list of icoInfo.
    End Function
End Class
الخطئ فى هذا السطر
كود :
Using searcher As New ManagementObjectSearcher("root\CIMV2", "select * from Win32_Process")
الرد }}}
تم الشكر بواسطة:


الردود في هذا الموضوع
تعديل هذا الكود - بواسطة مبتدئ - 03-02-13, 09:18 PM
تعديل هذا الكود - بواسطة m.sami.ak_mybb_import4434 - 04-02-13, 10:52 AM

المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  تعديل على فاتورة مبيعات خالد كامل1 4 69 26-03-24, 10:49 PM
آخر رد: خالد كامل1
  تعديل كود ارسال صورة الى الواتس new_programer 2 114 21-03-24, 10:07 PM
آخر رد: new_programer
  تعديل صب المجموع الكلي والمعدل والتقدير مصمم هاوي 3 131 19-03-24, 01:33 AM
آخر رد: مصمم هاوي
  تعديل طول حقل معين في جميع جداول القاعدة atefkhalf2004 1 97 09-03-24, 03:17 AM
آخر رد: atefkhalf2004
  تعديل بيانات عمود DataGridView دفعة واحدة مصمم هاوي 2 164 05-03-24, 08:27 PM
آخر رد: مصمم هاوي
  ممكن حل المشكلة فى الكود التالي - من مشاركة استاذنا القدير / عبدالله الدوسري new_programer 4 169 02-03-24, 07:36 PM
آخر رد: new_programer
  ماهو حل هذا الخطأ في الكود melad2002 7 264 25-02-24, 12:25 AM
آخر رد: justforit
  كيفية انشاء سكريبت لقاعدة بيانات من خلال الكود heem1986 1 194 20-02-24, 12:00 AM
آخر رد: Kamil
  [VB.NET] أرغب فى استخدام هذا الكود بالتحديد على الإصدار 10 AmeenRashed 3 206 19-01-24, 12:42 PM
آخر رد: Taha Okla
  ممكن تعديل في كود التفقيط للارقام melad2002 2 334 01-01-24, 08:47 PM
آخر رد: melad2002

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم