Results 1 to 10 of 10

Thread: DLL help

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    120

    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

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    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.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    120

    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

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: DLL help

    Does the DLL make any calls to: RaiseEvent DataEvent?
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    120

    Re: DLL help

    no i am not using any RaiseEvent DataEvent?
    i don't want to Raise this event manually

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    120

    Re: DLL help

    any help LaVolpe?

  7. #7
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    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.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    120

    Re: DLL help

    so how this event works in EXE type project is there any limitation in DLLs?

  9. #9
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: DLL help

    Quote 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"
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    120

    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
  •  



Click Here to Expand Forum to Full Width