Salut,
J'essaie de faire une horloge skinable qui pourrait s'integrer au bureau de windows, et pour ca, il semble que le plus simpl (disons le moins compliqué...) soit d'utiliser ActiveDesktop et ajouter un element, seulement quand j'execute la methode AddDesktopItem, rien ne se passe, et dans le HRESULT j'ai "parametre incorrect" comme code de retour, mais je vois pas du tout quel parametre est incorrect!
j'ai essayé aussi avec AddURL et AddiDesktopItemWithUI mais pas mieux...
voila le code que j'utilise:
--------------------------------------------------------------------------------
const
CLSID: TGUID = '{75048700-EF1F-11D0-9888-006097DEACF9}';
IID_IActiveDesktop: TGUID = '{F490EB00-1240-11D1-9888-006097DEACF9}';
...
procedure TForm1.Button1Click(Sender: TObject);
Var ADeskTop: IActiveDesktop;
AComponent : _tagCOMPONENT;
ACompPos : _tagCOMPPOS;
hr: HRESULT;
BmpName : String;
begin
BmpName := 'http://www.yahoo.fr';
hr := CoCreateInstance(CLSID_ActiveDesktop, nil, CLSCTX_INPROC_SERVER,
IID_IActiveDesktop, ADeskTop );
MessageDlg(SysErrorMessage(HResultCode(hr)),mtWarning,[mbOK],-1); // => 'Operation Reussie' donc le probleme vient pas de la (enfin je pense)
ACompPos.dwSize := SizeOf(_tagCOMPPOS);
ACompPos.iLeft := 200;
ACompPos.iTop := 200;
ACompPos.dwWidth := ItemBmp.Width + 1;
ACompPos.dwHeight := ItemBmp.Height + 1;
ACompPos.izIndex := 0;
ACompPos.fCanResize := True;
ACompPos.fCanResizeX := True;
ACompPos.fCanResizeY := True;
ACompPos.iPreferredLeftPercent := 10;
ACompPos.iPreferredTopPercent := 10;
AComponent.dwSize := sizeof(_tagCOMPONENT);
AComponent.dwID := 0;
AComponent.iComponentType := COMP_TYPE_WEBSITE;
AComponent.fChecked := True;
AComponent.fDirty := False;
AComponent.fNoScroll := true;
AComponent.cpPos := ACompPos;
MultiByteToWideChar(CP_ACP,0,PChar(BmpName),StrLen(PChar(BmpName))+1,AComponent.wszFriendlyName,sizeof(AComponent.wszFriendlyName));
MultiByteToWideChar(CP_ACP,0,PChar(BmpName),StrLen(PChar(BmpName))+1,AComponent.wszSource,sizeof(AComponent.wszSource));
MultiByteToWideChar(CP_ACP,0,PChar(BmpName),StrLen(PChar(BmpName))+1,AComponent.wszSubscribedURL,sizeof(AComponent.wszSubscribedURL));
hr := ADeskTop.AddDesktopItem(AComponent,0);
MessageDlg(SysErrorMessage(HResultCode(hr)),mtWarning,[mbOK],-1); // 'Parametre incorrect' mais LEQUEL !!??!?
ADeskTop.ApplyChanges(AD_APPLY_ALL);
// ADesk._Release; -> provoque une violation d'acces (??)
end;
--------------------------------------------------------------------
Donc si quelqu'un peut m'aider, HEEEEELLLLPPPPPP!!!!!
Merci!
saib