Board index » delphi » TCustomWinSocket assignment problem..............

TCustomWinSocket assignment problem..............


2003-09-06 09:35:32 PM
delphi32
Is it true that TCustomWinSocket Object can not be assigned to another
Object ?
Here is my code for doing TCustomWinSocket assignment but it fails to
work.
type
PTest = ^TTest;
TTest = class
public
S :TCustomWinSocket;
end;
var
pt :PTest;
procedure TForm1.ServerSocket1Accept(Sender: TObject;
Socket: TCustomWinSocket);
begin
New(pt);
pt^.S := Socket; <-----------*Error in
this point*
if pt^.S.Handle = Socket.Handle then
application.MessageBox('h','h');
end;
 
 

Re:TCustomWinSocket assignment problem..............

"OH MY God" <XXXX@XXXXX.COM>writes
Quote
Is it true that TCustomWinSocket Object can not be assigned to another
Object ?

Here is my code for doing TCustomWinSocket assignment but it fails to
work.

type
PTest = ^TTest;
TTest = class
public
S :TCustomWinSocket;
end;
TTest is a class definition.
PTest is a pointer to a class definition refrerence, (IMHO).
Quote
var
pt :PTest;

procedure TForm1.ServerSocket1Accept(Sender: TObject;
Socket: TCustomWinSocket);
begin
New(pt);
New pointer to a class definition reference.
Quote
pt^.S := Socket; <-----------*Error in
this point*
I'm sure you don't want to do this.
If you wnat to store the socket in something, you need to instantiate the
class.
mySocketStore:=TTest.create;
mySocketStore.S:=Socket;
would work OK. What is it you need/are trying to do? Delphi does not have
class-level variables, (unfortunately).
Rgds,
Martin
 

Re:TCustomWinSocket assignment problem..............

"OH MY God" <XXXX@XXXXX.COM>writes
Quote
pt^.S := Socket; <-----------*Error in
this point*
What is the actual error?
Gambit
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (www.grisoft.com).
Version: 6.0.515 / Virus Database: 313 - Release Date: 9/1/03