I am trying to write a video poker game in MFC for my windows programming class. I would like to use the cards.dll file in windows so I dont have to draw all the cards and stuff.
I already have cards.dll (32 bit) with my OS of course. I also have the header file with the function prototypes and #defines for the 4 cards.dll functions. I used instructions i got off the web to make a library file from the cards.dll and linked it up to the project settings. When i try to call the cards.dll functions i get a link error saying i have unresolved externals for the called cards.dll functions. I have tried everything, still get the same error!!!!
here is what i am using to make the cards.lib file:
BOOL __stdcall cdtInit(int FAR *pdxCard, int FAR *pdyCard);
BOOL __stdcall cdtDraw(HDC hdc, int x, int y, int cd, int md, DWORD rgbBgnd);
BOOL __stdcall cdtDrawExt(HDC hdc, int x, int y, int dx, int dy, int cd, int md, DWORD rgbBgnd);
BOOL __stdcall cdtAnimate(HDC hdc, int cd, int x, int y, int ispr);
VOID __stdcall cdtTerm(VOID);
Right, those are the prototypes you need, altered slightly from those you gave. Use LoadLibrary to get a handle to cards.dll, and use function pointers to get the location of those functions Excuse me being brief but I can't stay long
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You". -- Linus Torvalds
thanks for the input parksie, but i still can't quite get it.
here is my attempt to call the cdtInit function:
BOOL __stdcall DllFunc;
HINSTANCE hDLL;
int xCard, yCard;
hDLL = LoadLibrary("cards.dll");
if (hDLL != NULL)
{
DllFunc = (BOOL __stdcall)GetProcAddress(hDLL,"cdtInit");
if (!DllFunc)
{
FreeLibrary(hDLL);
break;
}
else
{
DllFunc(&xCard, &yCard);
}
}
and here are the errors i get:
C:\TEMP\testt\testt.cpp(168) : warning C4229: anachronism used : modifiers on data are ignored
C:\TEMP\testt\testt.cpp(176) : warning C4229: anachronism used : modifiers on data are ignored
C:\TEMP\testt\testt.cpp(186) : error C2064: term does not evaluate to a function
Can someone explain this cards.dll getting picture concept 2 me please.
I'm the annoying person who hears half a conversation, and has to know more. How does the cards.dll work. And how did who tells me how it works, find out how it workz?? Thanx
Visual Basic 6.0 Enterprise
Visual C++ 6.0 Professional
how does it do what it does?
- the dll has a set of 5 functions, if you load the dll into your windows program you can call these functions. download the cards.h file in this post to see what the functions do.
how do you call it?
- parksie graciously helped me out with this one. see his code in this post.
if you still cant get it, email me at [email protected]. ill send you some code to help u out.