darkxenn
asked on
VB6.0 DLL does not fire an Event where running the .VBP does
Hey
Just about at my wit's end, so i figured i'd throw this at y'all and see if anyone knew what i was doin wrong.
Okay, so i have two projects.
Project A creats a DLL
Project B is a Test Project to test that the interface of the DLL is working properly.
Both projects are written in VB
So, when i click "Start" on the DLL project, and then include that .vbp into the test project references, everything works fine, events that the DLL fires up to the test project get caught, and everything works as it should.
However, when i build my DLL, and try to set it as a resource in the Test Project by clicking project->References->Brows e and selecting the DLL, the DLL works fine, and does everything it should. However, it does not fire off any events at all.
So, in summary, the compiled DLL will not fire off the necessary events, whereas the DLL project running in 6.0 will.
What am i doing wrong that the compiled code will not fire off those events?
thanks a bunch
--Xen
Just about at my wit's end, so i figured i'd throw this at y'all and see if anyone knew what i was doin wrong.
Okay, so i have two projects.
Project A creats a DLL
Project B is a Test Project to test that the interface of the DLL is working properly.
Both projects are written in VB
So, when i click "Start" on the DLL project, and then include that .vbp into the test project references, everything works fine, events that the DLL fires up to the test project get caught, and everything works as it should.
However, when i build my DLL, and try to set it as a resource in the Test Project by clicking project->References->Brows
So, in summary, the compiled DLL will not fire off the necessary events, whereas the DLL project running in 6.0 will.
What am i doing wrong that the compiled code will not fire off those events?
thanks a bunch
--Xen
ASKER
Thanks for the input, eddy
that didnt do it, though.
Any other thoughts?
Thanks
--Xen
that didnt do it, though.
Any other thoughts?
Thanks
--Xen
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
XP Pro SP2
In the DLL:
Public Event CompleteTask(ResultInfo As myResult)
Public Sub TaskCompleted()
RaiseEvent CompleteTask(AppForm.getRe slt)
End Sub
In the TestApp:
Public WithEvents myObj As myDLL.Application
Private Sub myOBJ_CompleteTask(ResultI nfo As myDLL.myResult)
'
' Code to handle the event
'
End Sub
Again, when i click the "start" button in the DLL project, and reference that in my test project, everything works fine. It is when the DLL project is compiled, and the DLL is on its own that the event doesnt fire. The DLL does everything it is supposed to, except for that event.
Thanks a bunch
--Xen
In the DLL:
Public Event CompleteTask(ResultInfo As myResult)
Public Sub TaskCompleted()
RaiseEvent CompleteTask(AppForm.getRe
End Sub
In the TestApp:
Public WithEvents myObj As myDLL.Application
Private Sub myOBJ_CompleteTask(ResultI
'
' Code to handle the event
'
End Sub
Again, when i click the "start" button in the DLL project, and reference that in my test project, everything works fine. It is when the DLL project is compiled, and the DLL is on its own that the event doesnt fire. The DLL does everything it is supposed to, except for that event.
Thanks a bunch
--Xen
I have no problem to create a simple project and test, since i don't know what is your myresult, i use string. Do you have problem to use simple project. Of course i set my dll to binary compatibility
here is my test program
In dll ( use everything by default)
Option Explicit
Public Event CompleteTask(ResultInfo As String)
Public Sub TaskCompleted()
RaiseEvent CompleteTask("this is test")
End Sub
In exe (rename project to project11)
Option Explicit
Public WithEvents myObj As Project1.Class1
Private Sub myOBJ_CompleteTask(ResultI nfo As String)
MsgBox ResultInfo
End Sub
Private Sub Command1_Click()
Set myObj = New Class1
myObj.TaskCompleted
End Sub
here is my test program
In dll ( use everything by default)
Option Explicit
Public Event CompleteTask(ResultInfo As String)
Public Sub TaskCompleted()
RaiseEvent CompleteTask("this is test")
End Sub
In exe (rename project to project11)
Option Explicit
Public WithEvents myObj As Project1.Class1
Private Sub myOBJ_CompleteTask(ResultI
MsgBox ResultInfo
End Sub
Private Sub Command1_Click()
Set myObj = New Class1
myObj.TaskCompleted
End Sub
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
How does the link describe the problem related to you?
1, you are not running modal form ( i guess)
2. >>So, in summary, the compiled DLL will not fire off the necessary events
Does it opposite what you said here?
1, you are not running modal form ( i guess)
2. >>So, in summary, the compiled DLL will not fire off the necessary events
Does it opposite what you said here?
Oops... by bad. I read the names wrong and addressed my last comment to EDDYKT when it should have been addressed to darkxenn. That's just the thing, maybe he's not showing us all the code and maybe there is a modal form involved. It was just a shot in the dark.
Sorry too. I though you are the author.
>>How does the link describe the problem related to >>you?
hehe
>>How does the link describe the problem related to >>you?
hehe
I'm embarrassed... I just noticed my sample callback code (air code) was ridiculously flawed. The code should be:
(In the DLL)
Option Explicit
Public Sub TaskCompleted(ByVal CallbackObj As Object)
'do something, then call the CompleteTask procedure on the callback object
CallbackObj.CompleteTask "this is a test"
End Sub
(In the main project)
Option Explicit
Public myObj As Project1.Class1
Public Sub CompleteTask(ResultInfo As String)
MsgBox ResultInfo
End Sub
Private Sub Command1_Click()
Set myObj = New Class1
myObj.TaskCompleted Me
End Sub
(In the DLL)
Option Explicit
Public Sub TaskCompleted(ByVal CallbackObj As Object)
'do something, then call the CompleteTask procedure on the callback object
CallbackObj.CompleteTask "this is a test"
End Sub
(In the main project)
Option Explicit
Public myObj As Project1.Class1
Public Sub CompleteTask(ResultInfo As String)
MsgBox ResultInfo
End Sub
Private Sub Command1_Click()
Set myObj = New Class1
myObj.TaskCompleted Me
End Sub
ASKER
... boy, i had just forgotten to register the DLL. Workin too much apparently pushes the simple stuff out of your brain.
Thanks for your help guys, i'll split the points between you.
--Xen
Thanks for your help guys, i'll split the points between you.
--Xen
Project->project properties->component tab