CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 1999
    Posts
    1

    Problems in writing to LPT-port

    Hi

    In my windows application I need to write some characters to my locale parallel-port.
    This is a sample of the source code:

    HANDLE hPort;
    char szBuffer = "ABCDEF";
    int nBytesToWrite;
    DWORD dwBytesWritten;


    nBytesToWrite = strlen (szBuffer);
    hPort = CreateFile("LPT1", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
    WriteFile(hPort, szBuffer, nBytesToWrite, &dwBytesWritten, NULL);
    CloseHandle(hPort);

    Unfortunately the character-string is not printed out immediately. The string is printed out when window is shutting down.

    What am I doing wrong?????

    Regards,
    Kim Hansen








    I’m using Visual C++ version 5.0 / MFC.



  2. #2
    Join Date
    May 1999
    Location
    Indore India
    Posts
    34

    Re: Problems in writing to LPT-port

    i am also facing a pretty similar problem.
    when i run my executable on wi n 95, it is able to access the serial port.
    but when i run it onto win NT, it can't access the serial port..
    i tried to run the program from the administrator's account also , but it failed again....
    if you have any answers to this one , please mail me at [email protected]


  3. #3
    Guest

    Re: Problems in writing to LPT-port

    Dear Kim,
    I am trying to communicate with parallel port too, but I need you to tell me how it works. Can you send me more source code? Help me if you can and you will have a new friend in France!

    My email: [email protected]


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured