CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: ActiveX dll

  1. #1
    Join Date
    Aug 2000
    Location
    india
    Posts
    191

    ActiveX dll

    I have created an ActiveX dll, in VB. Purpose of this dll is to confirm the exit, when user ends the application. I have put a single line of code with message box asking the user to confirm the exit, as follows.

    If MsgBox("Are you sure?", vbQuestion + vbYesNo) = vbYes Then Unload Me

    With this, I have compiled the dll.

    Then, I created a sample project and added this dll into project, using project references. Function of dll is declared privately as follows in the general declarations section.

    Private Declare Sub ExitApln Lib "qApln.dll" Alias "ExitAplnA" ()

    This dll is called in click event of command button. Thus, when button is clieked, user should get the message box, asking for confirmation.

    But I am getting an error as follows:
    'Can't find entry point ExitApln in qApln.dll'.

    Can anybody help in resolving this problem?

    Thanks in advance.




  2. #2
    Join Date
    May 1999
    Posts
    318

    Re: ActiveX dll

    If you function belongs to the public interface of you ActiveX dll you dont have to declare it.
    Just add the reference of the DLL in your client project, create an instance of your public object of your DLL and call the function.

    Therefore the Alias seems not to be used in your example. This type of alias is only use for SDK api to make the difference between ANSI and UNICODE version of api calls.



  3. #3
    Join Date
    Dec 1999
    Location
    Dublin, Ireland
    Posts
    1,173

    Re: ActiveX dll

    An ActiveX dll (which means ALL dlls written in VB) does not have the same call entry table method of accessing it's procedures as is the case with standard C dlls.

    Instead you use ActiveX interface to communicate with your dll. Try:


    Dim myObj as qAplIn.clsMain

    set myObj = new qAplIn.clsMain




    You will need to add your dll to the client project's references - do Tools->References and in the resulting reference selection screen browse for your DLL. Once added, the object model will be available to your client app.

    HTH,
    Duncan

    -------------------------------------------------
    Ex. Datis: Duncan Jones
    Merrion Computing Ltd
    http://www.merrioncomputing.com
    Check out the new downloads - ImageMap.ocx is the VB control that emulates an HTML image map, EventVB.OCX for adding new events to your VB form and adding System Tray support simply, MCL Hotkey for implemenmting system-wide hotkeys in your application...all with source code included.
    '--8<-----------------------------------------
    NEW -The printer usage monitoring application
    '--8<------------------------------------------

  4. #4
    Join Date
    Aug 2000
    Location
    india
    Posts
    191

    Re: ActiveX dll

    Thanks.
    Code in dll is like this:

    public Sub ExitApln()
    If MsgBox("are you sure?", vbQuestion + vbYesNo) = vbYes then Unload me

    End Sub




    In the client project, I created the instance of dll and removed alias. But still it is not working.

    Any solutions please!





  5. #5
    Join Date
    Aug 2000
    Location
    india
    Posts
    191

    Re: ActiveX dll

    Thank you Duncan!

    Code is working!!!




  6. #6
    Join Date
    Apr 2000
    Location
    South Carolina,USA
    Posts
    2,210

    Re: ActiveX dll

    Bad news for you. Using VB, you can not create that type of Dll . It must be written in something likc C++ or the like.

    John G

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

Featured