I am working with a thermal printer that returns it's status in a string. In
vb6.0 I would use the MidB,AscB functions to examine the first 32 bits. What
can I use in vb.net to do the same. 9 2009
VBS Programer <an***********@comcast.net> wrote: I am working with a thermal printer that returns it's status in a string. In vb6.0 I would use the MidB,AscB functions to examine the first 32 bits. What can I use in vb.net to do the same.
What *exactly* do you mean by "the first 32 bits"? You need to talk in
terms of characters, not bits when it comes to text data. Use Substring
to get parts of the string.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
I have a function that return a pointer to 32bits of data from the printer.
The code I am using to get that data into my program is "
pOutData = Marshal.PtrToStringAnsi(pCscDhlPara.pOutData) ". as per the
printer developer. The variable pOutData is defined as "string =
space(2048)". I now need to examine the data "32bits" that was returned.
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om... VBS Programer <an***********@comcast.net> wrote: I am working with a thermal printer that returns it's status in a string. In vb6.0 I would use the MidB,AscB functions to examine the first 32 bits. What can I use in vb.net to do the same.
What *exactly* do you mean by "the first 32 bits"? You need to talk in terms of characters, not bits when it comes to text data. Use Substring to get parts of the string.
-- Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
VBS Programer <an***********@comcast.net> wrote: I have a function that return a pointer to 32bits of data from the printer. The code I am using to get that data into my program is " pOutData = Marshal.PtrToStringAnsi(pCscDhlPara.pOutData) ". as per the printer developer. The variable pOutData is defined as "string = space(2048)". I now need to examine the data "32bits" that was returned.
Hmm. If it's really binary data, marshalling it as a string sounds like
a really bad idea. What's the type of pCscDhlPara.pOutData?
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
The structure is defined as
Structure CscDhlPara
Dim hCsc As Int32
Dim Spec As Int32
Dim InLen As Int32
Dim pInData As IntPtr
Dim OutLen As Int32
Dim pOutData As IntPtr
Dim StClass As Int32
Dim StCode As Int32
Dim StWarn As Int32
Dim StAction As Int32
End Structure
Thanks for your time.
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om... VBS Programer <an***********@comcast.net> wrote: I have a function that return a pointer to 32bits of data from the printer. The code I am using to get that data into my program is " pOutData = Marshal.PtrToStringAnsi(pCscDhlPara.pOutData) ". as per the printer developer. The variable pOutData is defined as "string = space(2048)". I now need to examine the data "32bits" that was returned.
Hmm. If it's really binary data, marshalling it as a string sounds like a really bad idea. What's the type of pCscDhlPara.pOutData?
-- Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
VBS Programer <an***********@comcast.net> wrote: The structure is defined as
Structure CscDhlPara Dim hCsc As Int32 Dim Spec As Int32 Dim InLen As Int32 Dim pInData As IntPtr Dim OutLen As Int32 Dim pOutData As IntPtr Dim StClass As Int32 Dim StCode As Int32 Dim StWarn As Int32 Dim StAction As Int32 End Structure
Thanks for your time.
I would suggest using Marshal.ReadInt32(IntPtr) then - that should read
the first 32 bits of data at the right place.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
I have tried
Marshal.ReadIntPtr(pCscDhlPara.pOutData, pOutData)
with pOutData defined as Integer, but it seem always to return 0. How would
I check the bits of an Intger?
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om... VBS Programer <an***********@comcast.net> wrote: The structure is defined as
Structure CscDhlPara Dim hCsc As Int32 Dim Spec As Int32 Dim InLen As Int32 Dim pInData As IntPtr Dim OutLen As Int32 Dim pOutData As IntPtr Dim StClass As Int32 Dim StCode As Int32 Dim StWarn As Int32 Dim StAction As Int32 End Structure
Thanks for your time.
I would suggest using Marshal.ReadInt32(IntPtr) then - that should read the first 32 bits of data at the right place.
-- Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
I have also tried ReadInt32 and still get zero
"VBS Programer" <an***********@comcast.net> wrote in message
news:kM********************@comcast.com... I have tried Marshal.ReadIntPtr(pCscDhlPara.pOutData, pOutData)
with pOutData defined as Integer, but it seem always to return 0. How would I check the bits of an Intger? "Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message news:MP************************@msnews.microsoft.c om... VBS Programer <an***********@comcast.net> wrote: The structure is defined as
Structure CscDhlPara Dim hCsc As Int32 Dim Spec As Int32 Dim InLen As Int32 Dim pInData As IntPtr Dim OutLen As Int32 Dim pOutData As IntPtr Dim StClass As Int32 Dim StCode As Int32 Dim StWarn As Int32 Dim StAction As Int32 End Structure
Thanks for your time.
I would suggest using Marshal.ReadInt32(IntPtr) then - that should read the first 32 bits of data at the right place.
-- Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
VBS Programer <an***********@comcast.net> wrote: I have also tried ReadInt32 and still get zero
If ReadInt32 is returning zero, I'm not sure what's wrong. You need to
find out *exactly* what's going to be at the memory location returned.
Marshalling it as text seems like a very bad idea to me, but without
knowing more about the details, it's hard to know why ReadInt32 isn't
working.
You might want to ask on the interop group too - they may well be able
to help you more.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Thank you for your time, Jon.
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om... VBS Programer <an***********@comcast.net> wrote: I have also tried ReadInt32 and still get zero
If ReadInt32 is returning zero, I'm not sure what's wrong. You need to find out *exactly* what's going to be at the memory location returned. Marshalling it as text seems like a very bad idea to me, but without knowing more about the details, it's hard to know why ReadInt32 isn't working.
You might want to ask on the interop group too - they may well be able to help you more.
-- Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: MLH |
last post by:
Have a look at the procedure below. In particular, note lines 1 and
21...
Private Sub JudHrngReqBtn_Click()
On Error GoTo Err_JudHrngReqBtn_Click
Dim ThisForm As String
ThisForm = Me.Name
...
|
by: Robert W. |
last post by:
I'm trying to write a utility that will use Reflection to examine any data
model I pass it and correctly map out this model into a tree structure. When
I say "any" , in fact there will only be 3...
|
by: Edward Wilde |
last post by:
Hi,
Does anyone know how to examine items in the ASP.NET cache that are added
using the OutputCache directive in framework 1.1
i.e.
<%@ OutputCache Duration="300" VaryByParam="None"...
|
by: VBS Programer |
last post by:
I am working with a thermal printer that returns it's status in a string. In
vb6.0 I would use the MidB,AscB functions to examine the first 32 bits. What
can I use in vb.net to do the same.
|
by: Cap'n Ahab |
last post by:
I have used VB3 - VB6, so learning all this OO stuff is reasonably new
to me (although I looked at Java a few years ago). Anyway, I thought I
would write a small class to begin with, with a...
|
by: Noel Milton |
last post by:
Hi:
Ok, I've just read in up to 65,535 bytes into a char array (using the
recvfrom socket API
call). So I have an array of 8 bit char's (char recvString;).
Now, four (4) consecutive bytes...
|
by: Woody Ling |
last post by:
In 32 bits DB2 environment, is it meaningful to set sheapthres larger
than 256MB for the following case..
1. Intra-parallel is ON
2. Intra-parallel is OFF
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |