🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #7039

Re: EnumResourceNames

#7039
From: Ed Mulroy [TeamB]
Date: Tue, 15 Mar 2005 14:51
45 lines
2140 bytes
The EnumResourceNames function requires that you give it a pointer to 
a function with a specified set of calling arguments.  That code 
passes it a pointer to a function which does not have a matching set 
of calling arguments.

The error and the code it references is:

  EnumResourceNames(hResourceDLL,
      "RT_ICON",
      EnumResProc,
      NULL
      );

Error E2342 ques078.cpp 38:
  Type mismatch in parameter 'lpEnumFunc'
      (wanted
  'int (__stdcall *)(HINSTANCE__ *,const char *,char *,long)',
      got
  'int (__stdcall *)(HINSTANCE__ *,char *,char *,long)')
      in function _fastcall TForm1::Button2Click(TObj

To get it to compile you need to make a change to both the function 
prototype and to the actual function.  Change the type of the second 
argument in the function EnumResProc from LPTSTR to LPCTSTR.

From:

BOOL CALLBACK EnumResProc(
    HMODULE hModule,
    LPTSTR  lpszType,
    char * lpszName,
    long lParam );

To:

BOOL CALLBACK EnumResProc(
    HMODULE hModule,
    LPCTSTR  lpszType,
    char * lpszName,
    long lParam );

.  Ed

> jB wrote in message
> news:42367c11$1@newsgroups.borland.com...
Technical Details
Message-ID: <4236f6a1$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4235f905@newsgroups.borland.com> <42367c11$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,da3abd9f4e77eb05
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Ed Mulroy [TeamB]" <dont_email_me@invalid.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4235f905@newsgroups.borland.com> <42367c11$1@newsgroups.borland.com>
Subject: Re: EnumResourceNames
Date: Tue, 15 Mar 2005 09:51:56 -0500
Lines: 47
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 69.134.170.196
Message-ID: <4236f6a1$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1110898337 69.134.170.196 (15 Mar 2005 06:52:17 -0800)
X-Authenticated-User: edmulroy
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail