The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: G`HOST on October 28, 2005, 05:32:34 AM

Title: SystemParametersInfo problem
Post by: G`HOST on October 28, 2005, 05:32:34 AM
hi
a problem in SystemParametersInfo

       
Quote.IF ax==Button1Id
       invoke SystemParametersInfo,SPI_SETDESKWALLPAPER,NULL,ADDR Wall1,\
                                             SPIF_SENDWININICHANGE
        .ENDIF 

This thing works until the "ADDR Wall1" points to the address of the bitmap file.
But if i change it to the address of the resource identifier it does not change the wallpaper.
   
.rc file ==>>
QuoteWall BITMAP DISCARDABLE "wallpaper.bmp"

Help
Thanks
Title: Re: SystemParametersInfo problem
Post by: hutch-- on October 28, 2005, 07:01:10 AM
Try this.


; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    include \masm32\include\masm32rt.inc
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

    .data?
      value dd ?

    .data
      pImage db "c:\winnt\bridge.bmp",0

    .code

start:
   
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

    call main

    exit

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

main proc

    invoke SystemParametersInfo,SPI_SETDESKWALLPAPER,NULL,OFFSET pImage,NULL

    ret

main endp

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

end start
Title: Re: SystemParametersInfo problem
Post by: hutch-- on October 28, 2005, 08:14:50 AM
Here is a small working app that does a lot of what you require.

[attachment deleted by admin]
Title: Re: SystemParametersInfo problem
Post by: G`HOST on October 28, 2005, 02:32:04 PM
Yes the above example works. but my problem is if i change  "  pImage db "c:\winnt\bridge.bmp",0 "
to say something like this  "pImage db "abc",0  " where as "abc" is the nameID of the Bitmap described in the resource file then this thing does not work, do "SystemParameterInfo" only accept the string reffering to the address of the bmp file and not the resource identifier?
Title: Re: SystemParametersInfo problem
Post by: hutch-- on October 28, 2005, 03:25:30 PM
You need to look at what you are doing here, the API is designed to display a disk file. The help info is this,

Quote
Sets the desktop wallpaper. The pvParam parameter must point to a null-terminated string containing the name of a bitmap file.

Generally Windows is designed to display a disk file where trying to display a resource from an EXE file is not workable as the exe file can be closed and leave Windows with an error. You will note that it also optionally sets the INI file with the bitmap name so that the OS can display it in the normal settings box.
Title: Re: SystemParametersInfo problem
Post by: G`HOST on October 28, 2005, 06:28:40 PM
OOPS Dont know how i missed it.
THANK YOU