Re: calling methods from DLL
From: Jeff Partch [MVP] (jeffp_at_mvps.org)
Date: 11/11/04
- Next message: Jeff Partch [MVP]: "Re: Owner Draw STATIC Window with XP Themes"
- Previous message: LhK-Soft: "Re: calling methods from DLL"
- In reply to: LhK-Soft: "Re: calling methods from DLL"
- Next in thread: Headache: "Re: newb: calling methods from DLL"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 11 Nov 2004 05:42:00 -0600
"LhK-Soft" <someone@somewhere.net> wrote in message
news:419348e7$0$19156$ba620e4c@news.skynet.be...
> "Jeff Partch [MVP]" <jeffp@mvps.org> wrote in message
> news:uroa5i9xEHA.748@TK2MSFTNGP14.phx.gbl...
> > "LhK-Soft" <LhKSoft@discussions.microsoft.com> wrote in message
> > news:8EF55278-A885-4C67-B2BF-70F499446813@microsoft.com...
> > > HINSTANCE myDLL = LoadLibrary("MyLib.DLL");
> > > MyFunc myFunction = (MyFunc)GetProcAddress(myDLL, _T("MyFunc"));
> >
> > While LoadLibrary takes an LPCTSTR, GetProcAddress takes an LPCSTR. The
> > above looks backward. :)
>
> "backward" : what is your point?
The point is that you are always passing "MyLib.DLL" -- an LPCSTR, to
LoadLibrary -- a function that takes an LPCTSTR; and passing _T("MyFunc") --
an LPCTSTR, to GetProcAddress -- a function that only ever takes an LPCSTR.
In other words: backward. You should be doing...
LoadLibrary(_T("MyLib.DLL"))
GetProcAddress(myDLL, "MyFunc")
-- Jeff Partch [VC++ MVP]
- Next message: Jeff Partch [MVP]: "Re: Owner Draw STATIC Window with XP Themes"
- Previous message: LhK-Soft: "Re: calling methods from DLL"
- In reply to: LhK-Soft: "Re: calling methods from DLL"
- Next in thread: Headache: "Re: newb: calling methods from DLL"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|