Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Struct to string?
Message
De
02/07/1998 06:15:40
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
Struct to string?
Divers
Thread ID:
00113711
Message ID:
00113711
Vues:
73
I have the follow struct witch I want to convert to a string!
What is the solution??

This is a long message!!

PCDCONN Structure
typedef struct {
int Port;
int Protocol;
int Baudrate;
int Station;
int TsDelay;
int TnDelay;
int Timeout;
BYTE bModem;
BYTE SbusMode;
BYTE BreakLen;
BYTE bGetPassword;
int Cpu;
int CpuType;
int CpuStatus;
DWORD CodeStart;
DWORD CodeEnd;
DWORD CodeLast;
DWORD UserEnd;
DWORD UserLast;
DWORD BaseAdds;
BYTE bEPROM;
BYTE bFlashEPROM;
BOOL bHasExt;
int ConnStation;
int ComStatus;
BOOL bModemConnected;
BYTE StepMode;
BYTE bPguMode;
BOOL bOldFW;
BYTE bLevel1;
BYTE bHasPassword;
BOOL bNeedsRestart;
int StopInternal;
int LongTimeout;
int NoRetries;
BYTE TxMsg[270];
BYTE RxMsg[270];
int TxLen;
int RxLen;
int TimeSnd;
int Channel;
int ChannelConnected;
BYTE bChanMultiConn;
BYTE bChanAutoAnswer;
BYTE bChanDontHangup;
BYTE bAutoStn;
} PCDCONN;

Members
Port
COM port number: ComPortTag
Protocol
Type of protocol, ProtocolTag
Baudrate
PCD_110..PCD_38400 BaudRateTag
Station
S-BUS station number: 0..254
TsDelay
S-BUS training sequence delay, mS
TnDelay
S-BUS turnaround time, mS
Timeout
S-BUS timeout in mS
bModem
TRUE=using dial-up modem
sbusMode
S-BUS mode: SBUSModestag
BreakLen
S-BUS break length in chars, PCD_BREAK mode
bGetPassword
TRUE=prompt for password if protected

THE USER PROGRAM MUST *NOT* WRITE TO ANY OF THE FOLLOWING VALUES
Data read from connected CPU on initial connection
Cpu
Connected CPU number: 0..6
CpuType
Connected CPU type: CPUTypeTag
CpuStatus
CPU status: PCDStatusTag
CodeStart
Offset to 1st user program line
CodeEnd
Offset to last user program line
CodeLast
Offset to last line of code seg
UserEnd
Last user program line number (0=1st)
UserLast
Last user program line in code segment
BaseAdds
Base address of user memory (68000)
bEPROM
TRUE if EPROM memory (FALSE if RAM)
bFlashEPROM
TRUE if FLASH EPROM memory (FALSE if RAM)
bHasExt
TRUE if extension memory present
ConnStation
Connected station (detects station change)
Communications and control data
ComStatus
Status of last operation ComStatusTag
bModemConnected
TRUE=connected to remote modem
StepMode
PCD_ONEBLOCK or PCD_ALLBLOCKS
bPguMode
TRUE=using PGU mode (S-BUS/P800)
bOldFW
TRUE=can't use new P800 telegrams
bLevel1
TRUE=using level 1 protocol
bHasPassword
TRUE=password protection (bLevel1=active)
bNeedsRestart
TRUE=restart cold required
StopInternal
>0=don't read data from connected CPU
LongTimeout
>0=double response timeout
NoRetries
>0=disable comms retries
TxMsg[PCD_COMBUFSIZE]
Transmit buffers
RxMsg[PCD_COMBUFSIZE]
Receive buffers
TxLen
Length of message to transmit (S-BUS only)
RxLen
Length of message to receive (S-BUS only)
TimeSnd
time to send 1 char
Data for channel functions PcdConnectChannel() etc.
Channel
Channel number
ChannelConnected
>0=connected via above channel
bChanMultiConn
TRUE=allow multiple connections on channel
bChanAutoAnswer
TRUE=channel is auto-answer mode
bChanDontHangup
TRUE=don't hang up on channel close
bAutoStn
TRUE=send "read S-BUS station" telegram

I have tried the following:

perverd=REPLICATE(CHR(0),4)

DECLARE INTEGER PcdComOpen IN SCOMM32.DLL STRING @

port=ntw(0) converting to word
protocol=ntw(1) converting to word
baudrate=ntw(8) converting to word
stasjon=ntw(1) converting to word

PCDCONN=port+protocol+baudrate+stasjon+REPLICATE(CHR(0),60)
+REPLICATE(" ",540)+REPLICATE(CHR(0),14)

per= PcdComOpen(@PCDCONN)

per returns 35 witch is Comport not open
the PCDCONN string is 622 char long and from my understanding off
the struct this is correct.

Best regards
Per Simmersholm
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform