Notiz
Zougrëff op dës Säit erfuerdert Autorisatioun. Dir kënnt probéieren, Iech unzemellen oder Verzeechnesser ze änneren.
Zougrëff op dës Säit erfuerdert Autorisatioun. Dir kënnt probéieren, Verzeechnesser ze änneren.
Attempts to open a communication device.
Syntax
HANDLE OpenCommPort(
[in] ULONG uPortNumber,
[in] DWORD dwDesiredAccess,
[in] DWORD dwFlagsAndAttributes
);
Parameters
[in] uPortNumber
A one-based port number for the communication device to open.
[in] dwDesiredAccess
The requested access to the device.
For more information about requested access, see CreateFile and Creating and Opening Files.
[in] dwFlagsAndAttributes
The requested flags and attributes to the device.
For this function, only values of FILE_FLAG_OVERLAPPED or 0x0 are expected for this parameter.
| Value | Meaning |
|---|---|
|
The file or device is being opened or created for asynchronous I/O. |
Return value
If the function succeeds, the function returns a valid HANDLE. Use CloseHandle to close that handle.
If an error occurs, the function returns INVALID_HANDLE_VALUE.
Remarks
The uPortNumber parameter accepts one-based values. A value of 1 for uPortNumber causes this function to attempt to open COM1.
To support UWP, link against WindowsApp.lib.
Requirements
| Requirement | Value |
|---|---|
| Minimum supported client | Windows 10, version 1709 [desktop apps | UWP apps] |
| Minimum supported server | Windows Server, version 1709 [desktop apps | UWP apps] |
| Target Platform | Windows |
| Header | winbase.h (include Windows.h) |
| Library | OneCore.lib |
| DLL | KernelBase.dll |