Results 1 to 3 of 3

Thread: Acessing parallel port problems

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Posts
    8

    Exclamation Acessing parallel port problems

    Hi guys,

    I've been trying to this application in Visual Studio 2010 to only write to the parallel port, so supposedly it would be a very easy task, and by all the tutorials in the internet i've seen before it really is! Although it throws me always the same error which is too generic and don't give enough information for me to solve it. I'm doing this using the "Inpout32.dll" library to make the communication between VB.NET and the port... If you guys know any other way, please tell me.

    The code is basically this:
    Module:
    Code:
    Module Module1
         Public Declare Sub Out Lib "inpout32.dll" Alias "Out32" (ByVal PortAddress As Integer, ByVal Value As Integer)
    End Module
    Form1:
    Code:
    Public Class Form1
        Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
            Out(888, 1)
        End Sub
    End Class
    Even though this code is extremely simple it was supposed to work fine, but on clicking in the button i get this error:

    SEHException was unhandled
    External component has thrown an exception.


    What i've tryed and didn't work:
    - Used hexadecimal, binary an decimal for port address and data send.
    - Verified if the port drivers and installation were ok.
    - Tryed reading from the port (same error occurs).
    - etc.

    Please guys, I don't know where else to search for this.

  2. #2
    Hyperactive Member
    Join Date
    Jan 2007
    Posts
    351

    Re: Acessing parallel port problems

    Is there any information in the inner exception which may point to the issue?
    Rico

    Using: VB.net & MS SQL

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Posts
    8

    Re: Acessing parallel port problems

    This is all I could get:

    Code:
    System.Runtime.InteropServices.SEHException was unhandled
      ErrorCode=-2147467259
      Message=External component has thrown an exception.
      Source=testParallel
      StackTrace:
           at WindowsApplication1.Module1.Out(Int32 PortAddress, Int32 Value)
           at WindowsApplication1.Form1.Button1_Click(Object sender, EventArgs e) in C:\Documents and Settings\saognaza\Desktop\testParallel\testParallel\Form1.vb:line 3
           at System.Windows.Forms.Control.OnClick(EventArgs e)
           at System.Windows.Forms.Button.OnClick(EventArgs e)
           at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
           at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
           at System.Windows.Forms.Control.WndProc(Message& m)
           at System.Windows.Forms.ButtonBase.WndProc(Message& m)
           at System.Windows.Forms.Button.WndProc(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
           at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
           at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
           at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Application.Run(ApplicationContext context)
           at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
           at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
           at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
           at WindowsApplication1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
           at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
           at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()
      InnerException:

Tags for this Thread

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