?
Solved

printing a variant in VB

Posted on 2000-03-23
9
Medium Priority
?
185 Views
Last Modified: 2006-11-17
How can i print the lpBuffer:

condition = ReadFile(PipeHandle, lpBuffer, nNumberOfBytesToRead, lpNumberOfBytesRead, 0&)
0
Comment
Question by:oshra
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
9 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 2648687
Hope your code writes like this:
nNumberOfBytesToRead = 100  'Example
lpBuffer = Space ( nNumberOfBytesToRead )
condition = ReadFile (...)
DEBUG.PRINT left(lpBuffer,lpNumberOfBytesRead)
0
 

Author Comment

by:oshra
ID: 2648745
That My code:
The application fail in ReadFile function.

lpBuffer = Space(nNumberOfBytesToRead)
     While condition = 0
        condition = ReadFile(PipeHandle, lpBuffer, nNumberOfBytesToRead, lpNumberOfBytesRead, 0&) 'lpOverlapped)
        If condition Then
            MsgBox Left(lpBuffer, lpNumberOfBytesRead)
        End If
     Wend

The ReadFile function defined that way:
Public Declare Function ReadFile Lib "kernel32" (ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToRead As Long, lpNumberOfBytesRead As Long, ByVal lpOverlapped As Long) As Long
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 2648759
What/Where is your problem?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:oshra
ID: 2648775
When i add the lines u segest The application start fail in ReadFile function.
before that she pass that but i could not see what in the lpBuffer.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 2648799
Transform your declaration as follows:
Public Declare Function ReadFile Lib "kernel32" (ByVal hFile As Long,  lpBuffer As String, ByVal nNumberOfBytesToRead As Long, lpNumberOfBytesRead As Long, ByVal lpOverlapped As Long) As Long
0
 

Author Comment

by:oshra
ID: 2648841
i did it but now:
if i declere lpBuffer As Variant
i get Compile Error: Type Mismatch.
if i declere lpBuffer As String
the application fail in run time.
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 80 total points
ID: 2648882
UUPS (sorry)
Public Declare Function ReadFile Lib "kernel32" (ByVal hFile As Long,  BYVAL lpBuffer As String, ByVal nNumberOfBytesToRead As Long, lpNumberOfBytesRead As Long, ByVal lpOverlapped As Long) As Long

0
 

Expert Comment

by:ivysoft
ID: 2649928
i agree with angelIII
BYVAL lpBuffer As String
should work

Brij
0
 

Author Comment

by:oshra
ID: 2652170
It Works!!
Thanks
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question