Rozwiązałem już to na "swój sposób".
Głównym założeniem było to, by z wątków, które nie były zsynchronizowane, wyświetlić messageboxa, który były zsynchronizowany i uzyskać jego rezultat.
(W programie używam AplhaSkinów i okienka asynchroniczne nie są oskinowanie ;s )
Jak sądzicie? Dobrze to zbudowałem, czy dało się jakoś szybciej / ładniej?
type
Tmymsg = class(TThread)
private
_wiadomosc:string;
_caption:string;
_output:^integer;
_icon:integer;
procedure show;
procedure execute; override;
public
finished:boolean;
constructor Create(wiadomosc:string; caption:string; output:pointer; icon:integer=0);
end;
constructor Tmymsg.Create(wiadomosc:string; caption:string; output:pointer; icon:integer=0);
begin
_wiadomosc:=wiadomosc;
_caption:=caption;
_output:=output;
_icon:=icon;
finished:=false;
inherited Create(False); // wywołanie wątku
end;
procedure Tmymsg.show;
begin
_output^:=application.MessageBox(pchar(_wiadomosc), pchar(_caption), _icon);
end;
procedure Tmymsg.Execute;
begin
Synchronize(show);
finished:=true;
end;
Wywołuję to funkcją:
function mymsgbox(wiadomosc:string; caption:string; icon:integer=0):integer;
var
q:Tmymsg;
begin
q:=Tmymsg.Create(wiadomosc, caption, @result, icon);
while not(q.finished) do
begin
sleep(10);
application.ProcessMessages;
end;
end;
A w samym kodzie docelowym:
if mymsgbox('tresc', 'caption', parametry)=6 then ...