Board index » delphi » LoadLibrary problems

LoadLibrary problems

I created a dll with resources in it that I would like to access from
D2.  However, every time I use the loadlibrary function it returns a
big fat 0.

Even when I change the name of the dll to 'c:\win95\winsock.dll' it
returns 0.  What's going on?

const
   cname = 'mydll.dll';
var
   lpName: pchar;
   oHandle: THandle;
begin
   if not fileexists(cname) then
   begin
      messagedlg('File not found', mterror, [mbOK], 0);
      exit;
   end;
   GetMem(lpName, length(cname)+1);
   strpcopy(lpName, cname);
   oHandle := loadlibrary(lpName);
   if oHandle < 32 then
      MessageDlg('Error loading DLL.',mtError,[mbOk],0);
   dispose(lpName);

 

Re:LoadLibrary problems


On Sun, 29 Sep 1996 14:31:02 GMT, gi...@clark.net (Edward G.

Quote
Mittelstedt II) wrote:
>I created a dll with resources in it that I would like to access from
>D2.  However, every time I use the loadlibrary function it returns a
>big fat 0.

>Even when I change the name of the dll to 'c:\win95\winsock.dll' it
>returns 0.  What's going on?

Make sure you have a 32-bit DLL and not a 16-bit DLL as winsock.
Try to load wsock32.dll. That should work much better...

Hope this helps
Meikel Weber
m.we...@public.ndh.com
Make sure you visit my homepage
http://ourworld.compuserve.com/Homepages/meikel/mew.htm

Other Threads