Q&A

  • 다시 질문 드립니다.
바탕화면에 그림을 띠울려고 하는데 안되네요

조규춘님이 가르쳐 주실걸로 했는데도 안되요

그래서 또 질문을 드립니다.

에러는 없네요.

디스플레이 정보에 가면 바뀌어는 있는데 바탕화면에는 없네요.

뭐가 잘못 된건지 도통 모르겠네요.

부탁합니다.한번 봐 주세요.







unit Unit1;



interface



uses

Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

Registry,Winprocs, StdCtrls;



type

TForm1 = class(TForm)

Button1: TButton;

procedure Button1Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;



var

Form1: TForm1;



const

WPS_Tile = 0; //바둑식 배열

WPS_Center = 1; //가운데

WPS_SizeToFit = 2; //늘리기

WPS_XY = 3; //x, y위치에 그리기



implementation



{$R *.DFM}











procedure SetWallpaperExt(sWallpaperBMPPath : string; nStyle, nX, nY :

integer );

var

reg : TRegIniFile;

s1 : string;

X, Y : integer;

begin

reg := TRegIniFile.Create('Control PanelDesktop' );



with reg do

begin

s1 := '0';

X := 0;

Y := 0;



case nStyle of

WPS_Tile : s1 := '1';

WPS_Center: nStyle := WPS_Tile;

WPS_XY :

begin

nStyle := WPS_Tile;

X := nX;

Y := nY;

end;

end;



WriteString( '', 'Wallpaper', sWallpaperBMPPath );

WriteString( '', 'TileWallpaper',s1 );

WriteString( '', 'WallpaperStyle', IntToStr( nStyle ) );

WriteString( '', 'WallpaperOriginX', IntToStr( X ) );

WriteString( '', 'WallpaperOriginY', IntToStr( Y ) );

end;

reg.Free;



SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, Nil, SPIF_SENDWININICHANGE );

end;





procedure TForm1.Button1Click(Sender: TObject);

begin

SetWallpaperExt('c:windows11.bmp',WPS_XY,10,200);

end;



end.

4  COMMENTS
  • Profile
    이재원 2000.07.07 17:05
    요렇게 한번 해 보시고요.



    procedure TForm1.Button1Click(Sender: TObject);

    begin

    if not SystemParametersInfo(SPI_SETDESKWALLPAPER,0,

    pChar('c:windowsnewwallpaper.bmp'),

    SPIF_UPDATEINIFILE or SPIF_SENDWININICHANGE) then

    ShowMessage(SyserrorMessage(GetlastError()));

    end;



    혹시나 active desktop 사용하시면 아래와 같이 하셔야 되는걸로 알고 있읍니당.



    procedure ChangeActiveWallpaper;

    const

    CLSID_ActiveDesktop: TGUID = '{75048700-EF1F-11D0-9888-006097DEACF9}';

    var

    ActiveDesktop: IActiveDesktop;

    begin

    ActiveDesktop := CreateComObject(CLSID_ActiveDesktop)

    as IActiveDesktop;

    ActiveDesktop.SetWallpaper('c:windowsprofilesdavedesktopfern.jpg', 0);

    ActiveDesktop.ApplyChanges(AD_APPLY_ALL or AD_APPLY_FORCE);

    end;

  • Profile
    최용일 2000.07.06 21:51
    안녕하세요. 최용일입니다.



    아래와 같이 고쳐서 해보세요...



    SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, Nil, SPIF_SENDWININICHANGE );



    ===>



    SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, Nil, SPIF_SENDCHANGE);



    안되면 아래것으로...



    SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, Pointer(sWallpaperBMPPath)

    , SPIF_SENDCHANGE);



    ^^ 항상 즐코하세요.



    조헌철 wrote:

    > 바탕화면에 그림을 띠울려고 하는데 안되네요

    > 조규춘님이 가르쳐 주실걸로 했는데도 안되요

    > 그래서 또 질문을 드립니다.

    > 에러는 없네요.

    > 디스플레이 정보에 가면 바뀌어는 있는데 바탕화면에는 없네요.

    > 뭐가 잘못 된건지 도통 모르겠네요.

    > 부탁합니다.한번 봐 주세요.

    >

    >

    >

    > unit Unit1;

    >

    > interface

    >

    > uses

    > Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

    > Registry,Winprocs, StdCtrls;

    >

    > type

    > TForm1 = class(TForm)

    > Button1: TButton;

    > procedure Button1Click(Sender: TObject);

    > private

    > { Private declarations }

    > public

    > { Public declarations }

    > end;

    >

    > var

    > Form1: TForm1;

    >

    > const

    > WPS_Tile = 0; //바둑식 배열

    > WPS_Center = 1; //가운데

    > WPS_SizeToFit = 2; //늘리기

    > WPS_XY = 3; //x, y위치에 그리기

    >

    > implementation

    >

    > {$R *.DFM}

    >

    >

    >

    >

    >

    > procedure SetWallpaperExt(sWallpaperBMPPath : string; nStyle, nX, nY :

    > integer );

    > var

    > reg : TRegIniFile;

    > s1 : string;

    > X, Y : integer;

    > begin

    > reg := TRegIniFile.Create('Control PanelDesktop' );

    >

    > with reg do

    > begin

    > s1 := '0';

    > X := 0;

    > Y := 0;

    >

    > case nStyle of

    > WPS_Tile : s1 := '1';

    > WPS_Center: nStyle := WPS_Tile;

    > WPS_XY :

    > begin

    > nStyle := WPS_Tile;

    > X := nX;

    > Y := nY;

    > end;

    > end;

    >

    > WriteString( '', 'Wallpaper', sWallpaperBMPPath );

    > WriteString( '', 'TileWallpaper',s1 );

    > WriteString( '', 'WallpaperStyle', IntToStr( nStyle ) );

    > WriteString( '', 'WallpaperOriginX', IntToStr( X ) );

    > WriteString( '', 'WallpaperOriginY', IntToStr( Y ) );

    > end;

    > reg.Free;

    >

    > SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, Nil, SPIF_SENDWININICHANGE );

    > end;

    >

    >

    > procedure TForm1.Button1Click(Sender: TObject);

    > begin

    > SetWallpaperExt('c:windows11.bmp',WPS_XY,10,200);

    > end;

    >

    > end.

  • Profile
    조헌철 2000.07.07 00:58
    답변 잘 읽었습니다.

    하지만 그렇게 해도 안되네요.



  • Profile
    조규춘 2000.07.07 01:04
    조헌철 wrote:

    > 답변 잘 읽었습니다.

    > 하지만 그렇게 해도 안되네요.

    >



    한번 만든 소스 저에게 매일로 보내주셔 보셔요.... 직접 해볼께요