Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "KOL";
Текущий архив: 2005.08.14;
Скачать: [xml.tar.bz2];

Вниз

How to pass string from TKOLThread to KOL form ?   Найти похожие ветки 

 
Boguslaw   (2005-01-06 17:51) [0]

How to pass string from TKOLThread to KOL form in thread-safe operation ?
I"m using SendMessage(Form.Handle,WM_MYEVENT,x,y)
to pass some information to KOL form in main thread, but how to pass AnsiString ? (WM_MYEVENT = WM_USER+1)

SendMessage(Form.Handle,WM_MYEVENT,x,Integer(PChar(AnsiString)))

crash my application.
I want to add some report line to listbox from working TKOlThread.

Please,help.


 
Slay   (2005-01-06 18:55) [1]

Make  attempt to write so:
SendMessage(Form.Handle,WM_MYEVENT,x,Integer(@String));
(AnsiString must be global variable in Form module)
To insert AnsiString for example in MEMO write:
...
memo1.add("String="+string(pointer(lParam)^));
...


method 2:
you can use Thread.Synchronize or SynchronizeEx

forgive for English I translated by the program :)


 
SPeller ©   (2005-01-06 21:08) [2]

You can use the WM_COPYDATA message to send any data to any window. If you send data with this message, Windows automatically use its internal mechanisms to send true data to the receiver. You may use your own values of the wParam to determine that received data is a string.


 
thaddy   (2005-01-07 17:50) [3]

You can also use my KOL ipc streams for those kind of tasks. They are inherently threadsafe.


 
Boguslaw   (2005-01-07 19:56) [4]

Thread.Synchronize seems to be working
I just save current value in ansistring  KOLForm object private member and execute Thread.Synchonize against DoUpdate procedure which takes these private memeber and update GUI (Label,ListBox etc) in main thread context.
I suppose this is correct ?  Anyway it is working without crash on many computers now.


 
thaddy   (2005-01-09 15:02) [5]

I have added Thread synchronization primitives for KOL to my site to make this kind of work really simple and safe.
(Events, spinlocks, Synchro, etc) pure KOL and simple to use.


 
thaddy   (2005-01-09 16:12) [6]

And a really easy thread manager that makes working with threads really *very* easy:
http://members.chello.nl/t.koning8/kolthreadsdemo.zip
http://members.chello.nl/t.koning8/kolsyncobjs.pas



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

Форум: "KOL";
Текущий архив: 2005.08.14;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.45 MB
Время: 0.014 c
1-1122295045
AGGRESSOR
2005-07-25 16:37
2005.08.14
Куда девается память?


3-1120826005
DriveIS
2005-07-08 16:33
2005.08.14
Access+Delphi+форматированный текст


3-1120638031
Колобок
2005-07-06 12:20
2005.08.14
Посчитать максимальное?


3-1120594101
Powerful
2005-07-06 00:08
2005.08.14
Ошибка EIBClientError при подключении к БД


14-1122232341
Начинающий админ
2005-07-24 23:12
2005.08.14
Вот поступило мне предложение...





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский