473,385 Members | 1,597 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Callback issue

This is a great set of code for TAPI which does everything; however, I am
having the worst time trying to figure out why the form is being
reinitialized from the timerhandler instead of just calling
GetLineMessage like I really need it to.
I hope this amount of code will suffice. I think I'm just missing
something very simple.
Thanks in advance...
'///the form
Public objTAPIline As cTAPI
Private Sub Form_Load()
Set objTAPIline = New cTAPI 'Initialize the TAPI class
objTAPIline.Initialize
'other form stuff here
End Sub
Private Sub cmdDial_Click()
'dial functions here
objTAPIline.StartMessagePump Me.hwnd
End Sub

'///tapi module
'a zillion declarations
Public Sub _
TimerHandler( _
ByVal hwnd As Long, _
ByVal uMsg As Integer, _
ByVal idEvent As Integer, _
ByVal dwTime As Long)
'call getlinemessage to check for changes
frmMain.objTAPIline.GetLineMessage
End Sub

'///tapi class
'a zillion other functions and such
'timer declaration some where in here
Public Sub _
StartMessagePump( _
hwndIn As Long, _
Optional Interval As Long = 500)
SetTimer _
hwndIn, _
50, _
Interval, _
AddressOf TimerHandler
Debug.Print "starting timer"
End Sub
Public Sub _
StopMessagePump( _
hwndIn As Long)
KillTimer hwndIn, 50
End Sub
Public Sub GetLineMessage()
'check for events
End Sub
Jul 17 '05 #1
1 2382

"Jake" <ja**@jcws.net> wrote in message
news:a3**************************@posting.google.c om...
This is a great set of code for TAPI which does everything; however, I am
having the worst time trying to figure out why the form is being
reinitialized from the timerhandler instead of just calling
GetLineMessage like I really need it to.
I hope this amount of code will suffice. I think I'm just missing
something very simple.
Thanks in advance...
'///the form
Public objTAPIline As cTAPI
Private Sub Form_Load()
Set objTAPIline = New cTAPI 'Initialize the TAPI class
objTAPIline.Initialize
'other form stuff here
End Sub
Private Sub cmdDial_Click()
'dial functions here
objTAPIline.StartMessagePump Me.hwnd
End Sub

'///tapi module
'a zillion declarations
Public Sub _
TimerHandler( _
ByVal hwnd As Long, _
ByVal uMsg As Integer, _
ByVal idEvent As Integer, _
ByVal dwTime As Long)
'call getlinemessage to check for changes
frmMain.objTAPIline.GetLineMessage
End Sub

'///tapi class
'a zillion other functions and such
'timer declaration some where in here
Public Sub _
StartMessagePump( _
hwndIn As Long, _
Optional Interval As Long = 500)
SetTimer _
hwndIn, _
50, _
Interval, _
AddressOf TimerHandler
Debug.Print "starting timer"
End Sub
Public Sub _
StopMessagePump( _
hwndIn As Long)
KillTimer hwndIn, 50
End Sub
Public Sub GetLineMessage()
'check for events
End Sub


Don't know for sure, but I would try not using frmMain to refer to your main
form. If it gets called before the form is done loading, it could automatically
create another instance. Instead, declare a global variable and initialize it in
Sub Main, and start your project with Sub Main. Also, I would move the StartPump
call out of the Load event, so the form is definitely done loading and ready for
callbacks.

Global gMainForm As frmMain

Sub Main()

Set gMainForm = New frmMain

gMainForm.Show

DoEvents

gMainForm.objTAPIline.StartMessagePump gMainForm.hWnd

End Sub

Jul 17 '05 #2

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

Similar topics

6
by: prettysmurfed | last post by:
Hi all I have a bit of a problem, the subject of this post is almost selfexplaing. But here goes: Heres an example of the code I want to implement, its all nice and simple, but the flaw is I...
8
by: Ash | last post by:
Hello all, I am hoping this is the appropriate newsgroup for a C++ interface design question. I am trying to design an interface for a subscriber to register/deregister handlers for various...
4
by: Sai Kit Tong | last post by:
I have to interface managed application with my legacy dll. I have employed the wrapper approach but I have to deal with the asynchronous callback from the legacy dll, which likely goes through a...
6
by: ReinhardH | last post by:
Hi, I have to use a cdecl dll (3 party dll). One of the functions needs a callback as a parameter. Unfortunately it seems that I'm not able to solve this issue. What I have done is: Declare...
0
by: skberen | last post by:
Issue: We have a web user control on a web page (aspx) that uses the new ASP.Net 2 feature Client Callback. The web user control is using a CheckBoxList control and button control to allow the...
4
by: Kyku | last post by:
Hello all, I'm in a process of writing a small Linux C++ program for discovering repeaded files over a filesystem. One part of this task is traversing a directory structure. This is done by the...
3
by: ryan.mitchley | last post by:
Hi all I have a class (cPort) that is designed to receive objects and, depending on the type, call a handler (callback) in any descendant of a cProcessBlock class. Callback functions take a...
13
by: Wilfried Mestdagh | last post by:
Hi, I have an application using a DLL and callbacks. It generate random the error "A callback was made on a garbage collected delegate". I found some articles that the pointer to the delegate...
0
by: kkmar | last post by:
Hello Please can somebody help me with issue. I am using CallbackEvent and trying to call that function from Javascript.I am trying to retrieve multiple values from database by sending...
6
by: smmk25 | last post by:
Before I state the problem, I just want to let the readers know, I am knew to C++\CLI and interop so please forgive any newbie questions. I have a huge C library which I want to be able to use in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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
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
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...

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.