when i click leftbutton, i got this message"Unable to locate the function", why i can't get the function address?
i already put the mydll.dll file in the same folder and some PATH environment variable folder, but still can't working....
please....
/***********mydll.cpp*****************/
#include<windows.h>
#include"mydll.h"
void ShowMousePos(HDC hDC, LPARAM lParam)
{
char str[80];
wsprintf(str,"Button position is %d, %d", LOWORD(lParam),HIWORD(lParam));
TextOut(hDC,LOWORD(lParam),HIWORD(lParam),str,strl en(str));
}
/******mydll.h************/
#define DllExport __declspec(dllexport)
DllExport void ShowMousePos(HDC hDC,LPARAM lParam);
/*******ExplicitDll.cpp( Win32 implement dll file)************/
long FAR PASCAL WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
HDC hDC;
HMODULE hLibrary;
typedef void (*func)(HDC,LPARAM);
func f;
hLibrary = LoadLibrary("mydll");
if(!hLibrary)
{
MessageBox(hwnd,"Cannot Load Library","Error",MB_OK);
return 0;
}
switch(msg)
{
case WM_LBUTTONDOWN:
hDC = GetDC(hwnd);
f = (func) GetProcAddress(hLibrary, "ShowMousePos");
if(!f)
{
MessageBox(hwnd,"Unable to locate the function","Error",MB_OK);
return 0;
}
f(hDC,lParam);
ReleaseDC(hwnd,hDC);
case WM_DESTROY:
FreeLibrary(hLibrary);
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd,msg,wParam,lParam);
}
return 0;
}