Click to See Complete Forum and Search --> : Building A DLL for MFC and VB


Steve Wheatley
June 3rd, 1999, 11:21 AM
Hello all,

Requirement:

(1) Build a DLL that has one or two entry points.
(2) Pops up a dialog box
(3) Uses a progress bar and perhaps other controls
(4) Must be able to be used by both VC++ and VB developers.

I'm going mental with this problem. I've been looking at the MSDN samples, forums, FAQs etc.

Its number (4) that is holding me back at the moment. I've created a MFC Ext DLL that pops up the dialog box but when I try using it in VB I get a whole load of ASSERTS and then VB crash and burns.

My Exported Function is defined as:


// When I try the following, my MFC app doesn't link so I use the PASCAL EXPORT
//#define DllExport __declspec(dllexport)
//DllExport int TestFunction( int iarg )


extern "C" int PASCAL EXPORT TestFunction(int iarg)
{
TRACE( "TestFunction called with argument %d\n", iarg );

APUQuickDialog myDialog;
myDialog.DoModal();
return 0;
}