CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: parallel port

  1. #1
    Guest

    parallel port

    Anyone have any tips on how to access the parallel port in C code - i'm thinking using outp at some address, but i don't know the address of the parallel port. is all the data i need for accessing it in the device manager on my control panel? and finally, how can i access the port directly?

    thanks


  2. #2
    Join Date
    Jul 2000
    Posts
    46

    Re: parallel port

    You're in the wrong message board, but if you do a CreateFile and pass in the file name "COM1" you can open a com port. I'd assume passing in "LPT1" would open that port as well.


  3. #3
    Join Date
    Jul 2002
    Location
    .NET 2.0/.NET 3.0/.NET 3.5 VS2005/VS2008
    Posts
    284
    Sorry, I can't help you at the moment but I am working on a comport wrapper/driver. Due to some problems in the .NET code it's not possible for me to give you the files you need.
    I will look also for a wrapper around the COM code for the parallel port.
    WM.

    What about weapons of mass construction?

  4. #4
    Join Date
    Sep 1999
    Posts
    67
    Has anyone become any wiser regarding this subject?


    This is something I have used in c++ but how can I use api functions like CreateFile in c#?

    Maybe there is a better way?

    All help appretiated.


    s2 = "Kalle";
    s = "LPT1";
    h = CreateFile(s,GENERIC_WRITE or
    GENERIC_READ,0,nil,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
    if (h = INVALID_HANDLE_VALUE)
    {
    b= false;
    }

    b = WriteFile(h,s2 ,5,written,nil);
    CloseHandle(h);

  5. #5
    Join Date
    Jul 2002
    Location
    .NET 2.0/.NET 3.0/.NET 3.5 VS2005/VS2008
    Posts
    284
    Code:
    [DllImport("kernel32.dll")]
    public external int CreateFile(.......)
    The DllImport Attribute can be used to import API functions from other COM Dll files and Win32 dll files. So this can also be used to import windows API Functions into C#.
    WM.

    What about weapons of mass construction?

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