Solved

writefile API

Posted on 1998-12-16
7
475 Views
Last Modified: 2008-03-17
How do I send a file to a comm port using the writefile() API in VB4?
0
Comment
Question by:AndrewLindsay
  • 3
  • 2
  • 2
7 Comments
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1450861
Sorry not possible in VB4.
You need a 32 bit development platform like VB5 to use writefile


0
 

Author Comment

by:AndrewLindsay
ID: 1450862
VB4 32 Bit, as far as I can tell, is a 32Bit environment, and can use the 32Bit API.
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1450863
Hmm, I always thought that it was 16bit. My mistake.
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

Author Comment

by:AndrewLindsay
ID: 1450864
VB4 Has both a 16Bit and 32Bit environment.  The 32Bit API calls are valid for the 32Bit environment.
0
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1450865
Out of curiosity: why to use WriteFile, when you can use Print or any other VB function to write to COMM ports, or even to use the COMM control for that?
0
 

Author Comment

by:AndrewLindsay
ID: 1450866
MikeP,

The reason is that I not really programming in VB, I am using PowerBasic for a DLL in VB to give a bit of qa speed increase.
0
 
LVL 8

Accepted Solution

by:
MikeP090797 earned 50 total points
ID: 1450867
Type OVERLAPPED
 Internal As Long
 InternalHigh As Long
 offset As Long
 OffsetHigh As Long
 hEvent As Long
End Type

Declare Function WriteFile Lib "kernel32" Alias "WriteFile" (ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToWrite As Long, lpNumberOfBytesWritten As Long, lpOverlapped As OVERLAPPED) As Long


Dim S as string
S="Data"
Dim L as long
WriteFile(hFile, S, Len(S), L, vbNull


0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
add text to end of existing text in file 16 70
Excel object stays open 19 73
MS Access Search and Replace Using VBA 6 70
VBA - If Bookmark = "XXBOOKMARKXX" then 15 25
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

776 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