vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
Blitzschnelles Erstellen von grafischen Diagrammen!  
 vb@rchiv Quick-Search: Suche startenErweiterte Suche starten   Impressum  | Datenschutz  | vb@rchiv CD Vol.6  | Shop Copyright ©2000-2025
 
zurück

 Sie sind aktuell nicht angemeldet.Funktionen: Einloggen  |  Neu registrieren  |  Suchen

VB.NET - Fortgeschrittene
Re: Icon aus EXE oder DLL im 16x16 Format 
Autor: Maywood
Datum: 11.07.07 10:54

Okay, wer richtig lesen kann ist klar im Vorteil.

16x16 Icons bekommst du mit der Win32Api ExtractIconEx. In etwa so würde ich es machen:
    Public Declare Function ExtractIconEx Lib "shell32.dll" Alias _
      "ExtractIconExA" ( _ 
    						ByVal lpszFile As String, _
							ByVal nIconIndex As Integer, _
							ByVal phIconLarge() As Integer, _
							ByVal phIconSmall() As Integer, _
							ByVal nIcons As Integer) As Integer
 
	Sub Button3Click(ByVal sender As Object, ByVal e As EventArgs)
		Const MAXSIZE As Integer = 4
		Dim SmallIcons(MAXSIZE) As Integer 
		Dim FileName As String = Nothing
		Dim ProcIcon As Icon = Nothing
		Dim IconHandle as IntPtr = IntPtr.Zero
		Dim g As Graphics = Me.CreateGraphics()
		Dim y As Integer = 10
		For Each CurrentProcess As Process In Process.GetProcesses()
			Try
				If ((Not CurrentProcess.Id = 0) AndAlso _ 
					(Not CurrentProcess.ProcessName.ToUpper().Equals("SYSTEM"))) Then
					FileName = CurrentProcess.MainModule.FileName
					ExtractIconEx(FileName, 0, Nothing, SmallIcons, MAXSIZE)
					IconHandle = New IntPtr(SmallIcons(0))
					If (Not (IconHandle = IntPtr.Zero)) Then 
						ProcIcon = System.Drawing.Icon.FromHandle( IconHandle )
						g.DrawIcon (ProcIcon, 10, y)
						g.DrawString(" -> " + CurrentProcess.ProcessName, _ 
						me.Font, Brushes.Black, 30, y)
						y += 25
					End If
				End If
			Catch ex as Exception 
				Debug.WriteLine (CurrentProcess.ProcessName +  " : " + ex.ToString())			
			End Try
		Next
	End Sub
alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
Icon aus EXE oder DLL im 16x16 Format1.054Neolix10.07.07 02:12
Re: Icon aus EXE oder DLL im 16x16 Format818Iced-T10.07.07 10:31
Re: Icon aus EXE oder DLL im 16x16 Format697Maywood10.07.07 10:42
Re: Icon aus EXE oder DLL im 16x16 Format642Neolix10.07.07 18:55
Re: Icon aus EXE oder DLL im 16x16 Format712Iced-T10.07.07 21:31
Re: Icon aus EXE oder DLL im 16x16 Format820Maywood11.07.07 10:54
Re: Icon aus EXE oder DLL im 16x16 Format729Iced-T11.07.07 11:14
Re: Icon aus EXE oder DLL im 16x16 Format749Maywood11.07.07 11:22
Re: Icon aus EXE oder DLL im 16x16 Format701Iced-T11.07.07 13:41
Re: Icon aus EXE oder DLL im 16x16 Format756Maywood11.07.07 13:54
Re: Icon aus EXE oder DLL im 16x16 Format601Iced-T11.07.07 15:26
Re: Icon aus EXE oder DLL im 16x16 Format692Maywood11.07.07 15:50

Sie sind nicht angemeldet!
Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.

Einloggen  |  Neu registrieren

Funktionen:  Zum Thema  |  GesamtübersichtSuchen 

nach obenzurück
 
   

Copyright ©2000-2025 vb@rchiv Dieter Otter
Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.

Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel