[Release] Window-Icon (Only Windows!!!)

Previous topic - Next topic

Schranz0r

So hier mal eine möglichkeit, ein Fenstericon zu setzen, ohne einen Recourcenhacken zuhilfe zu nehmen!

Leider nur Windows ONLY!


Code (glbasic) Select
SetIcon("icon.ico")

WHILE TRUE

PRINT "look at the window-icon!!",10,10

SHOWSCREEN
WEND
END


FUNCTION Close:
ENDFUNCTION

INLINE
DECLARE_C_ALIAS(u32_GetActiveWindow,"user32.dll", "GetActiveWindow",(),int);
DECLARE_C_ALIAS(u32_SetClassLong,"user32.dll", "SetClassLongA",(int,int,int), void);
DECLARE_C_ALIAS(shell32_LoadIcon,"Shell32.dll", "ExtractIconA",(int,const char*,int), int);
ENDINLINE

FUNCTION SetIcon: Iconname$ // use a 16x16 icon
LOCAL hwnd, icon
INLINE
hwnd = u32_GetActiveWindow();
icon = shell32_LoadIcon(hwnd,Iconname_Str.c_str(),0);
u32_SetClassLong(hwnd,-14,icon);
ENDINLINE
ENDFUNCTION

Wie erstelle ich ein Icon?
1.öffne Paint
2.bild auf 16x16 einstellen
3.was reinmalen
4.speichern unter "name.ico" , drücke ENTER

Fertig!
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Quentin

chic,

aber sind Icons normalerweise nicht 16x16 Pixel?
klappt zumindest auch damit.

Schranz0r

I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

trucidare

Gernot deine Inline Funktion wird beliebter ;)
Ich bin übrigens aus meiner WinterDepri raus und kann endlich wieder proggen hehe
MacBook Pro 2,2 GHz Core 2 Duo, 4 GB RAM, 160 GB HDD, 8600M GT
Core i3 - 3,07 GHz, 8 GB Ram, 2.5 TB HDD, Geforce GTX 260+ OC

Kitty Hello


Schranz0r

:good: mach ich doch alles für meine geliebte Community ;)
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Schranz0r

I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

trucidare

das hast du doch selbst verschoben schranzi ^^
MacBook Pro 2,2 GHz Core 2 Duo, 4 GB RAM, 160 GB HDD, 8600M GT
Core i3 - 3,07 GHz, 8 GB Ram, 2.5 TB HDD, Geforce GTX 260+ OC

Schranz0r

Deshalb sag ich ja kein Ahnung :D

Weils mit Inline und WinAPI war ?
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Schranz0r

I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard