AnimateWindow lazarus / 8-Other ---------------------------------------------------------------------- cpalx · 2009-03-02 22:22 Hello, did somebody try to use AnimateWindow from user32.dll. Spesific i would like to use this code procedure TForm1.Button1Click(Sender: TObject); begin   form2.BringToFront;   form1.Hide;   AnimateWindow(form2.Handle,2000,AW_CENTER);   form2.show; ----- procedure TForm2.FormHide(Sender: TObject); begin   form1.Show; end; i tried to called it like this: procedure TForm1.Animar(): Boolean; var iBiblioteca: word; Begin           iBiblioteca:=LoadLibrary(pchar('user32.dll'));  // Encriptacion           if iBiblioteca <>0 then             pointer(AnimateWindow)  := GetProcAddress(iBiblioteca, 'AnimateWindow');                else  showmessage('Error') End;  procedure TForm1.FormCreate(Sender: TObject); begin   Animar(); end; procedure TForm1.Button1Click(Sender: TObject); begin    form2.BringToFront;  // form1.Hide;   AnimateWindow(form2.Handle,2000,AW_CENTER);   form2.show; end; procedure TForm1.FormActivate(Sender: TObject); begin   if form2.bVariable then begin      form2.bVariable:=false;     form1.Show;   end end;          but nothing ---------------------------------------------------------------------- Leledumbo · 2009-03-03 03:53 It's not yet in Windows unit? If so, what's the type of AnimateWindow on this line: Code: [Select]pointer(AnimateWindow) := GetProcAddress(iBiblioteca, 'AnimateWindow');make sure it uses stdcall calling convention. About above code, I'm not sure whether it's the correct way to get procedure address or not. See an example here. ---------------------------------------------------------------------- cpalx · 2009-03-03 16:29 this code, works in Delphi ... procedure AnimateSafe(hWnd: HWND; dwTime: DWord; dwFlags: DWord); type     d = function(a: THandle; b, c: DWord): Boolean; stdcall; var     e, f: integer;     g: d; begin try     e := LoadLibrary('user32.dll');     if e = 0 then         exit     else         begin             g := GetProcAddress(e, 'AnimateWindow');             if @g = nil then                 exit             else                 begin                     g(hWnd, dwTime, dwFlags);                 end;         end; finally     FreeLibrary(e); end; end; //Use AnimateSafe like: procedure TForm1.FormCreate(Sender: TObject); begin     AnimateSafe(Handle, 300, AW_BLEND or AW_ACTIVATE);     Self.Invalidate; end; -------------- so, how can it be in Lazarus? ---------------------------------------------------------------------- Leledumbo · 2009-03-04 03:35 Quotethis code, works in Delphi ... so, how can it be in Lazarus?Because ObjFPC and Delphi treats procedural variables in different way (don't worry, a compatible solution exists). Refer to the docs or wiki.