WriteFile并行端口挂起

我写一个activex控件,将访问并行端口并写入字节。 我能够成功地打开端口,但是当我写它挂在WriteFile函数。 我在这里错过了什么吗? 我正在使用Windows 7

HANDLE portHwd = CreateFile( _T("\\\\.\\LPT1" ), GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); if (portHwd) { char outBuffer[] = _T("This is a test\r\n"); int sz_buffer = strlen(outBuffer); DWORD bytes_written; if (!WriteFile( portHwd, outBuffer, sz_buffer , &bytes_written, NULL)) { CloseHandle(portHwd); GetLastError(); return 1; } CloseHandle(portHwd); } 

Solutions Collecting From Web of "WriteFile并行端口挂起"