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

Вниз

Using Synapse with KOL   Найти похожие ветки 

 
Jon ©   (2004-12-09 15:06) [0]

Hello - please excuse my Engish, I do not speak Russian :-(

I am using KOL with the SynaSer component of Synapse (www.ararat.cz/synapse) with Delphi 7 and Windows XP. I am not using MCK.

I find that if I create a TBlockSerial object within a function or procedure, it only exists in that procedure. If I try to access the object later, it fails. To fix this I have to create TBlockSerial within the main block of code. This is an example:

var
SerialPort: TBlockSerial;

// can be a function or a procedure
function SerialStuff(Port: String); Boolean;
begin
Result := True
SerialPort := TBlockSerial.Create;   // This line does not work!
SerialPort.Connect(Port);
If SerialPort.LastError <> 0 then Result := False;
end;

// create only works correctly in this main block
begin
SerialPort := TBlockSerial.Create;  // Create only works here!
if SerialStuff("Com1") then
begin
 // ..rest of program..
end;
end.

This is not convenient for me as I will have an unknown amount of objects to create from an array or list. Is the problem the parent of the object? Can I work around this?

I have contacted the developer of Synapse and he recommends asking you.

Any help would be appreciated.

Many thanks in advance.


 
stranger_2004 ©   (2004-12-09 18:34) [1]

var
SerialPort: TBlockSerial;

begin
SerialPort := TBlockSerial.Create;  // Create only works here!
if SerialStuff("Com1") then
begin
// ..rest of program..
end;
Do not create Serialport in serialstuff proc,
port already created on bolded line, if SerialPort - it`s global variable on your unit.


 
Jon ©   (2004-12-12 14:04) [2]

Sorry, maybe I was not clear. I only use one of the create lines. I included both in my example to show where it did and did not work.

I do not want to create in the main body, I want to create it in my procedure. There will be more code there to check if it really is needed and how many.

I find that if I create it in the procedure, it is not valid.

Sorry for the confusion :-)


 
alekc   (2004-12-13 12:14) [3]


> Result := True
> SerialPort := TBlockSerial.Create;   // This line does not work!> SerialPort.Connect(Port);


What it (compiler) says ?


 
Jon ©   (2004-12-13 17:07) [4]

The create line itself does not cause an error message.

When I try to use the port (connect to it) the program crashes, because the object was not created.

If you require the exact message I shall have to look at my computer later when I am near it. Probably tomorrow :-(


 
thaddy   (2004-12-14 03:11) [5]

Shure you should not use NewBlockSerial??
I will have a look at the synapse for kol code and see what I can do.

Thaddy
http://members.chello.nl/kolindex.htm


 
thaddy   (2004-12-14 03:12) [6]

http://members.chello.nl/t.koning8/kolindex.htm



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

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

Наверх




Память: 0.45 MB
Время: 0.043 c
3-1117708737
Harry7
2005-06-02 14:38
2005.07.18
Напоминалка для Дней Рождения


6-1113123235
Петя Иванов
2005-04-10 12:53
2005.07.18
загрузка страницы в браузере


14-1119958288
lookin
2005-06-28 15:31
2005.07.18
Всеобщая (включая женщин) воинская повинность в Израиле.


14-1119363167
Игорь Шевченко
2005-06-21 18:12
2005.07.18
Ищутся компоненты для работы с протоколом SMPP


14-1118922902
pasha_golub
2005-06-16 15:55
2005.07.18
Yacc&amp;Lex





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
Английский Французский Немецкий Итальянский Португальский Русский Испанский