Click to See Complete Forum and Search --> : ActiveX dll


shashidharkr
August 17th, 2001, 01:45 AM
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.

eric33
August 17th, 2001, 02:26 AM
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.

Clearcode
August 17th, 2001, 02:50 AM
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.

shashidharkr
August 17th, 2001, 03:05 AM
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!

shashidharkr
August 17th, 2001, 03:10 AM
Thank you Duncan!

Code is working!!!

John G Duffy
August 17th, 2001, 09:58 AM
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