?
Solved

Visual Basic calling DLL events

Posted on 2006-07-11
1
Medium Priority
?
1,812 Views
Last Modified: 2013-11-25
When I show a non-modal dialog events are being returned to the calling application from the activeX so everything seems to be working fine.

However when I show a modal dialog events are getting blocked and are not seen by the calling application.

Attached is an example of the problem. One is a sample ActiveX dll and the other is a demo app which is using that dll.

Problems:

In dubug mode (IDE) of ActiveX dll, the demo app is seeing the Clicked event, however the event does not get fired in complied version of Dll.

Clicked Event is fired on Clicking [OK] button of ActiveX dll dialog

Need to Solve:

Demo app must get the event when clicking on the ActiveX dll dialog [Ok] button in the compiled exe.

In DLL Project
Add a form (Dialog) containing two buttons

Option Explicit
Public Event Clicked()

Private Sub CancelButton_Click()
    Hide
End Sub

Private Sub OKButton_Click()
        RaiseEvent Clicked
End Sub

Add a Class (clsTest)

Dim WithEvents mDialog As Dialog
Public Event Clicked()
Public Sub Load()
    Set mDialog = New Dialog
    mDialog.Show vbModal
    Unload mDialog
    Set mDialog = Nothing
End Sub
Private Sub mDialog_Clicked()
    MsgBox "Anu Jain"
    RaiseEvent Clicked
    MsgBox "Anu Jain111"
End Sub

Compile and register the DLL.

Create VBProject

Add form containing on Button, include reference of registered DLL.

Dim WithEvents mDialog As ModalDialogTest.clsTest
Private Sub Command1_Click()
    Set mDialog = New ModalDialogTest.clsTest
    mDialog.Load
   
End Sub
Private Sub mDialog_Clicked()
    MsgBox ""
End Sub

0
Comment
Question by:amit1978
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 13

Accepted Solution

by:
jmundsack earned 1350 total points
ID: 17082124
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question