Newsgroups : Microsoft : microsoft.public.inetsdk.programming.wininet : 2006 Sep : calling (Exported) Exe Function

www.cryer.info
Managed Newsgroup Archive

calling (Exported) Exe Function

Subject:calling (Exported) Exe Function
Posted by:"Mayur" (may..@activelement.com)
Date:Mon, 25 Sep 2006 18:34:39 +0530

Hello All
I am able to call the function exported by Exe from a dll file
im getting the address of the function but whille calling that function im
getting access violation Error as bellow my code


Function Exported by EXE
void __declspec(dllexport) ExeFn()
{
MessageBox(NULL,"hi","From Exe",MB_OK);
}


Function call from Dll

HMODULE hModule;
  LPTSTR modname;
  hModule=GetModuleHandle("Placeholder.exe");
  if (hModule == NULL)
  {
  hModule=(HMODULE)LoadLibrary ("Placeholder.exe");
  }

FnPtrT FnPtr = (FnPtrT)::GetProcAddress((HMODULE)hModule, "ExeFn");
  if(FnPtr)
  {
   MessageBox(NULL,(LPCTSTR)FnPtr,"Exec",MB_OK);
  (*FnPtr)();
  }


Followinf Error

Unhandled exception at 0xfffffff9 in Mayur.dll  0xC0000005: Access violation
reading location 0xfffffff9.

Replies:

www.cryer.info
Managed Newsgroup Archive