Home
Top.Mail.Ru Yandeks.Metrika
Forum: "Main";
Current archive: 2004.03.28;
Download: [xml.tar.bz2];

Down

public array of THandle Find similar branches


NPR2   (2004-03-10 10:14) [0]

In the main form, I describe the array as public and add Handle, open COM ports to it. But in the child window, when I write to the port and read from the port, I do not see the desired element of this array, i.e.
WriteFile (aHandle [m], "1 1c" + # 239,6, dw_Write, @ OverWrite) does not work.
And when in the main form I simply describe as Thandle and open only one port, then everything goes fine.
How to make everything work.



Я ©   (2004-03-10 10:21) [1]

1. "Doesn't work" is this: does not compile or does not execute what is needed?
2. Reference: MainForm.aHandle [m]. Although (as described) this is a violation of encapsulation. Use public property.



NPR2   (2004-03-10 10:30) [2]

The most interesting thing is that it compiles and runs, only without result - if I type in my forehead with my hands. This item is not visible in the auto help.



Я ©   (2004-03-10 10:36) [3]

Give:
1. Basic form class declaration
2. The code to write data to the array
3. Code for reading data from an array
4. How is the size of the array set?



NPR2   (2004-03-10 11:40) [4]

unit Gl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, ExtCtrls, DB, DBTables, Registry;
type
TGl_Form = class (TForm)
.
public
aHandle: array of THandle;
.
procedure TGl_Form.FormCreate (Sender: TObject);
.
SetLength (aHandle, st_Com_Port.Count); number of COM ports from the registry
for m: = 0 to st_Com_Port.Count-1 do
begin
aHandle [m]: = CreateFile (PChar (st_Com_Port.Strings [m]),
GENERIC_READ or GENERIC_WRITE, 0, nil,
OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0);
.
end;
procedure TGl_Form.Timer_SworTimer (Sender: TObject);
....
WriteFile (aHandle, "1 1c" + # 239,6, dw_Write, @ OverWrite);
.



Pages: 1 whole branch

Forum: "Main";
Current archive: 2004.03.28;
Download: [xml.tar.bz2];

Top





Memory: 0.55 MB
Time: 0.045 c
1-1078990342
BorisMor
2004-03-11 10:32
2004.03.28
Determine whether OSH is registered


14-1078154405
Kolyan
2004-03-01 18:20
2004.03.28
Competence


11-1057675007
Ironwit
2003-07-08 18:36
2004.03.28
listview how to work with it


3-1077861338
Yad
2004-02-27 08:55
2004.03.28
Server time


6-1073655406
Va
2004-01-09 16:36
2004.03.28
Как узнать, что закончилась регистрация в сети ?





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
English French German Italian Portuguese Russian Spanish