FindResourceEx fails.

Hello

I cant the the following function to work. FindResourceEx returns NULL.
TRACE prints 1814 as error. m_wLanguage is 1053, and I got swedish as a lang
in my resourcefile.

const char* CResourceLoader::GetString(int nId)
{

 HRSRC hResource = FindResourceEx( NULL,
  RT_STRING,
  MAKEINTRESOURCE(nId),
  m_wLanguage);

 TRACE("%d\n", GetLastError());

 if (!hResource)
 {
  char szString[512];
  LoadString(NULL, nId, szString, 512);
  return szString;
 }
 else
  return (const char*)LoadResource(NULL, hResource);
}


0
jonas (4)
10/3/2003 7:25:15 AM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
1509 Views

Similar Articles

[PageSpeed] 25

Jonas

> I cant the the following function to work. FindResourceEx returns NULL.
> TRACE prints 1814 as error. m_wLanguage is 1053, and I got swedish as a
lang
> in my resourcefile.

1814 - means "The specified resource name cannot be found in the image
file.". Use "Error Lookup" utility that comes with VC to get further
information about error codes.

>  HRSRC hResource = FindResourceEx( NULL,
>   RT_STRING,
>   MAKEINTRESOURCE(nId),
>   m_wLanguage);

Are you aware that strings in the string table are arranged into segments or
blocks of 16 strings each ?
See KB Q200893 to get better understanding how to work with RT_STRING.

>  if (!hResource)
>  {
>   char szString[512];
>   LoadString(NULL, nId, szString, 512);
>   return szString;
>  }

You don't need hResource in order to use LoadString.

-- 
Regards,
  Kobi Ben Tzvi


"Jonas" <jonas@gauffin.org> wrote in message
news:umx4j%23XiDHA.620@TK2MSFTNGP11.phx.gbl...
> Hello
>
> I cant the the following function to work. FindResourceEx returns NULL.
> TRACE prints 1814 as error. m_wLanguage is 1053, and I got swedish as a
lang
> in my resourcefile.
>
> const char* CResourceLoader::GetString(int nId)
> {
>
>  HRSRC hResource = FindResourceEx( NULL,
>   RT_STRING,
>   MAKEINTRESOURCE(nId),
>   m_wLanguage);
>
>  TRACE("%d\n", GetLastError());
>
>  if (!hResource)
>  {
>   char szString[512];
>   LoadString(NULL, nId, szString, 512);
>   return szString;
>  }
>  else
>   return (const char*)LoadResource(NULL, hResource);
> }
>
>


0
tsumbush (69)
10/3/2003 11:36:56 AM
Reply:

Similar Artilces:

Office Enterprise 2007 failed to reinstall
Enterprise was uninstalled with intention to reinstall after Outlook window failed to open. Installation from cd now gives "error 1935. An error occurred during the installation of assembly component {837BF1EB-D770-94EB-A01F-C8B3B9A1E18E}. I also tried safe mode with command prompt and still got the same results. Any ideas? Not knowing if you have a legal version,I can safely tell you the following Free phone support from MS for Office Enterprise customers. Please have all your needed documentation on hand including the VL and the Volume License holders number that ...

assertions failing
As I have been developing my mfc dialog I have run into a strange problem. I added a new button, check and text box and set up an event handler or two. My project builds and compiles, but when I try to run it, two debug assertions fail and I can't understand how they could fail this time. first one is in wincore.cpp line 331 and it is the assertion: ASSERT(FromHandlePermanent(hWndNew)==NULL); The second one is also inwincore.cpp line 4892 ASSERT(oldWndProc!=AfxGetAfxWndProc()); I can't understand how anything I could have done would break these assertions, but I also don&#...

NTDetect Failed
When starting my PC using Windows XP, I get the following error: NTDetect Failed. This can be repaired using the installation CD however, I cannot locate the CD. Is it possible to download this Installation / Repair file to a CD from Microsoft or another safe location? -- marty marty wrote: > When starting my PC using Windows XP, I get the following error: NTDetect > Failed. This can be repaired using the installation CD however, I cannot > locate the CD. Is it possible to download this Installation / Repair file to > a CD from Microsoft or another safe location...

XslTransform.Transform fails when xsl contains node-set() Function
My transform in cludes a variable that holds a node set from the node-set() extension function. It the transformation works fine when using MSXML2 or msxsl.exe but not in VB.Net. My code looks something like this: Dim XP as New XPathDocument(XMLFileName) Dim XSLT as New XslTransform XSLT.Load(XSLTFileName) Dim Out as New MemoryStream XSLT.Transform(XP.CreateNavigaotr, Nothing, Out, Nothing) <-- Fails on this line Out.Position = 0 Dim XML as New XmlDocument XML.LoadXml(New StreamReader(Out).ReadToEnd) The exception says: System.Xml.Xsl.XsltException: Function 'msxsl:node-set()' ...

What is wrong with FindResourceEx ?
Hi : I'm testing the function FindResourceEx using code below, the IDS_TEST is defined in the sring table like this: IDS_TEST 101 "Test Me" The code to load this string is: WORD wLang = MAKELANGID (LANG_ENGLISH, SUBLANG_ENGLISH_US); HRSRC hRes = FindResourceEx (NULL, RT_STRING, MAKEINTRESOURCE (IDS_TEST), wLang); But the return from FindResourceEx is always NULL. GetLastError =1814, which is documented as "The specified resource name cannot be found in the image file. " Can you see what is wrong with my code? Did I pass the 3rd parameter correctly? Thanks ...

Cant gracefully fail Serialize method
Hi, Im having big problems which I need to solve. Im trying to implement some logic in the Serialize method of my document derived class that means that I have to be able to gracefully fail deserializtion sometimes (ie tell the user about the failure and return FALSE from OnOpenDocument). Im trying to do this by throwing a CArchiveException. To keep this simple,the following code (when called from CDocument::OnOpenDocument) void CMyDoc::Serialize(CArchive& ar) { /// ... setup if(ar.IsLoading()) { // .... more code AfxThrowArchiveException(CArchiveException::badIndex); ...

Printing bitmaps fails (also with SampleApplication)
Hi, In OPOS we use SetBitmap to upload a bitmap to the printer's memory. SetBitMap works with POS.NET, but when we try to print it we get Invalid operation exception: PrinterDevice.PrintNormal(PrinterStation.Receipt, ESC + "|1B" + "\x000d\x000a"); Also the SampleAplication (POS.NET 1.11) throws exceptions when using PrintBitmap(). BTW We are testing with an Axiohm (TPG) A794. Any help welcome. Rene ...

FindResourceEx fails.
Hello I cant the the following function to work. FindResourceEx returns NULL. TRACE prints 1814 as error. m_wLanguage is 1053, and I got swedish as a lang in my resourcefile. const char* CResourceLoader::GetString(int nId) { HRSRC hResource = FindResourceEx( NULL, RT_STRING, MAKEINTRESOURCE(nId), m_wLanguage); TRACE("%d\n", GetLastError()); if (!hResource) { char szString[512]; LoadString(NULL, nId, szString, 512); return szString; } else return (const char*)LoadResource(NULL, hResource); } Jonas > I cant the the following function to work. FindResourc...

Re: connection fails daily
On 18/12/2009 23:42, fcsark9handler wrote: ????????? *What* did the poster write? -- Dave (Sometimes man stumbles over the truth ...... Sir Winston Churchill) ...

Quick Campaigns are failing
Quick campaigns used to work for us but don't anymore. I get the following error after creating the quick campaign: This Quick Campaign could not be performed due to an error: 0x80131500. For more information, contact your system administrator. with the "Status Reason = aborted" I've searched everywhere for this error but can't find anything. Has anyone seen this before? The only change I made to the server was to use the rule deployment wizard but I also did this on another CRM installation server and Quick Campaigns still work there. Update to this: ...

Consistency Check fails and fails and fails ...
Hello all last Tuesday, we had a Blue Screen on our Home Directories server. After having it restarted, I got a DPM error, thus needing a Consistency Check. Today, one week later, I did 30 Consistency Checks, all having failed with all kinds of errors: - DPM encountered an error while performing an operation for \\?\Volume{83986761-1bce-4d28-bf4c-25bf9d86a50f}\HomeDirectories\K... (ID 2033 Details: The system cannot find the file specified (0x80070002)) - DPM encountered an error while performing an operation for \\?\Volume{83986761-1bce-4d28-bf4c-25bf9d86a50f}\HomeDirectories\G...

Hyperlink fails
Hyperlink does not execute Internet Explorer when Outlook is open. User receives 'Page Not Found'. User can refresh IE and the URL will execute. Does anyone know what the problem might be? User is running XP Pro and Outlook 2002. You may look at the following article... You Cannot Open New Internet Explorer Window or Nothing Happens After You Click a Link: http://support.microsoft.com/default.aspx?scid=kb;en-us;Q281679&sd=tech -- Nikki Peterson [MVP - Outlook] "walkerdr@wellsfargo.com" <anonymous@discussions.microsoft.com> wrote in message news:032101c39ff3$...

cut macro fails to put text on clipboard
Hi - I'm running Word 2000 sp3 on a pc running XP sp3 and have a macro that selects a partial line of text and then is supposed to insert it 3 lines further down the page: Selection.MoveRight unit:=wdCharacter, Count:=44 Selection.MoveRight unit:=wdCharacter, Count:=32, Extend:=wdExtend Selection.Cut Selection.HomeKey unit:=wdLine Selection.MoveDown unit:=wdLine, Count:=3 Selection.TypeText Text:=vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & _ vbTab & vbTab ' move line right one character Selection.T...

outlook web access inbox fails to open
i am having a problem with outlook web access. when i log on, web access opens and displays the menu on the left but the inbox never opens. all it does is say loading... and stays like that. if anyone has encountered this problem before any help would be much appreciated. Try posting this in an exchange group as Outlook Web Access is actually a function of Exchange Server, not Outlook. microsoft.public.exchange.admin is a good place to start. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert latest virus name here) vi...

FindResourceEx() and bitmap resource?
Hello, Using FindResourceEx() I find bitmap resource, how can I write the HRSRC returned into a bitmap file on disk ? It seems the bitmap data lacks the header or something if I write it as is. Regards, Elias Hello, My question is: to what part does the FindResourceEx() point ? to the bitmap data ? and what is this data pointed by HRSRC ? bitmapinfo+bitmap data ? Thanks, Elias "Alan Li" <activeperson@sina.com> wrote in message news:ONfhzX7XDHA.2648@TK2MSFTNGP09.phx.gbl... > Hi, > The bitmap file includes three parts: file header,bitmap info and bitmap > pixel da...

AfxBeginThread fails after a while
I have a worker thread that gets created with the following piece of code: // Create the thread for checking purposes ... apoExporterOutThread = AfxBeginThread(ExporterOutputFunction, this, THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED); ASSERT(apoExporterOutThread); Now, this works without problems until suddenly AfxBeginThread starts returning NULL. Once this happens, the only way to get rid of this error is to restart the app. The thread is created in a DLL. I have no idea what causes this. Can anybody help me with this? Thanks. How many threads are you creating? &qu...

mstsc fails to connect on one of two laptops
I have to nearly identical HP laptops. Both are the same model, both are running Vista64 Home Premium. With mstsc, I can connect to my XP Pro SP3 system with no trouble at all. But on the other one, the connection fails with an illuminating "Cannot connect" message. No details as to why. I tried copying the Default.rdb file from the machine that can connect to the other one. That made no difference. I tried connecting as a different user, creating another .rdp file, but that didn't work either. Any ideas? Thanks, Jason In article <#UUSfR4wKHA.3564@TK2MS...

Configuring SQL Server Reporting Services failed during 4.0 upgrade Options
I posted this in CRM Deployment, but now answers so far: Hello All, Had gotten the error message that "Configuring SQL Server Reporting Services failed - the user or group name DOMAIN\User1 is not recognized." during a 3.0 to 4.0 upgrade in TEST environment. I choose ignore and the upgrade ran through. I identified that a former developer had assigned Publisher rights at the home level within SRS. The developers account name has changed since then. Now there are no reports listed when choosing the REPORTS within CRM. There was also the error below in the app log. Any ideas how to p...

Adding Fields in DM Fails (again)
Hi I know there are a number of threads on this, but my problem seems slightly different: I have tried to add a new schema field to the Product object in DM. It is the first time I have added a new field to this entity, although I have added new fields to others. I get an error that the addition has failed and tpo refer to the event log. There are two entries: dmLog: sp_repladdcolumn failed. - Failed to add column 'CFStest' to table 'ProductBase'. and dmLog: Failed to add new String attribute (CFStest) to Product entity. I then found that I could not add a new field t...

E8604 Failed to start backup...(429) "Fail to Open Information Store"...
E8604 Failed to start backup. (DBNAME=\Public Folders, EC=EXCH Exchange Agent -- (429) "Fail to Open Information Store".) If getting this with ArcServIT 6.61, the problem is the Backup Agent RPC Server on the Exchange Server. Restart it. (And yes, I know that one should not be using antiquated software. Sometimes on has no say in the matter.) "The Bemused One" <bemused_1@yahoo.com> wrote in message news:1142450840.137704.22970@j52g2000cwj.googlegroups.com... > E8604 Failed to start backup. (DBNAME=\Public Folders, EC=EXCH Exchange > Agent -- (429) "Fa...

Why is collection failing?
I'm creating a wrapper class for a collection object, mainly so I can test whether a given records exists. I'm baffled as to why I'm getting "Invalid procedure or argument" in the exists function when I try to extract the value, whether it actually exists or not. I've tried collection.item and collection(item), same result. BTW, the values are numbers that I convert to strings. Option Compare Database Option Explicit 'this class object extends the collection object to include an 'exists' boolean function Private colStatus As VBA.Collection Private S...

CreateDirectoryW fails
Hi I want to create a directory with more then 300 characters. I am using the CreateDirectoryW function and prepending \\?\ to the path for eg.. CreateDirectoryW("\\\\?\\C:\\Temp\\..." some long name but the function fails with error 123. What could be the problem. I am working on Windows 2000. Regards Jakir Would it hurt to tell us what error 123 means? (I looked it up and it says the fllename syntax is illegal). Give your code snippet below, I'm not surprised. Take a look at CreateDirectoryW. What is its argument type? A Unicode string. So you should supply a Unic...

Users failing to log in to Exchange on some PCs but not others.
Last week a number of laptop users reported that whenever they run Outlook 2002 to access exchange they are being prompted with a login dialogue. As they are already authorised network users this should not be happening. I took the most important users laptop and checked the settings to find everything was OK. I started a test profile and tried to set up the user there. Same problem. I went to another PC and set up a new profile and accessed exchange immediately. Back at the laptop, I reinstalled the Outlook Suite, The Network components and anything else I could think may be at fault, but sti...

Operation Failed error
When I attempt to send a worksheet via email (Outlook 2000) I get "Operation Failed" error. Any ideas? ...

Report Load Failed
when i deploy my project, crystel report have an error "report load failed".This project made in C# desktop application 2008. In solution, there is no error beacuse the crystel report path work well in solution but no well in deployment. ...