Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2005.12.25;
Скачать: CL | DM;

Вниз

Applet в другом потоке   Найти похожие ветки 

 
Vladimyr ©   (2005-04-28 13:30) [0]

Добрый день, нужно запускать Апплет в отдельном потоке несколько раз.
Первый запуск проходит нормально, а вот второй и последующие - нет.
Вот код:


// запуск треда
   hThread:= CreateThread (nil, 0, @PrThread, nil, 0, ThID);
   WaitForSingleObject (hThread, INFINITE);  // ждём, пока тред не завершится
   CloseHandle (hThread);
   hThread := 0;


.............................


// собственно тред
function PrThread (P: Pointer): DWORD; stdcall;
begin                                      
 try
    if Applet = nil then Applet := NewApplet ("Applet");
    NewSettForm (SettForm, Pointer (Applet));
    Applet.AllBtnReturnClick;
    run (Applet);                  
 finally
    result:= GetLastError;
 end;      
end;


Результат - invalid handle. Что же здесь не так?..


 
Vladimyr ©   (2005-04-29 00:12) [1]

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

Я идиот !!!!!!!!!!!!!  :-|  :-(  :-C  :-@

         AppletRunning := true;
         AppletTerminated := false;

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA


 
thaddy   (2005-04-29 00:34) [2]

You can have only one applet! it is the application object!!!!
You have to write separate objects for what you want.
Look at the threads demo on my site on how to solve the problem


 
Vladimyr ©   (2005-04-29 03:35) [3]

Thanks, thaddy, all right now.
I just was an idiot :)
But I have really one Applet,
just need to run it several times.


 
thaddy   (2005-04-29 09:04) [4]

Do you mean you have one defined task that you have to run several times? in that case put the task in threads.
Do you mean you have to run a full application several times?
Use createprocess from a controller application instead of Thread. Createprocess also gives you a handle you can use in the synchro primitives


 
Vladimyr ©   (2005-04-29 21:31) [5]

I need to start Applet more and more from inside itself :)
This trick is now working, thanks.



Страницы: 1 вся ветка

Текущий архив: 2005.12.25;
Скачать: CL | DM;

Наверх




Память: 0.48 MB
Время: 0.037 c
14-1133505317
ZeroDivide
2005-12-02 09:35
2005.12.25
Развод или нет?


14-1133717977
Дмитрий Белькевич
2005-12-04 20:39
2005.12.25
Регистрация tbx и toolbar 2000. Кому и сколько за них платить?


2-1134294907
Kot
2005-12-11 12:55
2005.12.25
Реидексация


8-1121626571
ronyn
2005-07-17 22:56
2005.12.25
Как DS Pack ом простые фильмы и музыка проигрываются?


1-1133417197
RoboCop
2005-12-01 09:06
2005.12.25
Удалить границу у TComboBox