FORUMS PROFESSIONNELS
WINDEV
,
WEBDEV
et
WINDEV Mobile
Accueil
|
Messages récents
|
Connexion
|
Déconnexion
|
Français
Accueil
→
WINDEV 2024
→
Icon exctraction from executable
Icon exctraction from executable
Débuté par Vassilis, 28 nov. 2011 15:04 - 3 réponses
Connectez-vous…
Vassilis
#1
Posté le 28 novembre 2011 - 15:04
Is in WD some way to extract the executable's icon, in order to assign this value to an image control ?.
The exeinfo() function does not provide such info I need.
Thank you in advance.
Signaler
0
0
Arie Mars
#2
Posté le 28 novembre 2011 - 15:44
Vassilis,
first you must include the icons in your project, under the "Other" section.
Then you can just use these icons, by referring the filename, without a path.
As if these files are on disk, in your exectables map.
i.e. ImageControl1 = "Vassilis.jpg"
Signaler
0
0
Alexandre Leclerc
#3
Posté le 28 novembre 2011 - 16:45
Hi Vassilis,
Here is a code snippet to extract the icon of another executable file. (The code to extract the icon of an ordinary file is different and a little bit more complex.)
In this example IMG_Icon is an image control with a size of 32x32. (I assume in WD17 we will be able to use the brand new image variable.)
IF
fFileExist
(
s
Exe
)
THEN
h
DC is
int
=
dStartDrawing
(
IMG_
Icon
,
dErase
)
// Get Device Context
dFill
(
0
,
0
,
White
)
// White-clear the image control
// Since it's an EXE we do not use SHGetFileInfo but ExtractIconA
h
Icon is
int
=
API
(
"Shell32"
,
"ExtractIconA"
,
SysInstance
(
)
,
s
Exe
+
Charact
(
0
)
,
0
)
IF
h
Icon
THEN
API
(
"user32"
,
"DrawIcon"
,
h
DC
,
0
,
0
,
h
Icon
)
API
(
"user32"
,
"DestroyIcon"
,
h
Icon
)
END
END
Then you can use the content of IMG_Icon to copy in any other image control. In my code I'm using dSaveImageBMP(IMG_Icon,inMemory) inside a LooperAddLine() instruction to get the icon in my looper (using an attribute on an image control).
Hope this helps.
Best regards,
Alexandre Leclerc
Signaler
0
0
Vassilis
#4
Posté le 29 novembre 2011 - 15:41
Thank you Alexandre. This code is what I want !!!
Signaler
0
0
→ Revenir à WINDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (précédentes versions)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Type de recherche
Uniquement les sujets
Tous les messages
Période de recherche
Date indifférente
Moins d'une heure
Moins de 24 heures
Moins d'une semaine
Moins d'un mois
Moins d'un an
Annuler
Aperçu de votre message
Ajouter une image
Importer une image depuis une URL
Envoyer une image depuis un fichier de votre disque
Déposez ici un fichier ou cliquez sur "Parcourir..."
ou
Annuler
0%
WLangage
SQL
XML, HTML
JAVA, Javascript
Texte