Icons extrahieren



  • Hi,
    ich hoffe mal das gehört hier in das forum. also folgendes Problem: Ich habe eine Icon-Datei meinicon.ICO welchere merhere Icons (beliebige Formate) enthält. Wie kann ich diese "extrahieren" damit ich sie danach mit DrawIcon() in ein HDC zeichnen kann?
    Ich hab schon ExtractIcon ausprobiert, aber als anzahl der Icons gibt er immer 1 zurück, obwohl das icon mind. 3 enthält.

    Kan mir jdn helfen?



  • Salim schrieb:

    Ich hab schon ExtractIcon ausprobiert, aber als anzahl der Icons gibt er immer 1 zurück, obwohl das icon mind. 3 enthält.

    ExtractIcon gibt doch nicht die Anzahl der Icons zurück 😕



  • Wenn man für IconIndex -1 übergibt, dann nach MSDN angeblich schon.
    Auf jdn fall scheint ExtractIcon nicht zu funktionieren, der holt mir nur einen Icon raus.



  • Die Doku sagt ja auch zum letzten Parameter:

    nIconIndex

    [in] Specifies the zero-based index of the icon to retrieve. For example, if this value is 0, the function returns a handle to the first icon in the specified file.
    If this value is –1, the function returns the total number of icons in the specified file. If the file is an executable file or DLL, the return value is the number of RT_GROUP_ICON resources. If the file is an .ICO file, the return value is 1.

    Vielleicht hilft dir ExtractIconEx? Das kann mehr Icons extrahieren als ExtractIcon.



  • Genau das ist ja auch das doofe Problem :'(, bei ExtractIconEx besteht das gleiche Problem: "If the file is an .ico file, the return value is 1."



  • Salim schrieb:

    bei ExtractIconEx besteht das gleiche Problem: "If the file is an .ico file, the return value is 1."

    Ja, aber in einem .ico-file können doch nur verschiedene Größen eines Icons gespeichert werden. Nicht verschiedene Icons (mit gleicher Größe).
    Mit ExtractIconEx kannst du die verschiedenen Größen extrahieren.

    Falls das nicht das ist, was du willst: Beschreib doch bitte nochmal genau dein Ziel und den Inhalt dieser ico-datei.



  • Danke, aber ich habs jetzt mit den Beispielfunktionen vom IconPro Beispiel (ReadIconFromICOFile(), etc.) probiert, und es klappt eigentlich ganz super.
    Nur eine Frage: ich setze die Transparenz durch die lpANDBits, ist das richtig? Doch es gibt noch was anderes, undzwar dieses "Invert", wenn man ja Icons erstellt, kann man ja auch Transparente Pixel setzen, aber auch "Invertierende Pixel" setzen (d.h. weiß->schwarz, etc.), das gibts aber bei cursoren öfters als bei Icons, kann man das auch irgendwie rauskriegen?


Anmelden zum Antworten