Re: Open port USB with vb.net in PDA | Abrir el puerto USB con vb.net en PDA
From: Slobodan Brcin \(eMVP\) (sbrcin_at_ptt.yu)
Date: 04/28/04
- Next message: Slobodan Brcin \(eMVP\): "Re: Embedded spyware in registry"
- Previous message: Tony Yanez: "Losing Accessibility Options settings after rebooting (or log off)"
- In reply to: Sean Gahan: "Re: Open port USB with vb.net in PDA | Abrir el puerto USB con vb.net en PDA"
- Next in thread: KM: "Re: Open port USB with vb.net in PDA | Abrir el puerto USB con vb.net en PDA"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 28 Apr 2004 17:41:15 +0200
Sean,
> Is there any part of the Windows OS that you are not familiar with?
Well I'm bad in high level stuff, like Databases, HTML, and few similar
things.
I'm basically low level programmer, and hardware engineer for instance:
- 8 bit Microcontrollers programming. (Atmel AVR series from 1998, before
that PIC, Z80)
- x86 ASM up to and including SSE2.
- Very long C, C++, MFC, Pascal and Little of Delphi and in old days QBASIC
programming experience
- CP/M, DOS, Win 3.x, Win95 to Win XP all levels of programming. (Mostly
drivers, services, supporting API, COM, etc)
- Very heavy multiprocessor programming and bus utilizations.
List is, well little longer but this cover the basics. So as you can see I
know XPe because I know how things are working behind the hub, if I don't
know of there is no support for what I need well then I sit and write
support I need :-) Simple isn't it.
Regards,
Slobodan
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Have an opinion on the effectiveness of Microsoft Embedded newsgroups? Tell
Microsoft!
https://www.windowsembeddedeval.com/community/newsgroups
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Sean Gahan" <sean@optistreams.net> wrote in message
news:ey0qGRTLEHA.4032@TK2MSFTNGP10.phx.gbl...
> Slobodan,
> Ok, so I was ½ correct ;)
>
> Is there any part of the Windows OS that you are not familiar with?
>
>
> Regards,
>
> Sean Gahan
>
> "Slobodan Brcin (eMVP)" <sbrcin@ptt.yu> wrote in message
> news:ety7tOLLEHA.1484@tk2msftngp13.phx.gbl...
> > User application can not access 378h port of 3f8, 2f8, or any other port
> for
> > that matter.
> >
> > But you can use drivers that control that ports some other ports or
> virtual
> > devices or what ever to communicate in well in some way unified manners.
> >
> > You can do only what driver that you have opened trough CreateFile let
you
> > do trough its functionality. (You have no idea if this is real hardware
> some
> > simulation or how it is implemented when you look at it from user mode)
> >
> > Regards,
> > Slobodan
> >
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
> Tell
> > Microsoft!
> > https://www.windowsembeddedeval.com/community/newsgroups
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> > "Sean Gahan" <sean@optistreams.net> wrote in message
> > news:e7$AzILLEHA.3016@tk2msftngp13.phx.gbl...
> > > Slobodan,
> > > I was under the impression that NT had two I/O privilege levels and
user
> > > level applications did not have the appropriate privileges to access
the
> > > port. Thank you for clarifying that for me.
> > >
> > > Regards,
> > >
> > > Sean Gahan
> > >
> > >
> > > "Slobodan Brcin (eMVP)" <sbrcin@ptt.yu> wrote in message
> > > news:unJBKlKLEHA.2716@tk2msftngp13.phx.gbl...
> > > > Hi Sean,
> > > >
> > > > > I didn't think that you cant use WriteFile() on a printer port
with
> > the
> > > NT
> > > > > kernel, but is this ok with USB?
> > > >
> > > > ??? I fail to see what you are saying/asking. ???
> > > >
> > > > If you are asking if you can use LPT with WriteFile to print raw
text
> or
> > > > data then answer is positive. You can write directly to LPT port.
> > > >
> > > > Also you can write to any other thing like COM, USB COM, or any
other
> > > > virtual COM for that matter.
> > > >
> > > > Implementation or ReadFile, WriteFile, DeviceIoControl is not kernel
> > > > related, but more it is related to driver implementation that you
> opened
> > > > with CreateFile.
> > > >
> > > > Regards,
> > > > Slobodan
> > > >
> > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > Have an opinion on the effectiveness of Microsoft Embedded
newsgroups?
> > > Tell
> > > > Microsoft!
> > > > https://www.windowsembeddedeval.com/community/newsgroups
> > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > >
> > > > > Regards,
> > > > >
> > > > > Sean Gahan
> > > > >
> > > > >
> > > > > "Slobodan Brcin (eMVP)" <sbrcin@ptt.yu> wrote in message
> > > > > news:ejS%23H2JLEHA.3904@TK2MSFTNGP09.phx.gbl...
> > > > > > API functions usually won't throw exceptions.
> > > > > > Assuming that your CreateFile is successful and you have
obtained
> > > valid
> > > > > > handle.
> > > > > >
> > > > > > WriteFile function will work. Or at least it worked on all USB
COM
> > > ports
> > > > I
> > > > > > have used so far.
> > > > > >
> > > > > > I fail to see what DeviceIoControl code you have tried to use.
> > > > > >
> > > > > > BTW: make sure that GetLastError function returns 0 in all cases
> > after
> > > > > each
> > > > > > function you call.
> > > > > >
> > > > > >
> > > > > > Regards,
> > > > > > Slobodan
> > > > > >
> > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > > > Have an opinion on the effectiveness of Microsoft Embedded
> > newsgroups?
> > > > > Tell
> > > > > > Microsoft!
> > > > > > https://www.windowsembeddedeval.com/community/newsgroups
> > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > > >
> > > > > > "Edgar Hdz" <ragdeh@hotmail.com> wrote in message
> > > > > > news:#0pLefJLEHA.1484@tk2msftngp13.phx.gbl...
> > > > > > > Thanks Slobodan
> > > > > > >
> > > > > > > But, my code don't return error or Exception code;
> > > > > > > I use GetLastError() and all Ok,
> > > > > > > At this moment I can open the COM9 but now I need to send text
> to
> > > USB
> > > > > port
> > > > > > > for RS232
> > > > > > > I use WriteFile() and it doesn't send nothing or even return
> error
> > > or
> > > > > > > exception code
> > > > > > > I also use DeviceIOcontrol() and it doesn't send nothing or
> even
> > > > return
> > > > > > > error or exception code
> > > > > > >
> > > > > > > can you help me?
> > > > > > >
> > > > > > > I need a number for IOCTL_XXXXX maybe you can send it with
them
> !
> > > > > > >
> > > > > > > Thanks
> > > > > > > Edgar Hdz
> > > > > > >
> > > > > > > |<Español>|
> > > > > > > Gracias Slobodan
> > > > > > >
> > > > > > > Pero mi codigo no regresa codigo de error o excepción;
> > > > > > > uso GetLastError() y todo funciona,
> > > > > > > en este momento he logrado abrir el puerto COM9 pero ahora
> > necesito
> > > > > > enviarle
> > > > > > > datos a el puerto para RS232
> > > > > > > uso WriteFile() y no envia nada ni regresa codigo de error o
> > > excepción
> > > > > > > tambien uso DeviceIOcontrol() y no envia nada ni regresa
codigo
> > de
> > > > > error
> > > > > > o
> > > > > > > excepción
> > > > > > >
> > > > > > > Puede ayudarme?
> > > > > > >
> > > > > > > Necesito los numeros para IOCTL_XXXXX quizá pueda enviarlo con
> > esto!
> > > > > > >
> > > > > > > Gracias
> > > > > > > Edgar Hdz
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > "Slobodan Brcin (eMVP)" <sbrcin@ptt.yu> escribió en el mensaje
> > > > > > > news:uKFcaFJLEHA.1272@tk2msftngp13.phx.gbl...
> > > > > > > > Edgar this is probably wrong NG.
> > > > > > > >
> > > > > > > > You should check errors returned by CreateFile and other
> > > functions.
> > > > > > > >
> > > > > > > > Use GetLastError to get error code.
> > > > > > > > Without this error code there is a little that we can do to
> help
> > > > you.
> > > > > > > >
> > > > > > > > BTW: In case that open fails on COM9: try \\.\COM9:
> > > > > > > >
> > > > > > > > Regards,
> > > > > > > > Slobodan
> > > > > > > >
> > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > > > > > Have an opinion on the effectiveness of Microsoft Embedded
> > > > newsgroups?
> > > > > > > Tell
> > > > > > > > Microsoft!
> > > > > > > > https://www.windowsembeddedeval.com/community/newsgroups
> > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > > > > >
> > > > > > > > "Edgar Hdz" <ragdeh@hotmail.com> wrote in message
> > > > > > > > news:utXtUAJLEHA.1644@TK2MSFTNGP09.phx.gbl...
> > > > > > > > > Hi everybody |<es>| Hola a todos
> > > > > > > > >
> > > > > > > > > I have a problem with a USB; I can´t open USB port with
> VB.net
> > > for
> > > > > PDA
> > > > > > > > > |<es>| Tengo un problema con el USB; no he logrado abrir
el
> > > puerto
> > > > > USB
> > > > > > > con
> > > > > > > > > VB.net
> > > > > > > > >
> > > > > > > > > I need send text to a printer RS232 but i can´t;
> > > > > > > > > |<es>| Necesito enviar texto a una impresora RS232 pero
no
> > > puedo
> > > > > > > > > I have USB to RS232 (Chip PL2303)
> > > > > > > > > |<es>| Tengo un cable USB a RS232 (Chip PL2303)
> > > > > > > > >
> > > > > > > > > can you help me? can you tell me how open the port?
> > > > > > > > > |<es>| Prodrian ayudarme? podrian decirme como abrir el
> > puerto?
> > > > > > > > >
> > > > > > > > > I use CreateFile() and WriteFile() but it dosen't works
> > > > > > > > > |<es>| He usado CreateFile() y WriteFile() pero no funcina
> > > > > > > > >
> > > > > > > > > I also use CreateFile() and DeviceIOcontrol() but it
dosen't
> > > works
> > > > > > > > > |<es>| Tambien he usado CreateFile() y DeviceIOcontrol() y
> no
> > > > > funciona
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > Example Code
> > > > > > > > >
> > > > > > > > > <DllImport("coredll.dll")> _
> > > > > > > > > Private Shared Function CreateFile(ByVal lpFileName As
> > > String,
> > > > _
> > > > > > > > > ByVal dwDesiredAccess As Integer, ByVal
dwShareMode
> As
> > > > > > Integer,
> > > > > > > _
> > > > > > > > > ByVal lpSecurityAttributes As Integer, ByVal
> > > > > > > dwCreationDisposition
> > > > > > > > > As Integer, _
> > > > > > > > > ByVal dwFlagsAndAttributes As Integer, ByVal
> > > hTemplateFile
> > > > > As
> > > > > > > > > Integer) As Integer
> > > > > > > > > End Function
> > > > > > > > > <DllImport("coredll.dll")> _
> > > > > > > > > Private Shared Function DeviceIoControl( _
> > > > > > > > > ByVal hDevice As Int32, ByVal dwIoControlCode
> As
> > > > Int32,
> > > > > _
> > > > > > > > > ByRef lpInBuffer As Int32, ByVal nInBufferSize
> As
> > > > Int32,
> > > > > _
> > > > > > > > > ByRef lpOutBuffer As String, ByVal
> nOutBufferSize
> > As
> > > > > > Int32,
> > > > > > > _
> > > > > > > > > ByRef lpBytesReturned As Int32, ByRef
> > lpOverlapped
> > > As
> > > > > > > Int32)
> > > > > > > > As
> > > > > > > > > Int32
> > > > > > > > > End Function
> > > > > > > > > <DllImport("coredll.dll")> _
> > > > > > > > > Private Shared Function WriteFile( _
> > > > > > > > > ByVal hFile As Int32, ByVal Buffer As Byte(),
> ByVal
> > > > > > > > > nNumberOfBytesToWrite As Int32, _
> > > > > > > > > ByVal lpNumberOfBytesWritten As Int32, ByVal
> > overlapped
> > > > As
> > > > > > > Int32)
> > > > > > > > > As Int32
> > > > > > > > > End Function
> > > > > > > > >
> > > > > > > > > Function PrinterDeviceIO()
> > > > > > > > > idPort = CreateFile("COM9:", GENERIC_READ Or
> > GENERIC_WRITE,
> > > 0,
> > > > > 0,
> > > > > > > > > OPEN_EXISTING, 0, 0)
> > > > > > > > >
> > > > > > > > > intBF = DeviceIoControl(idPort, FILE_GENERIC_WRITE,
> > 2048,
> > > > 1,
> > > > > > > > > strValue, strValue.Length, intReturn, intOver)
> > > > > > > > > End Function
> > > > > > > > >
> > > > > > > > > Function PrinterWriter()
> > > > > > > > > idPort = CreateFile("COM9:", GENERIC_READ Or
> > GENERIC_WRITE,
> > > 0,
> > > > > 0,
> > > > > > > > > OPEN_EXISTING, 0, 0)
> > > > > > > > >
> > > > > > > > > intBF = WriteFile(idPort, bytBuffer, bytBuffer.Length,
> > 1024,
> > > > 0)
> > > > > > > > > End Function
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
- Next message: Slobodan Brcin \(eMVP\): "Re: Embedded spyware in registry"
- Previous message: Tony Yanez: "Losing Accessibility Options settings after rebooting (or log off)"
- In reply to: Sean Gahan: "Re: Open port USB with vb.net in PDA | Abrir el puerto USB con vb.net en PDA"
- Next in thread: KM: "Re: Open port USB with vb.net in PDA | Abrir el puerto USB con vb.net en PDA"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|