|
-
Jan 10th, 2008, 05:42 AM
#1
Thread Starter
Lively Member
DLL help
I have one third party DLL which I have to include in my VB6 app and can use all events and functions. It works fine if I use EXE type vb6 project that DLL needs to create on event called DataEvent which raise whenever I use that hardware (DLL is for this hardware)
Event looks like this:
Private Sub Hardware_DataEvent(ByVal Status As Long)
But I want to create separate DLL and do all that stuff that I was doing in vb6 EXE project. I have created the DLL for that hardware DLL and imported in vb6 project all function are working fine but the Hardware_DataEvent is not working I have written that event in DLL same as in EXE but it’s not working. How can I raise this or intitiate this event in DLL this event cannot be called because it called itself whenever the hardware is used.
I have no idea how to do this please help
I am also using interface in DLL
-
Jan 10th, 2008, 09:08 AM
#2
Re: DLL help
How did you write that event in the DLL? In your new project are delcaring the DLL object WithEvents? Take a closer look at the the other application and search for WithEvents, I think you will find what you are looking for.
-
Jan 10th, 2008, 09:57 AM
#3
Thread Starter
Lively Member
Re: DLL help
Code:
Implements IDeviceProcessor
Public WithEvents OPOSMSR As OPOSMSR
Private Function IDeviceProcessor_InitiateDevice() As Boolean
Dim iRet
Dim POS_Error As String
On Error GoTo ErrHandler
This Function works fine <<<<<<<<<<<<<<<<<<<<<<<
Exit Function
ErrHandler:
End Function
Private Sub OPOSMSR_DataEvent(ByVal Status As Long) <<<<<<<<<<<<<<<< Woked fine in EXE type project
On Error GoTo ErrHandler
This event never fired when using hardware <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Exit Sub
ErrHandler:
'WriteLog Err.Description, "DataEvent", Err.Number
End Sub
This is not the actual code but modified just to show how my code looks like
-
Jan 10th, 2008, 11:05 AM
#4
Re: DLL help
Does the DLL make any calls to: RaiseEvent DataEvent?
-
Jan 10th, 2008, 11:37 AM
#5
Thread Starter
Lively Member
Re: DLL help
no i am not using any RaiseEvent DataEvent?
i don't want to Raise this event manually
-
Jan 14th, 2008, 10:13 AM
#6
Thread Starter
Lively Member
-
Jan 14th, 2008, 10:22 PM
#7
Re: DLL help
Well, in your 3rd post, you said the event looked like the one below
Code:
Private Sub OPOSMSR_DataEvent(ByVal Status As Long)
If that is the case, then that event is raised by a call from your DLL, which would look like : RaiseEvent DataEvent(someValue). I can tell this because that event is a method of the WithEvents OPOSMSR object. The event cannot be fired unless something calls it -- your code within the DLL.
-
Jan 15th, 2008, 03:13 AM
#8
Thread Starter
Lively Member
Re: DLL help
so how this event works in EXE type project is there any limitation in DLLs?
-
Jan 15th, 2008, 12:53 PM
#9
Re: DLL help
 Originally Posted by xor83
so how this event works in EXE type project is there any limitation in DLLs?
Go to that working EXE project and search the entire project for a statement similiar to: RaiseEvent DataEvent. Hopefully that will answer your question.
FYI: The other events (post #3) that fired are a result of the Implements keyword. You are implementing an exe/dll class, and within your project, you are probably calling some property/method setting "Me" as the implementation object. Then within the dll, you are calling the implemented methods, similar to: implementationObject.InitiateDevice(). You can verify that by also searching your dll/exe project for ".InitiateDevice"
-
Jan 21st, 2008, 01:40 AM
#10
Thread Starter
Lively Member
Re: DLL help
I am not using Implements in the DLL now i am able to catch the DataEvent but how can I raise event in EXE when Dataevent raise in DLL can i call exe event when this event raise in DLL?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|