Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't give struct _COMMTIMEOUTS parametervalues!

Status
Not open for further replies.

Jiko

Technical User
Apr 5, 2002
35
SE
I have problem then I Init the struct.

typedef struct _COMMTIMEOUTS {
DWORD ReadIntervalTimeout;
DWORD ReadTotalTimeoutMultiplier;
DWORD ReadTotalTimeoutConstant;
DWORD WriteTotalTimeoutMultiplier;
DWORD WriteTotalTimeoutConstant;
} COMMTIMEOUTS,*LPCOMMTIMEOUTS;

Need to init the parameters because I use them in SetCommTimeouts:
BOOL SetCommTimeouts(
HANDLE hFile, // handle to comm device
LPCOMMTIMEOUTS lpCommTimeouts // pointer to comm time-out structure
);
lpCommTimeouts = Pointer to a COMMTIMEOUTS structure that contains the new time-out values


I create a pointer to the struct like this in my Dlg.h file:
LPCOMMTIMEOUTS LpCommTimeouts;
In my Dlg.cpp file I try to INIT the different variabels in the struct like this:
LpCommTimeouts->ReadTotalTimeoutMultiplier = 100;
Tried different numbers!
My program fails(abort) then it does this. It don't complane then I compile the program.
Then I write to test timeout:
if (SetCommTimeouts(hCom,LpCommtimeouts) != 0)
ReadFile(hCom, cBuffer, val, &dwBytesRead, NULL);

Can anybody explane this to me??
Thanks!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top