Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A simple question about dlls

Status
Not open for further replies.

jayjay60

Programmer
Jun 19, 2001
97
0
0
FR
Hi,

it's the first time i try to create a dll application which could be used from excel. So i try to do it by creating a MFC dynamically linked dll, where i put a simply code for a simply function:

/////////////////////////////////////////////////////////////////////////////
// The one and only CEssai2App object

CEssai2App theApp;

extern "C" __declspec(dllexport) int Maximum(int a,int b)
{

AFX_MANAGE_STATE(AfxGetStaticModuleState());

int max;

if(a<b)
max=b;
else
max=a;

return max;

}

and after the compilation, i put this line into a vba module :
Public Declare Function Maximun Lib &quot;D:\essai2\Debug\essai2.dll&quot;(byval a as integer,byval b as integer) as integer

So, i do the compilation in vba, and i try to test this function in excel by calling simply Maximum.

Excel recognize it, but instead of it returns #VALEUR

so if anybody could solve my problem

thanks in advance

jayjay
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top