Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

VB6: Toolbar Icons

Empfohlene Antworten

Veröffentlicht

Hi,

weiß hier jemand wie man einem Toolbar Button ein Icon zuweisen kann, ohne dass das Icon in einer ImageList ist, also so das ich z.b. den Namen einer Datei nehme und er das Icon dieser Datei nimmt...?

Danke im voraus

... oder ich formuliere mein frage mal etwas um... wie kann ich das Icon aus einer Compilierten EXE datei 'herausholen'... also das machen was man unter den Eigenschaften eines Shortcuts als Change Icon findet?

Also möchtest Du einem ToolBarButton ein Icon aus einer EXE-Datei zuweisen?

Original geschrieben von LoneGunman

Also möchtest Du einem ToolBarButton ein Icon aus einer EXE-Datei zuweisen?

richtitsch...

AFAIK geht das nicht. Eine Toolbar benötigt Icons in einer ImageList.

Nachtrag: Wenn Du Icons während der Entwicklungszeit in Deine ToolBar hinzufügen möchtest, dann kannst Du die Icons mit Resource Hacker (zu finden als Freeware auf der aktuellen ct) aus den EXE- und DLL-Dateien extrahieren.

und per VB kann man das nicht irgendwie machen :confused:

mh naja gut ok - Danke für deine Hilfe ;)

  • 4 Wochen später...

sollte es jemanden interessieren:


Private Declare Function SHGetFileInfo Lib "shell32.dll" Alias _
"SHGetFileInfoA" (ByVal pszPath As Any, ByVal _
dwFileAttributes As Long, psfi As ShellFileInfoType, ByVal _
cbFileInfo As Long, ByVal uFlags As Long) As Long

Private Type ShellFileInfoType
hIcon As Long
iIcon As Long
dwAttributes As Long
szDisplayName As String * 260
szTypeName As String * 80
End Type

Private Declare Function OleCreatePictureIndirect Lib "oleaut32.dll" (pDicDesc As IconType, riid As CLSIdType, ByVal fown As Long, lpUnk As Object) As Long

Private Type CLSIdType
id(16) As Byte
End Type

Private Type IconType
cbSize As Long
picType As PictureTypeConstants
hIcon As Long
End Type

Private Const Small = &H101
Dim i As Integer

Private Sub Command1_Click()
cd.ShowOpen
BuildButton cd.FileName, "test", "i" & i
i = i + 1
End Sub


Public Function BuildButton(strImageKey As String, strTooltipText As String, intNr As String)
'sollen Buttons in de Toolbar während der Laufzeit erstellt werden, so brauch man diese funktion
Dim imgX As ListImage
Dim btnX As Button

If strImageKey = "tbrSeparator" Then
Set btnX = Toolbar1.Buttons.Add(, , , tbrSeparator)
Else
ImageList2.ListImages.Add , intNr, LoadIcon(Small, cd.FileName)
Toolbar1.ImageList = ImageList2
Set btnX = Toolbar1.Buttons.Add(, intNr, , tbrDefault, intNr)
btnX.ToolTipText = strTooltipText
btnX.Description = btnX.ToolTipText
End If
End Function

Private Function LoadIcon(Size&, File$) As IPictureDisp

Dim Result&
Dim Unkown As IUnknown
Dim Icon As IconType
Dim CLSID As CLSIdType
Dim ShellInfo As ShellFileInfoType

Call SHGetFileInfo(File, 0, ShellInfo, Len(ShellInfo), Size)

Icon.cbSize = Len(Icon)
Icon.picType = vbPicTypeIcon
Icon.hIcon = ShellInfo.hIcon
CLSID.id(8) = &HC0
CLSID.id(15) = &H46
Result = OleCreatePictureIndirect(Icon, CLSID, 1, Unkown)
Set LoadIcon = Unkown

End Function

Private Sub Form_Load()
i = 1
End Sub
[/PHP]

... benötigt wird: Button(Command1), ImageList (ImageList2), Toolbar (Toolbar1), Commondialog (cd)

Danke. [copy]+[paste]

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.