Configures a communications device according to the specifications in a device-control block (a
DCB structure). The function reinitializes all hardware and control settings, but it does not empty output or input queues.
장치 관리(DCB 구조) 사양에 맞게 통신 장치를 설정한다. 함수는 모든 하드웨어와 관리 설정을 다시 초기화한다, 그러나 그건 빈 결과나 입력 큐가 아니다.
BOOL WINAPI SetCommState(
__in HANDLE hFile,
__in LPDCB lpDCB
);
Parameters
- hFile
- A handle to the communications device. The CreateFile function returns this handle.
- 통신 장치에 대한 핸들. CreateFile 함수가 이 핸들을 반환한다.
-
- lpDCB
- A pointer to a DCB structure that contains the configuration information for the specified communications device.
- 특정 통신 장치에 대한 설정 정보를 포함한 DCB 구조에 대한 포인터.
Return Value
If the function succeeds, the return value is nonzero.
함수가 성공하면, 반환 값은 nonzero다.
If the function fails, the return value is zero. To get extended error information, call
GetLastError.
함수가 실패하면, 반환 값은 zero다. 더 많은 에러 정보를 구하려면, GetLastError를 호출하라.
Remarks
The
SetCommState function uses a
DCB structure to specify the desired configuration. The
GetCommState function returns the current configuration.
SetCommState 함수는 원하는 데로 설정하기 위해 DCB 구조를 사용한다. GetCommState 함수는 이 설정을 반환한다.
To set only a few members of the
DCB structure, you should modify a
DCB structure that has been filled in by a call to
GetCommState. This ensures that the other members of the
DCB structure have appropriate values.
DCB 구조의 일부 멤버를 설정하려면, 당신은 GetCommState를 호출해서 채워진 DCB 구조를 수정해야 한다. 이것은 DCB 구조의 다른 멤버들이 적합한 값을 갖는 것을 보장한다.
The
SetCommState function fails if the XonChar member of the
DCB structure is equal to the XoffChar member.
만약 DCB 구조의 Xonchar 멤버가 XoffChar 멤버와 같으면, SetCommState 함수는 실패한다.
When
SetCommState is used to configure the 8250, the following restrictions apply to the values for the
DCB structure's ByteSize and StopBits members:
SetCommState가 8250을 설정하기 위해 사용될 때, 다음 제약이 DCB 구조의 ByteSize와 StopBits 멤버 값에 적용된다.
The number of data bits must be 5 to 8 bits.
데이터 비트의 수는 5~8 비트여야 한다.
Example Code
For an example, see Configuring a Communications Resource.
Requirements
Client | Requires Windows Vista, Windows XP, or Windows 2000 Professional. |
---|---|
Server | Requires Windows Server 2008, Windows Server 2003, or Windows 2000 Server. |
Header | Declared in Winbase.h; include Windows.h. |
Library | Use Kernel32.lib. |
DLL | Requires Kernel32.dll. |
See Also
BuildCommDCB
Communications Functions
Communications Resources
CreateFile
DCB
GetCommState
Send comments about this topic to Microsoft
Build date: 12/20/2007
댓글을 달아 주세요