The MASM Forum

General => The Campus => Topic started by: Abdel Hamid on January 29, 2019, 09:14:20 AM

Title: how to work with image component ?
Post by: Abdel Hamid on January 29, 2019, 09:14:20 AM
Hello guys,
am trying to develop a simple application that changes the desktop wallpaper  :bgrin:
the only problem for me , how to use Image component ?
first step finished : using openfiledialog to load ("jpg files") ! (i used " Create File " to get the handle of the file opened as a first step)
second step not finished yet (loading the image to Image component) so the user can view the chosen image 
third step : Pressing the button to chage the wallpaper (finished) , i used SystemParametersInfo
now what are the functions used to deal with (Image) component ! am stuck at this stage  :(
PS : am working on both RadASM and WinAsm
thank you in advance  :t
Title: Re: how to work with image component ?
Post by: ragdog on January 29, 2019, 06:48:51 PM
second step not finished yet (loading the image to Image component) so the user can view the chosen image 

The best way to preview the image, is use gdi or gdi++ and blit it to your dialog (bitblt)

Gdi++ or Gdi
http://www.masmforum.com/board/index.php?PHPSESSID=786dd40408172108b65a5a36b09c88c0&topic=18534.0
Title: Re: how to work with image component ?
Post by: Abdel Hamid on January 29, 2019, 10:21:32 PM
Check the attachments to see what am trying to do !
i did this using VB.NET but i hate it ( need ASM code)
Title: Re: how to work with image component ?
Post by: ragdog on January 30, 2019, 12:13:47 AM
What is your problem correctly?
Your video draw the image on dialog ok,
and set the wallpaper need you SystemParametersInfo correct.

SystemParametersInfo,SPI_SETDESKWALLPAPER, 0, chr$ ("C:\wallpaper.jpg"), SPIF_UPDATEINIFILE
Title: Re: how to work with image component ?
Post by: mabdelouahab on January 30, 2019, 07:50:38 AM
It's easy.
Take the example attached and try it
Title: Re: how to work with image component ?
Post by: Abdel Hamid on January 30, 2019, 08:07:28 AM
@ragdog  , thanks for your help
@mabdelouahab thank you so much , this is exactly what i wanted to do !  :greenclp:
Title: Re: how to work with image component ?
Post by: mabdelouahab on January 30, 2019, 08:36:03 AM
بلا مزية
Title: Re: how to work with image component ?
Post by: Vortex on January 31, 2019, 04:42:51 AM
Hi mabdelouahab,

Thanks for your example. It's better than mine changing the wallpaper with COM.