473,480 Members | 2,325 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

GetOverlappedResult API call on a modem

Hi,
I'm trying to port over some old, working, VB6 code into VBDotNet and,
because the code is too bloated to continue with, I am converting it
manually, while updating various aspects of the code as needed.
At the moment, I'm trying to send some data over a modem.
I'm using the MS Telephony API 3.1 (TAPI) to make the call and have
successfully created a Call Control object, dialled, and responded to a
TAPI3Lib.CALL_STATE.CS_CONNECTED event from the call object, indicating
that it has connected successfully.
I have then used a TAPI function to get a handle for the call, which I
have then fed into this WriteFile command:

If(WriteFile(CallHandle, StringIAmTryingToSend,
StringIAmTryingToSend.Length, bytesWritten, ModemOVERLAPPED) = 0) Then

which completes successfuly, and gives me the expected 997 DDLError,
indicating that it hasn't finished yet.
I then go into a loop to check the GetOverlappedResult:

check = GetOverlappedResult(CallHandle, ModemOVERLAPPED, bytesWritten,
True)

The DLLError here is 87, which is an ERROR_INVALID_PARAMETER error, which
I can't understand. I've sent it a valid CallHandle, because if the
CallHandle isn't valid, I get a 6 returned (ERROR_INVALID_HANDLE).
Similarly, the ModemOVERLAPPED should be valid because it's been
successfully taken as input by the WriteFile, and then has been output by
WriteFile, also. bytesWritten is a simple integer, and True is a Boolean..
I can't see which parameter could be wrong.

Also, here are my declarations for the various API calls. They are the
same calls as were made in the (working) VB6 code, with the exception of
the "lpBuffer" in WriteFile, which used to be an "Any" object, but whichI
now don't know enough about to replace. I think that's probably where the
main error is, but I'm not certain. Maybe it does take a String object.
Probably not.

Private Declare Function WriteFile Lib "kernel32.dll" ( _
ByVal hFile As Integer, _
ByVal lpBuffer As String, _ 'Was "as Any"
in VB6 code
ByVal nNumberOfBytesToWrite As Integer, _
ByRef lpNumberOfBytesWritten As Integer, _
ByRef lpOverlapped As OVERLAPPED) _
As Integer

Private Declare Function GetOverlappedResult Lib "kernel32.dll" ( _
ByVal hFile As Integer, _
ByRef lpOverlapped As OVERLAPPED, _
ByRef lpNumberOfBytesTransferred As Integer, _
ByVal bWait As Boolean) _
As Integer

Private Structure OVERLAPPED
Public ternal As Integer
Public ternalHigh As Integer
Public offset As Integer
Public offsetHigh As Integer
Public hEvent As Integer
End Structure

Any ideas as to a solution would be welcome.
KF
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Sep 18 '06 #1
0 1857

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2584
by: Etienne Labuschagne | last post by:
Assuming the modem is on COM5: m = open('COM5','wb+') m.write('+++\r\n') m.flush() m.write('ATQ0V1E0\r\n') m.flush() m.write('ATDT5551234;\r\n') m.flush() response = m.read()
17
3333
by: Franc Zabkar | last post by:
My D-Link DSL-302G modem/router has a real-time clock whose settings are volatile. To avoid hand keying the date/time via the modem's JS interface, I wonder if there is a way to copy the JS code to...
1
1626
by: vgonepudi | last post by:
Hi, Requirement: I want to send numeric message to pager. For that I have developed an application in VC++. My application takes pager number as input and dials that number through my local...
3
2005
vijaydiwakar
by: vijaydiwakar | last post by:
I'm intrested to know abt TAPI,MSCOMM port communication with modem. I like to record the call on Modem using vb6 If any one have solution to this problem pls guide me....
3
6432
by: Nutshell | last post by:
Hello everybody, in my application I'd need to know if a com port is a modem or not (and eventually its description and if it is a null modem). I get the list of com ports available with: string...
7
2095
by: cj | last post by:
Has anyone figured out a way with VB2005 to send a numeric message to a pager using a common 56kb modem?
1
4566
by: KSON | last post by:
Hi, I am new to programming in C#, i want to create a communication interface with a PLC MODEM via the RS232
2
2375
by: muruganyuva | last post by:
hi, in my project i'm sending the data from source to destination with the help of modem. one modem at the source and other at the destination. at first i'm initializing the source modem. ...
0
1258
by: SteveBark | last post by:
Can anyone point me in the right direction as to what control structure I should put in place for the following requirement. I have an Access Server which I have 30 modems connected to. I need to...
0
6915
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7054
Oralloy
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,...
0
7097
jinu1996
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...
1
6750
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...
0
5353
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4794
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4493
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3003
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.