Soumya Rajiv 0 Newbie Poster

I am using Lotus C++ API to create DLL's. I use VB6 and Lotus8.5.0 for programming. I am able to create EXE files & am able to execute and see the results. I then created a DLL,used that DLL successfully in LotusScript. But when I tried to use the same DLL in VB or C++,the line where I call the DLL function,Lotus shows an error ""error opening one lotus notes application". Then Visual studio gets closed. I am pasting the code of DLL & VB here.
------------DLL Code of the function------
extern "C"
{
__int32 __stdcall NSFType(LNString strDbPath)
{
char errorBuf[151];
LNSetThrowAllErrors(TRUE); //capturing all errors
LNNotesSession session;
session.Init();//initializing API
LNDatabase db;
int status;
LNString TemplateName;

try
{
session.GetDatabase(strDbPath,&db);// getting the database
db.Open();
TemplateName=db.GetInheritsFromTemplateName();//getting the template name of the database
TemplateName=TemplateName.GetTextPtr();
if (TemplateName=="")
{
status=0; // an email database will always have a template name.

}
else
LNViewFolder View;
LNDocument Doc;
db.GetViewFolder("($All)", &View);
View.Open();//open the view
LNVFEntry Entry = View[0];//get the first entry in the view
Entry.GetDocument(&Doc);//get the handle of the first document
Doc.Open();//open the document
if (Doc.HasItem("Subject")&&Doc.HasItem("SendTo")&&Doc.HasItem("From"))
{
status=1;
}
else
{
status=0;
}
Doc.Close();//closing the document to free memory
}

}
catch(LNSTATUS error)
{
LNGetErrorMessage(error,errorBuf);
//error handling is done
}
return(status);//return the result as email/Non email type

session.Term();//terminating the lotus session.
}